beta-0.89.2
[luatex.git] / source / libs / zziplib / zziplib-0.13.62 / docs / mksite.sh
blob12af7948d00705c3dd247671366a13a7e4fc8c25
1 #! /bin/sh
2 # this is the sh/sed variant of the mksite script. It is largely
3 # derived from snippets that I was using to finish doc pages for
4 # website publishing. For the mksite project the functionaliy has
5 # been expanded of course. Still this one does only use simple unix
6 # commands like sed, date, and test. And it still works. :-)=)
7 # http://zziplib.sf.net/mksite/
8 # THE MKSITE.SH (ZLIB/LIBPNG) LICENSE
9 # Copyright (c) 2004 Guido U. Draheim <guidod@gmx.de>
10 # This software is provided 'as-is', without any express or implied warranty
11 # In no event will the authors be held liable for any damages arising
12 # from the use of this software.
13 # Permission is granted to anyone to use this software for any purpose,
14 # including commercial applications, and to alter it and redistribute it
15 # freely, subject to the following restrictions:
16 # 1. The origin of this software must not be misrepresented; you must not
17 # claim that you wrote the original software. If you use this software
18 # in a product, an acknowledgment in the product documentation would be
19 # appreciated but is not required.
20 # 2. Altered source versions must be plainly marked as such, and must not
21 # be misrepresented as being the original software.
22 # 3. This notice may not be removed or altered from any source distribution.
23 # $Id: mksite.sh,v 1.5 2006-09-22 00:33:22 guidod Exp $
25 # Zsh is not Bourne compatible without the following: (seen in autobook)
26 if test -n "$ZSH_VERSION"; then
27 emulate sh
28 NULLCMD=:
31 # initialize some defaults
32 test ".$SITEFILE" = "." && test -f "site.htm" && SITEFILE="site.htm"
33 test ".$SITEFILE" = "." && test -f "site.html" && SITEFILE="site.html"
34 test ".$SITEFILE" = "." && SITEFILE="site.htm"
35 MK="-mksite" # note the "-" at the start
36 SED="sed"
37 CAT="cat" # "sed -e n" would be okay too
38 GREP="grep"
39 DATE_NOW="date" # should be available on all posix systems
40 DATE_R="date -r" # gnu date has it / solaris date not
41 STAT_R="stat" # gnu linux
42 LS_L="ls -l" # linux uses one less char than solaris
44 DATA="~~" # extension for meta data files
45 HEAD="~head~" # extension for head sed script
46 BODY="~body~" # extension for body sed script
47 FOOT="~foot~" # append to body text (non sed)
49 NULL="/dev/null" # to divert stdout/stderr
50 CATNULL="$CAT $NULL" # to create 0-byte files
51 SED_LONGSCRIPT="$SED -f"
53 Q='q class='
54 QX='/q'
55 LOWER="abcdefghijklmnopqrstuvwxyz"
56 UPPER="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
57 az="$LOWER" # some old sed tools can not
58 AZ="$UPPER" # use char-ranges in the
59 NN="0123456789" # match expressions so that
60 AA="_$NN$AZ$az" # we use their unrolled
61 AX="$AA.+-" # definition here
62 AP="|" # (pipe symbol in char-range)
63 AK="[" # (open range in char-range)
65 LANG="C" ; LANGUAGE="C" ; LC_COLLATE="C" # these are needed for proper
66 export LANG LANGUAGE LC_COLLATE # lowercasing as some collate
67 # treat A-Z to include a-z
69 HTMLTAGS=" a p h1 h2 h3 h4 h5 h6 dl dd dt ul ol li pre code table tr td th"
70 HTMLTAGS=" $HTMLTAGS b u i s q em strong strike cite big small sup sub tt"
71 HTMLTAGS=" $HTMLTAGS thead tbody center hr br nobr wbr"
72 HTMLTAGS=" $HTMLTAGS span div img adress blockquote"
73 HTMLTAGS2=" html head body title meta http-equiv style link"
75 # ==========================================================================
76 if "${SHELL-/bin/sh}" -c 'foo () { exit 0; }; foo' 2>$NULL ; then : ; else
77 echo "!! sorry, this shell '$SHELL' does not support shell functions" ; exit 1
80 error ()
82 echo "ERROR:" "$@" 1>&2
85 warn ()
87 echo "WARN:" "$@" 1>&2
90 note ()
92 echo "NOTE:" "$@" 1>&2
95 hint=":"
97 init ()
99 if test -d DEBUG
100 then hint="note"
102 if test "$SED" = "sed" ; then
103 if gsed --version 2>$NULL | $GREP "GNU sed" >$NULL ; then
104 SED="gsed"
105 $hint "using 'gsed' as SED"
108 if $SED --version 2>$NULL | $GREP "GNU sed" >$NULL ; then
109 az="a-z" # but if we have GNU sed
110 AZ="A-Z" # then we assume there are
111 NN="0-9" # char-ranges available
112 AA="_$NN$AZ$az" # that makes the resulting
113 AX="$AA.+-" # script more readable
114 $hint "found GNU sed - good"
115 elif uname -s | $GREP HP-UX >$NULL ; then
116 SED_LONGSCRIPT="sed_longscript" # due to 100 sed lines limit
117 $hint "weird sed - hpux sed has a limit of 100 lines" \
118 "- using sed_longscript mode"
120 if echo "TEST" | sed -e "s%[:[]*TEST%OK%" | grep OK 2>&1 > $NULL
121 then :
122 elif echo "TEST" | sed -e "s%[:\\[]*TEST%OK%" | grep OK 2>&1 > $NULL
123 then AK="\\[" ; $hint "AK=\\["
124 else AK="" ; warn "buggy sed - disabled [ in char-ranges / fileref-tests"
126 if echo "TEST" | sed -e "s%[:|]*TEST%OK%" | grep OK 2>&1 > $NULL
127 then :
128 elif echo "TEST" | sed -e "s%[:\\|]*TEST%OK%" | grep OK 2>&1 > $NULL
129 then AP="\\[" ; $hint "AP=\\|"
130 else AP="" ; warn "buggy sed - disabled | in char-ranges / fileref-tests"
134 init "NOW!!!"
136 sed_debug ()
138 $note "sed" "$@" >&2
139 sed "$@"
142 # ==========================================================================
143 # reading options from the command line GETOPT
144 opt_variables="files"
145 opt_fileseparator="?"
146 opt_files=""
147 opt_main_file=""
148 opt_formatter="$0"
149 opt=""
150 for arg in "$@" # this variant should allow to embed spaces in $arg
151 do if test ".$opt" != "." ; then
152 eval "export opt_$opt='$arg'"
153 opt=""
154 else
155 case "$arg" in
156 -*=*)
157 opt=`echo "$arg" | $SED -e "s/-*\\([$AA][$AA-]*\\).*/\\1/" -e y/-/_/`
158 if test ".$opt" = "." ; then
159 error "invalid option $arg"
160 else
161 arg=`echo "$arg" | $SED -e "s/^[^=]*=//"`
162 eval "export opt_$opt='$arg'"
163 opt_variables="$opt_variables $opt"
165 opt="" ;;
166 -*?-*) : an option with an argument --main-file=x or --main-file x
167 opt=`echo "$arg" | $SED -e "s/-*\\([$AA][$AA-]*\\).*/\\1/" -e y/-/_/`
168 if test ".$opt" = "." ; then
169 error "invalid option $arg"
170 opt=""
171 else :
172 # keep the option for next round
173 fi ;;
174 -*) : a simple option --filelist or --debug or --verbose
175 opt=`echo "$arg" | $SED -e "s/^-*\\([$AA][$AA-]*\\).*/\\1/" -e y/-/_/`
176 if test ".$opt" = "." ; then
177 error "invalid option $arg"
178 else
179 arg=`echo "$arg" | $SED -e "s/^[^=]*=//"`
180 eval "export opt_$opt=' '"
182 opt="" ;;
183 *) $hint "<$arg>"
184 if test ".$opt_main_file" = "." ; then opt_main_file="$arg" ; else
185 test ".$opt_files" != "." && opt_files="$opt_files$opt_fileseparator"
186 opt_files="$opt_files$arg" ; fi
187 opt="" ;;
188 esac
190 done ; if test ".$opt" != "." ; then
191 eval "export opt_$opt='$arg'"
192 opt=""
194 ### env | grep ^opt
196 test ".$opt_main_file" != "." && test -f "$opt_main_file" && \
197 SITEFILE="$opt_main_file"
198 test ".$opt_site_file" != "." && test -f "$opt_site_file" && \
199 SITEFILE="$opt_site_file"
200 test "$opt_debug" && \
201 hint="note"
203 if test ".$opt_help" != "." ; then
204 F="$SITEFILE"
205 echo "$0 [sitefile]";
206 echo " default sitefile = $F";
207 echo "options:";
208 echo " --filelist : show list of target files as ectracted from $F"
209 echo " --src-dir xx : if source files are not where mksite is executed"
210 echo " --tmp-dir xx : use temp instead of local directory"
211 echo " --tmp : use automatic temp directory in ${TEMP-/tmp}/mksite.*"
212 exit;
213 echo " internal:"
214 echo "--fileseparator=x : for building the internal filelist (default '?')"
215 echo "--files xx : for list of additional files to be processed"
216 echo "--main-file xx : for the main sitefile to take file list from"
219 if test ".$SITEFILE" = "." ; then
220 error "no SITEFILE found (default would be 'site.htm')"
221 exit 1
222 else
223 $hint "sitefile:" `ls -s $SITEFILE`
226 tmp="." ; if test ".$opt_tmp_dir" != "." ; then tmp="$opt_tmp_dir" ; fi
227 if test ".$opt_tmp_dir" = "." && test ".$opt_tmp" != "." ; then
228 tmp="${TEMP-/tmp}/mksite.$$" ; fi
230 # we use external files to store mappings - kind of relational tables
231 MK_TAGS="$tmp/$MK.tags.tmp.sed"
232 MK_VARS="$tmp/$MK.vars.tmp.sed"
233 MK_SPAN="$tmp/$MK.span.tmp.sed"
234 MK_META="$tmp/$MK.meta.tmp.htm"
235 MK_METT="$tmp/$MK.mett.tmp.htm"
236 MK_TEST="$tmp/$MK.test.tmp.htm"
237 MK_FAST="$tmp/$MK.fast.tmp.sed"
238 MK_GETS="$tmp/$MK.gets.tmp.sed"
239 MK_PUTS="$tmp/$MK.puts.tmp.sed"
240 MK_SITE="$tmp/$MK.site.tmp.sed"
241 MK_SECT1="$tmp/$MK.sect1.tmp.sed"
242 MK_SECT2="$tmp/$MK.sect2.tmp.sed"
243 MK_SECT3="$tmp/$MK.sect3.tmp.sed"
244 MK_STYLE="$tmp/$MK.style.tmp.sed"
245 MK_DATA="$tmp/$MK.$DATA.tmp.htm"
247 # ========================================================================
248 # ========================================================================
249 # ========================================================================
250 # MAGIC VARS
251 # IN $SITEFILE
252 printerfriendly=""
253 sectionlayout="list"
254 sitemaplayout="list"
255 attribvars=" " # <x ref="${varname:=default}">
256 updatevars=" " # <!--$varname:=-->default
257 expandvars=" " # <!--$varname-->
258 commentvars=" " # $updatevars && $expandsvars
259 sectiontab=" " # highlight ^<td class=...>...href="$section"
260 currenttab=" " # highlight ^<br>..<a href="$topic">
261 headsection="no"
262 tailsection="no"
263 sectioninfo="no" # using <h2> title <h2> = info text
264 emailfooter="no"
266 if $GREP "<!--multi-->" $SITEFILE >$NULL ; then
267 echo \
268 "WARNING: do not use <!--multi-->, change to <!--mksite:multi--> " "$SITEFILE"
269 echo \
270 "warning: or <!--mksite:multisectionlayout--> <!--mksite:multisitemaplayout-->"
271 sectionlayout="multi"
272 sitemaplayout="multi"
274 if $GREP "<!--mksite:multi-->" $SITEFILE >$NULL ; then
275 sectionlayout="multi"
276 sitemaplayout="multi"
278 if $GREP "<!--mksite:multilayout-->" $SITEFILE >$NULL ; then
279 sectionlayout="multi"
280 sitemaplayout="multi"
283 mksite_magic_option ()
285 # $1 is word/option to check for
286 INP="$2" ; test ".$INP" = "." && INP="$SITEFILE"
287 $SED \
288 -e "s/\\(<!--mksite:\\)\\($1\\)-->/\\1\\2: -->/g" \
289 -e "s/\\(<!--mksite:\\)\\([$AA][$AA]*\\)\\($1\\)-->/\\1\\3:\\2-->/g" \
290 -e "/<!--mksite:$1:/!d" \
291 -e "s/.*<!--mksite:$1:\\([^<>]*\\)-->.*/\\1/" \
292 -e "s/.*<!--mksite:$1:\\([^-]*\\)-->.*/\\1/" \
293 -e "/<!--mksite:$1:/d" -e q $INP # $++
296 x=`mksite_magic_option sectionlayout` ; case "$x" in
297 "list"|"multi") sectionlayout="$x" ;; esac
298 x=`mksite_magic_option sitemaplayout` ; case "$x" in
299 "list"|"multi") sitemaplayout="$x" ;; esac
300 x=`mksite_magic_option attribvars` ; case "$x" in
301 " "|"no"|"warn") attribvars="$x" ;; esac
302 x=`mksite_magic_option updatevars` ; case "$x" in
303 " "|"no"|"warn") updatevars="$x" ;; esac
304 x=`mksite_magic_option expandvars` ; case "$x" in
305 " "|"no"|"warn") expandvars="$x" ;; esac
306 x=`mksite_magic_option commentvars` ; case "$x" in
307 " "|"no"|"warn") commentvars="$x" ;; esac
308 x=`mksite_magic_option printerfriendly` ; case "$x" in
309 " "|".*"|"-*") printerfriendly="$x" ;; esac
310 x=`mksite_magic_option sectiontab` ; case "$x" in
311 " "|"no"|"warn") sectiontab="$x" ;; esac
312 x=`mksite_magic_option currenttab` ; case "$x" in
313 " "|"no"|"warn") currenttab="$x" ;; esac
314 x=`mksite_magic_option sectioninfo` ; case "$x" in
315 " "|"no"|"[=:-]") sectioninfo="$x" ;; esac
316 x=`mksite_magic_option emailfooter`
317 test ".$x" != "." && emailfooter="$x"
319 test ".$opt_print" != "." && printerfriendly="$opt_print"
320 test ".$commentvars" = ".no" && updatevars="no" # duplicated into
321 test ".$commentvars" = ".no" && expandvars="no" # info2vars_sed ()
324 $hint "'$sectionlayout'sectionlayout '$sitemaplayout'sitemaplayout"
325 $hint "'$attribvars'attribvars '$updatevars'updatevars"
326 $hint "'$expandvars'expandvars '$commentvars'commentvars "
327 $hint "'$currenttab'currenttab '$sectiontab'sectiontab"
328 $hint "'$headsection'headsection '$tailsection'tailsection"
330 if ($STAT_R "$SITEFILE" >$NULL) 2>$NULL ; then : ; else STAT_R=":" ; fi
331 # ==========================================================================
332 # init a few global variables
333 # 0. INIT
335 mkpathdir () {
336 if test -n "$1" && test ! -d "$1" ; then
337 echo "!! mkdir '$1'" ; mkdir "$1"
338 test ! -d "$1" || mkdir -p "$1"
342 mkpathfile () {
343 dirname=`echo "$1" | $SED -e "s:/[^/][^/]*\$::"`
344 if test ".$1" != ".$dirname" && test ".$dirname" != "." ;
345 then mkpathdir "$dirname"; fi
348 mknewfile () {
349 mkpathfile "$1"
350 $CATNULL > "$1"
353 tmp_dir_was_created="no"
354 if test ! -d "$tmp" ; then mkpathdir "$tmp" ; tmp_dir_was_created="yes" ; fi
356 # $MK_TAGS - originally, we would use a lambda execution on each
357 # uppercased html tag to replace <P> with <p class="P">. Here we just
358 # walk over all the known html tags and make an sed script that does
359 # the very same conversion. There would be a chance to convert a single
360 # tag via "h;y;x" or something we do want to convert all the tags on
361 # a single line of course.
362 mknewfile "$MK_TAGS"
363 for M in `echo $HTMLTAGS`
364 do P=`echo "$M" | $SED -e "y/$LOWER/$UPPER/"`
365 echo "s|<$P>|<$M class=\"$P\">|g" >> "$MK_TAGS"
366 echo "s|<$P |<$M class=\"$P\" |g" >> "$MK_TAGS"
367 echo "s|</$P>|</$M>|g" >> "$MK_TAGS"
368 done
369 echo "s|<>|\\&nbsp\\;|g" >> "$MK_TAGS"
370 echo "s|<->|<WBR />|g" >> "$MK_TAGS"
371 echo "s|<c>|<code>|g" >> "$MK_TAGS"
372 echo "s|</c>|</code>|g" >> "$MK_TAGS"
373 echo "s|<section>||g" >> "$MK_TAGS"
374 echo "s|</section>||g" >> "$MK_TAGS"
375 echo "s|<\\(a [^<>]*\\) />|<\\1></a>|g" >> "$MK_TAGS"
376 _ulink_="<a href=\"\\1\" remap=\"url\">\\1</a>"
377 echo "s|<a>\\([$az$AZ][$az$AZ]*://[^<>]*\\)</a>|$_ulink_|g" >> "$MK_TAGS"
378 # also make sure that some non-html entries are cleaned away that
379 # we are generally using to inject meta information. We want to see
380 # that meta ino in the *.htm browser view during editing but they
381 # shall not get present in the final html page for publishing.
382 DC_VARS="contributor date source language coverage identifier"
383 DC_VARS="$DC_VARS rights relation creator subject description"
384 DC_VARS="$DC_VARS publisher DCMIType"
385 _EQUIVS="refresh expires content-type cache-control"
386 _EQUIVS="$_EQUIVS redirect charset" # mapped to refresh / content-type
387 _EQUIVS="$_EQUIVS content-language content-script-type content-style-type"
388 for P in $DC_VARS $_EQUIVS ; do # dublin core embedded
389 echo "s|<$P>[^<>]*</$P>||g" >> "$MK_TAGS"
390 done
391 test ".$opt_keepsect" = "." && \
392 echo "s|<a sect=\"[$AZ$NN]\"|<a|g" >> "$MK_TAGS"
393 echo "s|<!--[$AX]*[?]-->||g" >> "$MK_TAGS"
394 echo "s|<!--\\\$[$AX]*[?]:-->||g" >> "$MK_TAGS"
395 echo "s|<!--\\\$[$AX]*:[?=]-->||g" >> "$MK_TAGS"
396 echo "s|\\(<[^<>]*\\)\\\${[$AX]*:[?=]\\([^<{}>]*\\)}\\([^<>]*>\\)|\\1\\2\\3|g" >>$MK_TAGS
398 # see overview at www.metatab.de - http-equivs are
399 # <refresh>5; url=target</reresh> or <redirect>target</redirect>
400 # <content-type>text/html; charset=koi8-r</content-type> iso-8859-1/UTF-8
401 # <content-language>de</content-language> <charset>UTF-8</charset>
402 # <content-script-type>text/javascript</content-script-type> /jscript/vbscript
403 # <content-style-type>text/css</content-style-type>
404 # <cache-control>no-cache</cache-control>
406 trimm ()
408 echo "$1" | $SED -e "s:^ *::" -e "s: *\$::";
410 trimmm ()
412 echo "$1" | $SED -e "s:^ *::" -e "s: *\$::" -e "s:[ ][ ]*: :g";
415 timezone ()
417 # +%z is an extension while +%Z is supposed to be posix
418 _timezone=`$DATE_NOW +%z`
419 case "$_timezone" in
420 *+*) echo "$_timezone" ;;
421 *-*) echo "$_timezone" ;;
422 *) $DATE_NOW +%Z
423 esac
425 timetoday ()
427 $DATE_NOW +%Y-%m-%d
429 timetodays ()
431 $DATE_NOW +%Y-%m%d
434 # ======================================================================
435 # FUNCS
437 sed_longscript ()
439 # hpux sed has a limit of 100 entries per sed script !
440 $SED -e "100q" "$1" > "$1~1~"
441 $SED -e "1,100d" -e "200q" "$1" > "$1~2~"
442 $SED -e "1,200d" -e "300q" "$1" > "$1~3~"
443 $SED -e "1,300d" -e "400q" "$1" > "$1~4~"
444 $SED -e "1,400d" -e "500q" "$1" > "$1~5~"
445 $SED -e "1,500d" -e "600q" "$1" > "$1~6~"
446 $SED -e "1,600d" -e "700q" "$1" > "$1~7~"
447 $SED -e "1,700d" -e "800q" "$1" > "$1~8~"
448 $SED -e "1,800d" -e "900q" "$1" > "$1~9~"
449 $SED -f "$1~1~" -f "$1~2~" -f "$1~3~" -f "$1~4~" -f "$1~5~" \
450 -f "$1~6~" -f "$1~7~" -f "$1~8~" -f "$1~9~" "$2"
453 sed_escape_key ()
455 $SED -e "s|\\.|\\\\&|g" -e "s|\\[|\\\\&|g" -e "s|\\]|\\\\&|g" "$@"
458 sed_slash_key () # helper to escape chars special in /anchor/ regex
459 { # currently escaping "/" "[" "]" "."
460 echo "$1" | sed_escape_key -e "s|/|\\\\&|g"
462 sed_piped_key () # helper to escape chars special in s|anchor|| regex
463 { # currently escaping "|" "[" "]" "."
464 echo "$1" | sed_escape_key -e "s/|/\\\\&/g"
467 back_path () # helper to get the series of "../" for a given path
469 echo "$1" | $SED -e "/\\//!d" -e "s|/[^/]*\$|/|" -e "s|[^/]*/|../|g"
472 dir_name ()
474 echo "$1" | $SED -e "s:/[^/][^/]*\$::"
477 piped_value="s/|/\\\\|/g"
478 amp_value="s|&|\\\\&|g"
479 info2vars_sed () # generate <!--$vars--> substition sed addon script
481 INP="$1" ; test ".$INP" = "." && INP="$tmp/$F.$DATA"
482 V8=" *\\([^ ][^ ]*\\) \\(.*\\)<$QX>"
483 V9=" *DC[.]\\([^ ][^ ]*\\) \\(.*\\)<$QX>"
484 N8=" *\\([^ ][^ ]*\\) \\([$NN].*\\)<$QX>"
485 N9=" *DC[.]\\([^ ][^ ]*\\) \\([$NN].*\\)<$QX>"
486 V0="\\\\([<]*\\\\)\\\\\\\$"
487 V1="\\\\([^<>]*\\\\)\\\\\\\$"
488 V2="\\\\([^{<>}]*\\\\)"
489 V3="\\\\([^<>]*\\\\)"
490 SS="<""<>"">" # spacer so value="2004" does not make for s|\(...\)|\12004|
491 test ".$commentvars" = ".no" && updatevars="no" # duplicated from
492 test ".$commentvars" = ".no" && expandvars="no" # option handling
493 test ".$expandvars" != ".no" && \
494 $SED -e "/^=....=formatter /d" -e "$piped_value" \
495 -e "/^<$Q'name'>/s,<$Q'name'>$V9,s|<!--$V0\\1[?]-->|- \\2|," \
496 -e "/^<$Q'Name'>/s,<$Q'Name'>$V9,s|<!--$V0\\1[?]-->|(\\2)|," \
497 -e "/^<$Q'name'>/s,<$Q'name'>$V8,s|<!--$V0\\1[?]-->|- \\2|," \
498 -e "/^<$Q'Name'>/s,<$Q'Name'>$V8,s|<!--$V0\\1[?]-->|(\\2)|," \
499 -e "/^<$Q/d" -e "/^<!/d" -e "$amp_value" $INP # $++
500 test ".$expandvars" != ".no" && \
501 $SED -e "/^=....=formatter /d" -e "$piped_value" \
502 -e "/^<$Q'text'>/s,<$Q'text'>$V9,s|<!--$V1\\1-->|\\\\1$SS\\2|," \
503 -e "/^<$Q'Text'>/s,<$Q'Text'>$V9,s|<!--$V1\\1-->|\\\\1$SS\\2|," \
504 -e "/^<$Q'name'>/s,<$Q'name'>$V9,s|<!--$V1\\1[?]-->|\\\\1$SS\\2|," \
505 -e "/^<$Q'Name'>/s,<$Q'Name'>$V9,s|<!--$V1\\1[?]-->|\\\\1$SS\\2|," \
506 -e "/^<$Q'text'>/s,<$Q'text'>$V8,s|<!--$V1\\1-->|\\\\1$SS\\2|," \
507 -e "/^<$Q'Text'>/s,<$Q'Text'>$V8,s|<!--$V1\\1-->|\\\\1$SS\\2|," \
508 -e "/^<$Q'name'>/s,<$Q'name'>$V8,s|<!--$V1\\1[?]-->|\\\\1$SS\\2|," \
509 -e "/^<$Q'Name'>/s,<$Q'Name'>$V8,s|<!--$V1\\1[?]-->|\\\\1$SS\\2|," \
510 -e "/^<$Q/d" -e "/^<!/d" -e "$amp_value" $INP # $++
511 test ".$updatevars" != ".no" && \
512 $SED -e "/^=....=formatter /d" -e "$piped_value" \
513 -e "/^<$Q'name'>/s,<$Q'name'>$V9,s|<!--$V0\\1:[?]-->[^<>]*|- \\2|," \
514 -e "/^<$Q'Name'>/s,<$Q'Name'>$V9,s|<!--$V0\\1:[?]-->[^<>]*|(\\2)|," \
515 -e "/^<$Q'name'>/s,<$Q'name'>$V8,s|<!--$V0\\1:[?]-->[^<>]*|- \\2|," \
516 -e "/^<$Q'Name'>/s,<$Q'Name'>$V8,s|<!--$V0\\1:[?]-->[^<>]*|(\\2)|," \
517 -e "/^<$Q/d" -e "/^<!/d" -e "$amp_value" $INP # $++
518 test ".$updatevars" != ".no" && \
519 $SED -e "/^=....=formatter /d" -e "$piped_value" \
520 -e "/^<$Q'text'>/s,<$Q'text'>$V9,s|<!--$V1\\1:[=]-->[^<>]*|\\\\1$SS\\2|," \
521 -e "/^<$Q'Text'>/s,<$Q'Text'>$V9,s|<!--$V1\\1:[=]-->[^<>]*|\\\\1$SS\\2|," \
522 -e "/^<$Q'name'>/s,<$Q'name'>$V9,s|<!--$V1\\1:[?]-->[^<>]*|\\\\1$SS\\2|," \
523 -e "/^<$Q'Name'>/s,<$Q'Name'>$V9,s|<!--$V1\\1:[?]-->[^<>]*|\\\\1$SS\\2|," \
524 -e "/^<$Q'text'>/s,<$Q'text'>$V8,s|<!--$V1\\1:[=]-->[^<>]*|\\\\1$SS\\2|," \
525 -e "/^<$Q'Text'>/s,<$Q'Text'>$V8,s|<!--$V1\\1:[=]-->[^<>]*|\\\\1$SS\\2|," \
526 -e "/^<$Q'name'>/s,<$Q'name'>$V8,s|<!--$V1\\1:[?]-->[^<>]*|\\\\1$SS\\2|," \
527 -e "/^<$Q'Name'>/s,<$Q'Name'>$V8,s|<!--$V1\\1:[?]-->[^<>]*|\\\\1$SS\\2|," \
528 -e "/^<$Q/d" -e "/^<!/d" -e "$amp_value" $INP # $++
529 test ".$attribvars" != ".no" && \
530 $SED -e "/^=....=formatter /d" -e "$piped_value" \
531 -e "/^<$Q'text'>/s,<$Q'text'>$V9,s|<$V1{\\1:[=]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \
532 -e "/^<$Q'Text'>/s,<$Q'Text'>$V9,s|<$V1{\\1:[=]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \
533 -e "/^<$Q'name'>/s,<$Q'name'>$V9,s|<$V1{\\1:[?]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \
534 -e "/^<$Q'Name'>/s,<$Q'Name'>$V9,s|<$V1{\\1:[?]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \
535 -e "/^<$Q'text'>/s,<$Q'text'>$V8,s|<$V1{\\1:[=]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \
536 -e "/^<$Q'Text'>/s,<$Q'Text'>$V8,s|<$V1{\\1:[=]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \
537 -e "/^<$Q'name'>/s,<$Q'name'>$V8,s|<$V1{\\1:[?]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \
538 -e "/^<$Q'Name'>/s,<$Q'Name'>$V8,s|<$V1{\\1:[?]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \
539 -e "/^<$Q/d" -e "/^<!/d" -e "$amp_value" $INP # $++
540 # if value="2004" then generated sed might be "\\12004" which is bad
541 # instead we generate an edited value of "\\1$SS$value" and cut out
542 # the spacer now after expanding the variable values:
543 echo "s|$SS||g" # $++
546 info2meta_sed () # generate <meta name..> text portion
548 # http://www.metatab.de/meta_tags/DC_type.htm
549 INP="$1" ; test ".$INP" = "." && INP="$tmp/$F.$DATA"
550 V6=" *HTTP[.]\\([^ ][^ ]*\\) \\(.*\\)<$QX>"
551 V7=" *DC[.]\\([^ ][^ ]*\\) \\(.*\\)<$QX>"
552 V8=" *\\([^ ][^ ]*\\) \\(.*\\)<$QX>"
553 DATA_META_TYPE_SCHEME="name=\"DC.type\" content=\"\\2\" scheme=\"\\1\""
554 DATA_META_DCMI="name=\"\\1\" content=\"\\2\" scheme=\"DCMIType\""
555 DATA_META_NAME_TZ="name=\"\\1\" content=\"\\2 `timezone`\""
556 DATA_META_NAME="name=\"\\1\" content=\"\\2\""
557 DATA_META_HTTP="http-equiv=\"\\1\" content=\"\\2\""
558 $SED -e "/=....=today /d" \
559 -e "/<$Q'meta'>HTTP[.]/s,<$Q'meta'>$V6, <meta $DATA_META_HTTP />," \
560 -e "/<$Q'meta'>DC[.]DCMIType /s,<$Q'meta'>$V7, <meta $DATA_META_TYPE_SCHEME />," \
561 -e "/<$Q'meta'>DC[.]type Collection$/s,<$Q'meta'>$V8, <meta $DATA_META_DCMI />," \
562 -e "/<$Q'meta'>DC[.]type Dataset$/s,<$Q'meta'>$V8, <meta $DATA_META_DCMI />," \
563 -e "/<$Q'meta'>DC[.]type Event$/s,<$Q'meta'>$V8, <meta $DATA_META_DCMI />," \
564 -e "/<$Q'meta'>DC[.]type Image$/s,<$Q'meta'>$V8, <meta $DATA_META_DCMI />," \
565 -e "/<$Q'meta'>DC[.]type Service$/s,<$Q'meta'>$V8, <meta $DATA_META_DCMI />," \
566 -e "/<$Q'meta'>DC[.]type Software$/s,<$Q'meta'>$V8, <meta $DATA_META_DCMI />," \
567 -e "/<$Q'meta'>DC[.]type Sound$/s,<$Q'meta'>$V8, <meta $DATA_META_DCMI />," \
568 -e "/<$Q'meta'>DC[.]type Text$/s,<$Q'meta'>$V8, <meta $DATA_META_DCMI />," \
569 -e "/<$Q'meta'>DC[.]date[.].*[+]/s,<$Q'meta'>$V8, <meta $DATA_META_NAME />," \
570 -e "/<$Q'meta'>DC[.]date[.].*[:]/s,<$Q'meta'>$V8, <meta $DATA_META_NAME_TZ />," \
571 -e "/<$Q'meta'>/s,<$Q'meta'>$V8, <meta $DATA_META_NAME />," \
572 -e "/<meta name=\"[^\"]*\" content=\"\" /d" \
573 -e "/<meta http-equiv=\"[^\"]*\" content=\"\" /d" \
574 -e "/^<$Q/d" -e "/^<!/d" $INP # $++
577 info_get_entry () # get the first <!--vars--> value known so far
579 TXT="$1" ; test ".$TXT" = "." && TXT="sect"
580 INP="$2" ; test ".$INP" = "." && INP="$tmp/$F.$DATA"
581 $SED -e "/<$Q'text'>$TXT /!d" \
582 -e "s|<$Q'text'>$TXT ||" -e "s|<$QX>||" -e "q" $INP # $++
585 info1grep () # test for a <!--vars--> substition to be already present
587 TXT="$1" ; test ".$TXT" = "." && TXT="sect"
588 INP="$2" ; test ".$INP" = "." && INP="$tmp/$F.$DATA"
589 $GREP "^<$Q'text'>$TXT " $INP >$NULL
590 return $?
593 dx_init()
595 mkpathdir "$tmp"
596 dx_meta formatter `basename $opt_formatter` > "$tmp/$F.$DATA"
597 for opt in $opt_variables ; do case "$opt" in # commandline --def=value
598 *_*) op_=`echo "$opt" | sed -e "y/_/-/"` # makes for <!--$def-->
599 dx_meta "$op_" `eval echo "\\\$opt_$opt"` ;;
600 *) dx_text "$opt" `eval echo "\\\$opt_$opt"` ;;
601 esac ; done
604 dx_line ()
606 echo "<$Q$1>$2 "`trimmm "$3"`"<$QX>" >> "$tmp/$F.$DATA"
609 DX_line ()
611 dx_val_=`echo "$3" | sed -e "s/<[^<>]*>//g"`
612 dx_line "$1" "$2" "$dx_val_"
615 dx_text ()
617 dx_line "'text'" "$1" "$2"
620 DX_text () # add a <!--vars--> substition includings format variants
622 N=`trimm "$1"` ; T=`trimm "$2"`
623 if test ".$N" != "." ; then
624 if test ".$T" != "." ; then
625 text=`echo "$T" | $SED -e "y/$UPPER/$LOWER/" -e "s/<[^<>]*>//g"`
626 dx_line "'text'" "$N" "$T"
627 dx_line "'name'" "$N" "$text"
628 varname=`echo "$N" | $SED -e 's/.*[.]//'` # cut out front part
629 if test ".$N" != ".$varname" ; then
630 text=`echo "$varname $T" | $SED -e "y/$UPPER/$LOWER/" -e "s/<[^<>]*>//g"`
631 dx_line "'Text'" "$varname" "$T"
632 dx_line "'Name'" "$varname" "$text"
638 dx_meta ()
640 DX_line "'meta'" "$1" "$2"
643 DX_meta () # add simple meta entry and its <!--vars--> subsitution
645 DX_line "'meta'" "$1" "$2"
646 DX_text "$1" "$2"
649 DC_meta () # add new DC.meta entry plus two <!--vars--> substitutions
651 DX_line "'meta'" "DC.$1" "$2"
652 DX_text "DC.$1" "$2"
653 DX_text "$1" "$2"
656 HTTP_meta () # add new HTTP.meta entry plus two <!--vars--> substitutions
658 DX_line "'meta'" "HTTP.$1" "$2"
659 DX_text "HTTP.$1" "$2"
660 DX_text "$1" "$2"
663 DC_VARS_Of () # check DC vars as listed in $DC_VARS global and generate DC_meta
664 { # the results will be added to .meta.tmp and .vars.tmp later
665 FILENAME="$1" ; test ".$FILENAME" = "." && FILENAME="$SOURCEFILE"
666 for M in $DC_VARS title ; do
667 # scan for a <markup> of this name
668 part=`$SED -e "/<$M>/!d" -e "s|.*<$M>||" -e "s|</$M>.*||" -e q $FILENAME`
669 part=`trimm "$part"`
670 text=`echo "$part" | $SED -e "s|^[$AA]*:||"`
671 text=`trimm "$text"`
672 test ".$text" = "." && continue
673 # <mark:part> will be <meta name="mark.part">
674 if test ".$text" != ".$part" ; then
675 N=`echo "$part" | $SED -e "s/:.*//"`
676 DC_meta "$M.$N" "$text"
677 elif test ".$M" = ".date" ; then
678 DC_meta "$M.issued" "$text" # "<date>" -> "<date>issued:"
679 else
680 DC_meta "$M" "$text"
682 done
685 HTTP_VARS_Of () # check HTTP-EQUIVs as listed in $_EQUIV global then
686 { # generate meta tags that are http-equiv= instead of name=
687 FILENAME="$1" ; test ".$FILENAME" = "." && FILENAME="$SOURCEFILE"
688 for M in $_EQUIVS ; do
689 # scan for a <markup> of this name
690 part=`$SED -e "/<$M>/!d" -e "s|.*<$M>||" -e "s|</$M>.*||" -e q $FILENAME`
691 part=`trimm "$part"`
692 text=`echo "$part" | $SED -e "s|^[$AA]*:||"`
693 text=`trimm "$text"`
694 test ".$text" = "." && continue
695 if test ".$M" = ".redirect" ; then
696 HTTP_meta "refresh" "5; url=$text" ; DX_text "$M" "$text"
697 elif test ".$M" = ".charset" ; then
698 HTTP_meta "content-type" "text/html; charset=$text"
699 else
700 HTTP_meta "$M" "$text"
702 done
705 DC_isFormatOf () # make sure there is this DC.relation.isFormatOf tag
706 { # choose argument for a fallback (usually $SOURCEFILE)
707 NAME="$1" ; test ".$NAME" = "." && NAME="$SOURCEFILE"
708 info1grep DC.relation.isFormatOf || DC_meta relation.isFormatOf "$NAME"
711 DC_publisher () # make sure there is this DC.publisher meta tag
712 { # choose argument for a fallback (often $USER)
713 NAME="$1" ; test ".$NAME" = "." && NAME="$USER"
714 info1grep DC.publisher || DC_meta publisher "$NAME"
717 DC_modified () # make sure there is a DC.date.modified meta tag
718 { # maybe choose from filesystem dates if possible
719 ZZ="$1" # target file
720 if info1grep DC.date.modified ; then :
721 else
722 _42_chars="........................................."
723 cut_42_55="s/^$_42_chars\\(.............\\).*/\\1/" # i.e.`cut -b 42-55`
724 text=`$STAT_R $ZZ 2>$NULL | $SED -e '/odify:/!d' -e 's|.*fy:||' -e q`
725 text=`echo "$text" | $SED -e "s/:..[.][$NN]*//"`
726 text=`trimm "$text"`
727 test ".$text" = "." && \
728 text=`$DATE_R "$ZZ" +%Y-%m-%d 2>$NULL` # GNU sed
729 test ".$text" = "." &&
730 text=`$LS_L "$ZZ" | $SED -e "$cut_42_55" -e "s/^ *//g" -e "q"`
731 text=`echo "$text" | $SED -e "s/[$NN]*:.*//"` # cut way seconds
732 DC_meta date.modified `trimm "$text"`
736 DC_date () # make sure there is this DC.date meta tag
737 { # choose from one of the available DC.date.* specials
738 ZZ="$1" # source file
739 if info1grep DC.date
740 then DX_text issue "dated `info_get_entry DC.date`"
741 DX_text updated "`info_get_entry DC.date`"
742 else text=""
743 for kind in available issued modified created ; do
744 text=`info_get_entry DC.date.$kind`
745 # test ".$text" != "." && echo "$kind = date = $text ($ZZ)"
746 test ".$text" != "." && break
747 done
748 if test ".$text" = "." ; then
749 M="date"
750 part=`$SED -e "/<$M>/!d" -e "s|.*<$M>||" -e "s|</$M>.*||" -e q $ZZ`
751 part=`trimm "$part"`
752 text=`echo "$part" | $SED -e "s|^[$AA]*:||"`
753 text=`trimm "$text"`
755 if test ".$text" = "." ; then
756 M="!--date:*=*--" # takeover updateable variable...
757 part=`$SED -e "/<$M>/!d" -e "s|.*<$M>||" -e "s|</.*||" -e q $ZZ`
758 part=`trimm "$part"`
759 text=`echo "$part" | $SED -e "s|^[$AA]*:||" -e "s|\\&.*||"`
760 text=`trimm "$text"`
762 text=`echo "$text" | $SED -e "s/[$NN]*:.*//"` # cut way seconds
763 DX_text updated "$text"
764 text1=`echo "$text" | $SED -e "s|^.* *updated ||"`
765 if test ".$text" != ".$text1" ; then
766 kind="modified" ; text=`echo "$text1" | $SED -e "s|,.*||"`
768 text1=`echo "$text" | $SED -e "s|^.* *modified ||"`
769 if test ".$text" != ".$text1" ; then
770 kind="modified" ; text=`echo "$text1" | $SED -e "s|,.*||"`
772 text1=`echo "$text" | $SED -e "s|^.* *created ||"`
773 if test ".$text" != ".$text1" ; then
774 kind="created" ; text=`echo "$text1" | $SED -e "s|,.*||"`
776 text=`echo "$text" | $SED -e "s/[$NN]*:.*//"` # cut way seconds
777 DC_meta date `trimm "$text"`
778 DX_text issue `trimm "$kind $text"`
782 DC_title ()
784 # choose a title for the document, either an explicit title-tag
785 # or one of the section headers in the document or fallback to filename
786 ZZ="$1" # target file
787 if info1grep DC.title ; then :
788 else
789 for M in TITLE title H1 h1 H2 h2 H3 H3 H4 H4 H5 h5 H6 h6 ; do
790 text=`$SED -e "/<$M>/!d" -e "s|.*<$M>||" -e "s|</$M>.*||" -e q $ZZ`
791 text=`trimm "$text"` ; test ".$text" != "." && break
792 MM="$M [^<>]*"
793 text=`$SED -e "/<$MM>/!d" -e "s|.*<$MM>||" -e "s|</$M>.*||" -e q $ZZ`
794 text=`trimm "$text"` ; test ".$text" != "." && break
795 done
796 if test ".text" = "." ; then
797 text=`basename $ZZ .html`
798 text=`basename $text .htm | $SED -e 'y/_/ /' -e "s/\\$/ info/"`
800 term=`echo "$text" | $SED -e 's/.*[(]//' -e 's/[)].*//'`
801 text=`echo "$text" | $SED -e 's/[(][^()]*[)]//'`
802 if test ".$term" = "." || test ".$term" = ".$text" ; then
803 DC_meta title "$text"
804 else
805 DC_meta title "$term - $text"
810 site_get_section () # return parent section page of given page
812 _F_=`sed_slash_key "$1"`
813 $SED -e "/^<$Q'sect'>$_F_ /!d" \
814 -e "s|^<$Q'sect'>$_F_ ||" -e "s|<$QX>||" \
815 -e q "$MK_DATA" # $++
818 DC_section () # not really a DC relation (shall we use isPartOf ?)
819 { # each document should know its section father
820 sectn=`site_get_section "$F"`
821 if test ".$sectn" != "." ; then
822 DC_meta relation.section "$sectn"
826 info_get_entry_section()
828 info_get_entry DC.relation.section # $++
831 site_get_selected () # return section of given page
833 _F_=`sed_slash_key "$1"`
834 $SED -e "/<$Q'use.'>$_F_ /!d" \
835 -e "s|<$Q'use.'>[^ ]* ||" -e "s|<$QX>||" \
836 -e q "$MK_DATA" # $++
839 DC_selected () # not really a DC title (shall we use alternative ?)
841 # each document might want to highlight the currently selected item
842 short=`site_get_selected "$F"`
843 if test ".$short" != "." ; then
844 DC_meta title.selected "$short"
848 info_get_entry_selected ()
850 info_get_entry DC.title.selected # $++
853 site_get_rootsections () # return all sections from root of nav tree
855 $SED -e "/^<$Q'use1'>/!d" \
856 -e "s|^<$Q'use.'>\\([^ ]*\\) .*|\\1|" "$MK_DATA" # $++
859 site_get_sectionpages () # return all children pages in the given section
861 _F_=`sed_slash_key "$1"`
862 $SED -e "/^<$Q'sect'>[^ ]* $_F_<[^<>]*>\$/!d" \
863 -e "s|^<$Q'sect'>||" -e "s|<$QX>||" \
864 -e "s/ .*//" "$MK_DATA" # $++
867 site_get_subpages () # return all page children of given page
869 _F_=`sed_slash_key "$1"`
870 $SED -e "/^<$Q'node'>[^ ]* $_F_<[^<>]*>\$/!d" \
871 -e "s|^<$Q'node'>||" -e "s|<$QX>||" \
872 -e "s/ .*//" "$MK_DATA"
873 # $++
876 site_get_parentpage () # return parent page for given page (".." for sections)
878 _F_=`sed_slash_key "$1"`
879 $SED -e "/^<$Q'node'>$_F_ /!d" \
880 -e "s|^<$Q'node'>[^ ]* ||" -e "s|<$QX>||" \
881 -e "q" "$MK_DATA" # $++
884 DX_alternative () # detect wether page asks for alternative style
885 { # which is generally a shortpage variant
886 x=`mksite_magic_option alternative $1 | sed -e "s/^ *//" -e "s/ .*//"`
887 if test ".$x" != "." ; then
888 DX_text alternative "$x"
892 info2head_sed () # append alternative handling script to $HEAD
894 have=`info_get_entry alternative`
895 if test ".$have" != "." ; then
896 echo "/<!--mksite:alternative:$have .*-->/{" # $++
897 echo "s/<!--mksite:alternative:$have\\( .*\\)-->/\\1/" # $++
898 echo "q" # $++
899 echo "}" # $++
902 info2body_sed () # append alternative handling script to $BODY
904 have=`info_get_entry alternative`
905 if test ".$have" != "." ; then
906 echo "s/<!--mksite:alternative:$have\\( .*\\)-->/\\1/" # $++
910 bodymaker_for_sectioninfo ()
912 test ".$sectioninfo" = ".no" && return
913 _x_="<!--mksite:sectioninfo::-->"
914 _q_="\\([^<>]*[$AX][^<>]*\\)"
915 test ".$sectioninfo" != ". " && _q_="[ ][ ]*$sectioninfo\\([ ]\\)"
916 echo "s|\\(^<[hH][$NN][ >].*</[hH][$NN]>\\)$_q_|\\1$_x_\\2|" # $++
917 echo "/$_x_/s|^|<table width=\"100%\"><tr valign=\"bottom\"><td>|" # $++
918 echo "/$_x_/s|</[hH][$NN]>|&</td><td align=\"right\"><i>|" # $++
919 echo "/$_x_/s|\$|</i></td></tr></table>|" # $++
920 echo "s|$_x_||" # $++
923 fast_href () # args "$FILETOREFERENCE" "$FROMCURRENTFILE:$F"
924 { # prints path to $FILETOREFERENCE href-clickable in $FROMCURRENTFILE
925 # if no subdirectoy then output is the same as input $FILETOREFERENCE
926 R="$2" ; test ".$R" = "." && R="$F"
927 S=`back_path "$R"`
928 if test ".$S" = "."
929 then echo "$1" # $++
930 else _1_=`echo "$1" | \
931 $SED -e "/^ *\$/d" -e "/^\\//d" -e "/^[.][.]/d" -e "/^[$AA]*:/d" `
932 if test ".$_1_" = "." # don't move any in the pattern above
933 then echo "$1" # $++
934 else echo "$S$1" # $++ prefixed with backpath
935 fi fi
938 make_back_path () # "$FILE"
940 R="$1" ; test ".$R" = "." && R="$F"
941 S=`back_path "$R"`
942 if test ".$S" != "." ; then
943 echo "s|\\(<[^<>]* href=\\\"\\)\\([$AA][^<>:]*\\\"[^<>]*>\\)|\\1$S\\2|g"
944 echo "s|\\(<[^<>]* src=\\\"\\)\\([$AA][^<>:]*\\\"[^<>]*>\\)|\\1$S\\2|g"
948 # ============================================================== SITE MAP DATA
949 # each entry needs atleast a list-title, a long-title, and a list-date
950 # these are the basic information to be printed in the sitemap file
951 # where it is bound the hierarchy of sect/subsect of the entries.
953 site_map_list_title() # $file $text
955 echo "<$Q'list'>$1 $2<$QX>" >> "$MK_DATA"
957 info_map_list_title() # $file $text
959 echo "<$Q'list'>$2<$QX>" >> "$tmp/$1.$DATA"
961 site_map_long_title() # $file $text
963 echo "<$Q'long'>$1 $2<$QX>" >> "$MK_DATA"
965 info_map_long_title() # $file $text
967 echo "<$Q'long'>$2<$QX>" >> "$tmp/$1.$DATA"
969 site_map_list_date() # $file $text
971 echo "<$Q'date'>$1 $2<$QX>" >> "$MK_DATA"
973 info_map_list_date() # $file $text
975 echo "<$Q'date'>$2<$QX>" >> "$tmp/$1.$DATA"
978 siteinfo2sitemap () # generate <name><page><date> addon sed scriptlet
979 { # the resulting script will act on each item/line
980 # containing <!--"filename"--> and expand any following
981 # reference of <!--name--> or <!--date--> or <!--long-->
982 INP="$1" ; test ".$INP" = "." && INP="$MK_DATA"
983 _list_="s|\\\\(<!--\"\\1\"-->.*\\\\)<name href=[^<>]*>.*</name>|\\\\1<name href=\"\\1\">\\2</name>|"
984 _date_="s|\\\\(<!--\"\\1\"-->.*\\\\)<date>.*</date>|\\\\1<date>\\2</date>|"
985 _long_="s|\\\\(<!--\"\\1\"-->.*\\\\)<long>.*</long>|\\\\1<long>\\2</long>|"
986 $SED -e "s:&:\\\\&:g" \
987 -e "s:<$Q'list'>\\([^ ]*\\) \\(.*\\)<$QX>:$_list_:" \
988 -e "s:<$Q'date'>\\([^ ]*\\) \\(.*\\)<$QX>:$_date_:" \
989 -e "s:<$Q'long'>\\([^ ]*\\) \\(.*\\)<$QX>:$_long_:" \
990 -e "/^s|/!d" $INP # $++
993 make_multisitemap ()
994 { # each category gets its own column along with the usual entries
995 INPUTS="$1" ; test ".$INPUTS" = "." && INPUTS="$MK_DATA"
996 siteinfo2sitemap > "$MK_SITE" # have <name><long><date> addon-sed
997 _form_="<!--\"\\2\"--><!--use\\1--><long>\\3</long><!--end\\1-->"
998 _form_="$_form_<br><name href=\"\\2\">\\3</name><date>......</date>"
999 _tiny_="small><small><small" ; _tinyX_="small></small></small "
1000 _tabb_="<br><$_tiny_> </$_tinyX_>" ; _bigg_="<big> </big>"
1001 echo "<table width=\"100%\"><tr><td> " # $++
1002 $SED -e "/^<$Q'[Uu]se.'>/!d" \
1003 -e "/>[$AZ$az][$AZ$az][$AZ$az][$AZ$az]*:/d" \
1004 -e "s|^<$Q'[Uu]se\\(.\\)'>\\([^ ]*\\) \\(.*\\)<$QX>|$_form_|" \
1005 -f "$MK_SITE" -e "/<name/!d" \
1006 -e "s|<!--use1-->|</td><td valign=\"top\"><b>|" \
1007 -e "s|<!--end1-->|</b>|" \
1008 -e "s|<!--use2-->|<br>|" \
1009 -e "s|<!--use.-->|<br>|" -e "s/<!--[^<>]*-->/ /g" \
1010 -e "s|<name |<$_tiny_><a |" -e "s|</name>||" \
1011 -e "s|<date>|<small style=\"date\">|" \
1012 -e "s|</date>|</small></a><br></$_tinyX_>|" \
1013 -e "s|<long>|<!--long-->|" -e "s|</long>|<!--/long-->|" \
1014 $INPUTS # $++
1015 echo "</td><tr></table>" # $++
1018 make_listsitemap ()
1019 { # traditional - the body contains a list with date and title extras
1020 INPUTS="$1" ; test ".$INPUTS" = "." && INPUTS="$MK_DATA"
1021 siteinfo2sitemap > "$MK_SITE" # have <name><long><date> addon-sed
1022 _form_="<!--\"\\2\"--><!--use\\1--><name href=\"\\2\">\\3</name>"
1023 _form_="$_form_<date>......</date><long>\\3</long>"
1024 _tabb_="<td>\\&nbsp\\;</td>"
1025 echo "<table cellspacing=\"0\" cellpadding=\"0\">" # $++
1026 $SED -e "/^<$Q'[Uu]se.'>/!d" \
1027 -e "/>[$AZ$az][$AZ$az][$AZ$az][$AZ$az]*:/d" \
1028 -e "s|^<$Q'[Uu]se\\(.\\)'>\\([^ ]*\\) \\(.*\\)<$QX>|$_form_|" \
1029 -f "$MK_SITE" -e "/<name/!d" \
1030 -e "s|<!--use\\(1\\)-->|<tr class=\"listsitemap\\1\"><td>*</td>|" \
1031 -e "s|<!--use\\(2\\)-->|<tr class=\"listsitemap\\1\"><td>-</td>|" \
1032 -e "s|<!--use\\(.\\)-->|<tr class=\"listsitemap\\1\"><td> </td>|" \
1033 -e "/<tr.class=\"listsitemap3\">/s|<name [^<>]*>|&- |" \
1034 -e "s|<!--[^<>]*-->| |g" \
1035 -e "s|<name href=\"name:sitemap:|<name href=\"|" \
1036 -e "s|<name |<td><a |" -e "s|</name>|</a></td>$_tabb_|" \
1037 -e "s|<date>|<td><small style=\"date\">|" \
1038 -e "s|</date>|</small></td>$_tabb_|" \
1039 -e "s|<long>|<td><em><!--long-->|" \
1040 -e "s|</long>|<!--/long--></em></td></tr>|" \
1041 "$INPUTS" # $++
1042 for xx in `grep "^<$Q'use.'>name:sitemap:" $INPUTS` ; do
1043 xx=`echo $xx | sed -e "s/^<$Q'use.'>name:sitemap://" -e "s|<$QX>||"`
1044 if test -f "$xx" ; then
1045 grep "<tr.class=\"listsitemap[$NN]\">" $xx # $++
1047 done
1048 echo "</table>" # $++
1051 _xi_include_=`echo \
1052 "<xi:include xmlns:xi=\"http://www.w3.org/2001/XInclude\" parse=\"xml\""`
1053 make_xmlsitemap ()
1054 { # traditional - the body contains a list with date and title extras
1055 INPUTS="$1" ; test ".$INPUTS" = "." && INPUTS="$MK_DATA"
1056 siteinfo2sitemap > "$MK_SITE" # have <name><long><date> addon-sed
1057 _form_="<!--\"\\2\"--><name href=\"\\2\">\\3</name>"
1058 _sitefile_=`sed_slash_key "$SITEFILE"`
1059 $SED -e "/^<$Q'[Uu]se.'>/!d" \
1060 -e "/>[$AZ$az][$AZ$az][$AZ$az][$AZ$az]*:/d" \
1061 -e "s|^<$Q'[Uu]se\\(.\\)'>\\([^ ]*\\) \\(.*\\)<$QX>|$_form_|" \
1062 -f "$MK_SITE" -e "/<name/!d" \
1063 -e "/${_sitefile_}/d" \
1064 -e "/${_sitefile_}l/d" \
1065 -e "s|\\(href=\"[^<>]*\\)\\.html\\(\"\\)|\\1.xml\\2|g" \
1066 -e "s|.*<name|$_xi_include_\\n |" \
1067 -e "s|>.*</name>| />|" \
1068 "$INPUTS" # $++
1071 print_extension ()
1073 ARG="$1" ; test ".$ARG" = "." && ARG="$opt_print"
1074 case "$ARG" in
1075 -*|.*) echo "$ARG" ;; # $++
1076 *) echo ".print" ;; # $++
1077 esac
1080 from_sourcefile ()
1082 if test -f "$1"
1083 then echo "$1"
1084 elif test -f "$opt_srcdir/$1"
1085 then echo "$opt_srcdir/$1"
1086 else echo "$1"
1090 html_sourcefile () # generally just cut away the trailing "l" (ell)
1091 { # making "page.html" argument into "page.htm" return
1092 # (as a new addtion the source may be in ".dbk" xml)
1093 _SRCFILE_=`echo "$1" | $SED -e "s/l\\$//"`
1094 _XMLFILE_=`echo "$1" | $SED -e "s/\\.html/.dbk/"`
1095 if test -f "$_SRCFILE_"
1096 then echo "$_SRCFILE_" # $++
1097 elif test -f "$_XMLFILE_"
1098 then echo "$_XMLFILE_" # $++
1099 elif test -f "$opt_src_dir/$_SRCFILE_"
1100 then echo "$opt_src_dir/$_SRCFILE_" # $++
1101 elif test -f "$opt_src_dir/$_XMLFILE_"
1102 then echo "$opt_src_dir/$_XMLFILE_" # $++
1103 else echo ".//$_SRCFILE_" # $++ (not found?)
1106 html_printerfile_sourcefile ()
1108 if test ".$printerfriendly" = "."
1109 then
1110 echo "$1" | sed -e "s/l\$//" # $++
1111 else
1112 _ext_=`print_extension "$printerfriendly"`
1113 _ext_=`sed_slash_key "$_ext_"`
1114 echo "$1" | sed -e "s/l\$//" -e "s/$_ext_\\([.][$AA]*\\)\$/\\1/" # $++
1118 fast_html_printerfile () {
1119 x=`html_printerfile "$1"` ; basename "$x" # $++
1120 # x=`html_printerfile "$1"` ; fast_href "$x" $2 # $++
1123 html_printerfile () # generate the printerfile for a given normal output
1125 _ext_=`print_extension "$printerfriendly" | sed -e "s/&/\\\\&/"`
1126 echo "$1" | sed -e "s/\\([.][$AA]*\\)\$/$_ext_\\1/" # $++
1129 make_printerfile_fast () # generate s/file.html/file.print.html/ for hrefs
1130 { # we do that only for the $FILELIST
1131 ALLPAGES="$1" ; # ="$FILELIST"
1132 for p in $ALLPAGES ; do
1133 a=`sed_slash_key "$p"`
1134 b=`html_printerfile "$p"`
1135 if test "$b" != "$p" ; then
1136 b=`html_printerfile "$p" | sed -e "s:&:\\\\&:g" -e "s:/:\\\\\\/:g"`
1137 echo "s/<a href=\"$a\">/<a href=\"$b\">/" # $++
1138 echo "s/<a href=\"$a\" /<a href=\"$b\" /" # $++
1140 done
1143 echo_printsitefile_style ()
1145 _bold_="text-decoration : none ; font-weight : bold ; "
1146 echo " <style>" # $+++
1147 echo " a:link { $_bold_ color : #000060 ; }" # $+++
1148 echo " a:visited { $_bold_ color : #000040 ; }" # $+++
1149 echo " body { background-color : white ; }" # $+++
1150 echo " </style>" # $+++
1153 make_printsitefile_head() # $sitefile
1155 echo_printsitefile_style > "$MK_STYLE"
1156 $SED -e "/<title>/p" -e "/<title>/d" \
1157 -e "/<head>/p" -e "/<head>/d" \
1158 -e "/<\/head>/p" -e "/<\/head>/d" \
1159 -e "/<body>/p" -e "/<body>/d" \
1160 -e "/^.*<link [^<>]*rel=\"shortcut icon\"[^<>]*>.*\$/p" \
1161 -e "d" $SITEFILE | $SED -e "/<head>/r $MK_STYLE" # $+++
1165 # ------------------------------------------------------------------------
1166 # The printsitefile is a long text containing html href markups where
1167 # each of the href lines in the file is being prefixed with the section
1168 # relation. During a secondary call the printsitefile can grepp'ed for
1169 # those lines that match a given output fast-file. The result is a
1170 # navigation header with 1...3 lines matching the nesting level
1172 # these alt-texts will be only visible in with a text-mode browser:
1173 printsitefile_square="width=\"8\" height=\"8\" border=\"0\""
1174 printsitefile_img_1="<img alt=\"|go text:\" $printsitefile_square />"
1175 printsitefile_img_2="<img alt=\"||topics:\" $printsitefile_square />"
1176 printsitefile_img_3="<img alt=\"|||pages:\" $printsitefile_square />"
1177 _SECT="mksite:sect:"
1179 echo_current_line () # $sect $extra
1181 echo "<!--$_SECT\"$1\"-->$2" # $++
1183 make_current_entry () # $sect $file ## requires $MK_SITE
1185 S="$1" ; R="$2"
1186 SSS=`sed_slash_key "$S"`
1187 sep=" - " ; _left_=" [ " ; _right_=" ] "
1188 echo_current_line "$S" "<!--\"$R\"--><name href=\"$R\">$R</name>$sep" \
1189 | $SED -f "$MK_SITE" \
1190 -e "s|<!--[^<>]*--><name |<a |" -e "s|</name>|</a>|" \
1191 -e "/<a href=\"$SSS\"/s/<a href/$_left_&/" \
1192 -e "/<a href=\"$SSS\"/s/<\\/a>/&$_right_/" # $+++
1194 echo_subpage_line () # $sect $extra
1196 echo "<!--$_SECT*:\"$1\"-->$2" # $++
1199 make_subpage_entry ()
1201 S="$1" ; R="$2"
1202 RR=`sed_slash_key "$R"`
1203 sep=" - " ;
1204 echo_subpage_line "$S" "<!--\"$R\"--><name href=\"$R\">$R</name>$sep" \
1205 | $SED -f "$MK_SITE" \
1206 -e "s|<!--[^<>]*--><name |<a |" -e "s|</name>|</a>|" # $+++
1209 make_printsitefile ()
1211 # building the printsitefile looks big but its really a loop over sects
1212 INPUTS="$1" ; test ".$INPUTS" = "." && INPUTS="$MK_DATA"
1213 siteinfo2sitemap > "$MK_SITE" # have <name><long><date> addon-sed
1214 if test -d DEBUG && test -f "$MK_SITE"
1215 then FFFF=`echo "$F" | sed -e "s,/,:,g"`
1216 cp "$MK_DATA" "DEBUG/$FFFF.SITE.tmp.sed"
1219 make_printsitefile_head $SITEFILE # $++
1220 sep=" - "
1221 _sect1="<a href=\"#.\" title=\"section\">$printsitefile_img_1</a> ||$sep"
1222 _sect2="<a href=\"#.\" title=\"topics\">$printsitefile_img_2</a> ||$sep"
1223 _sect3="<a href=\"#.\" title=\"pages\">$printsitefile_img_3</a> ||$sep"
1224 site_get_rootsections > "$MK_SECT1"
1225 # round one - for each root section print a current menu
1226 for r in `cat "$MK_SECT1"` ; do
1227 echo_current_line "$r" "<!--mksite:sect1:A--><br>$_sect1" # $++
1228 for s in `cat "$MK_SECT1"` ; do
1229 make_current_entry "$r" "$s" # $++
1230 done
1231 echo_current_line "$r" "<!--mksite:sect1:Z-->" # $++
1232 done # "$r"
1234 # round two - for each subsection print a current and subpage menu
1235 for r in `cat "$MK_SECT1"` ; do
1236 site_get_subpages "$r" > "$MK_SECT2"
1237 for s in `cat "$MK_SECT2"` ; do test "$r" = "$s" && continue
1238 echo_current_line "$s" "<!--mksite:sect2:A--><br>$_sect2" # $++
1239 for t in `cat "$MK_SECT2"` ; do test "$r" = "$t" && continue
1240 make_current_entry "$s" "$t" # $++
1241 done # "$t"
1242 echo_current_line "$s" "<!--mksite:sect2:Z-->" # $++
1243 done # "$s"
1244 _have_children_="0"
1245 for t in `cat "$MK_SECT2"` ; do test "$r" = "$t" && continue
1246 test "$_have_children_" = "0" && _have_children_="1" && \
1247 echo_subpage_line "$r" "<!--mksite:sect2:A--><br>$_sect2" # $++
1248 make_subpage_entry "$r" "$t" # $++
1249 done # "$t"
1250 test "$_have_children_" = "1" && \
1251 echo_subpage_line "$r" "<!--mksite:sect2:Z-->" # $++
1252 done # "$r"
1254 # round three - for each subsubsection print a current and subpage menu
1255 for r in `cat "$MK_SECT1"` ; do
1256 site_get_subpages "$r" > "$MK_SECT2"
1257 for s in `cat "$MK_SECT2"` ; do test "$r" = "$s" && continue
1258 site_get_subpages "$s" > "$MK_SECT3"
1259 for t in `cat "$MK_SECT3"` ; do test "$s" = "$t" && continue
1260 echo_current_line "$t" "<!--mksite:sect3:A--><br>$_sect3" # $++
1261 for u in `cat "$MK_SECT3"` ; do test "$s" = "$u" && continue
1262 make_current_entry "$t" "$u" # $++
1263 done # "$u"
1264 echo_current_line "$t" "<!--mksite:sect3:Z-->" # $++
1265 done # "$t"
1266 _have_children_="0"
1267 for u in `cat "$MK_SECT3"` ; do test "$u" = "$s" && continue
1268 test "$_have_children_" = "0" && _have_children_="1" && \
1269 echo_subpage_line "$s" "<!--mksite:sect3:A--><br>$_sect3" # $++
1270 make_subpage_entry "$s" "$u" # $++
1271 done # "$u"
1272 test "$_have_children_" = "1" && \
1273 echo_subpage_line "$s" "<!--mksite:sect3:Z-->" # $++
1274 done # "$s"
1275 done # "$r"
1276 echo "<a name=\".\"></a>" # $++
1277 echo "</body></html>" # $++
1280 # create a selector that can grep a printsitefile for the matching entries
1281 select_in_printsitefile () # arg = "page" : return to stdout >> $P.$HEAD
1283 _selected_="$1" ; test ".$_selected_" = "." && _selected_="$F"
1284 _section_=`sed_slash_key "$_selected_"`
1285 echo "s/^<!--$_SECT\"$_section_\"-->//" # sect3
1286 echo "s/^<!--$_SECT[*]:\"$_section_\"-->//" # children
1287 _selected_=`site_get_parentpage "$_selected_"`
1288 _section_=`sed_slash_key "$_selected_"`
1289 echo "s/^<!--$_SECT\"$_section_\"-->//" # sect2
1290 _selected_=`site_get_parentpage "$_selected_"`
1291 _section_=`sed_slash_key "$_selected_"`
1292 echo "s/^<!--$_SECT\"$_section_\"-->//" # sect1
1293 echo "/^<!--$_SECT\"[^\"]*\"-->/d"
1294 echo "/^<!--$_SECT[*]:\"[^\"]*\"-->/d"
1295 echo "s/^<!--mksite:sect[$NN]:[$AZ]-->//"
1298 body_for_emailfooter ()
1300 test ".$emailfooter" = ".no" && return
1301 _email_=`echo "$emailfooter" | sed -e "s|[?].*||"`
1302 _dated_=`info_get_entry updated`
1303 echo "<hr><table border=\"0\" width=\"100%\"><tr><td>"
1304 echo "<a href=\"mailto:$emailfooter\">$_email_</a>"
1305 echo "</td><td align=\"right\">"
1306 echo "$_dated_</td></tr></table>"
1309 # =================================================================== CSS
1310 # There was another project to support sitemap build from xml files.
1311 # The source format was using .dbk+xml with embedded references to .css
1312 # files for visual preview in a browser. An docbook xml file with semantic
1313 # outlines is far better suited for quality documentation than any html
1314 # source. It happens that the xml/css support in browsers is still not
1315 # very portable - especially embedded css style blocks are a nightmare.
1316 # Instead we (a) grab all non-html xml markup tags (b) grab all referenced
1317 # css stylesheets (c) cut out css defs from [b] that are known by [a] and
1318 # (d) append those to the <style> tag in the output html file as well as
1319 # (e) reformatting the defs as well as markups from tags to tag classes.
1320 # Input dbk/htm
1321 # <?xml-stylesheet type="text/css" href="html.css" ?> <!-- dbk/xml -->
1322 # <link rel="stylesheet" type="text/css" href="sdocbook.css" /> <!-- xhtml -->
1323 # <article><para>
1324 # Using some <command>exe</command>
1325 # </para></article>
1326 # Input css:
1327 # article { .. ; display : block }
1328 # para { .. ; display : block }
1329 # command { .. ; display : inline }
1330 # Output html:
1331 # <html><style type="text/css">
1332 # div .article { .. }
1333 # div .para { .. }
1334 # span .command { .. }
1335 # </style>
1336 # <div class="article"><div class="para>
1337 # Using some <span class="command">exe</span>
1338 # </div></div>
1340 css_sourcefile ()
1342 if test -f "$1" ; then echo "$1"
1343 elif test -f "$opt_src_dir/$1" ; then echo "$opt_src_dir/$1"
1344 elif echo "$1" | grep "^/" > $NULL ; then echo "$1"
1345 else echo "./$1"
1349 css_xmltags () # $SOURCEFILE
1351 X=`echo $SOURCEFILE | sed -e "y:/:~:"`
1352 S="$SOURCEFILE"
1353 cat "$S" | $SED -e "s|>[^<>]*<|><|g" -e "s|^[^<>]*<|<|" \
1354 -e "s|>[^<>]*\$|>|" -e "s|<|\\n|g" \
1355 | $SED -e "/^\\//d" -e "/^ *\$/d" -e "/>/!d" -e "s|>.*||" \
1356 | sort | uniq > "$tmp/$MK.$X.xmltags.tmp.txt"
1359 css_xmlstyles () # $SOURCEFILE
1361 X=`echo $SOURCEFILE | sed -e "y:/:~:"`
1362 S="$SOURCEFILE"
1363 cat "$S" "$SITEFILE" \
1364 | sed \
1365 -e "s|<link *rel=['\"]*stylesheet|<?xml-stylesheet |" \
1366 -e "/<.xml-stylesheet/!d" -e "/href/!N" -e "/href/!N" \
1367 -e "s|^.*<.xml-stylesheet||" -e 's|^.*href="||' -e 's|".*||' \
1368 | sort | uniq > "$tmp/$MK.$X.xmlstylesheets.tmp.txt"
1371 css_xmlstyles_sed () # $SOURCEFILE
1373 X=`echo $SOURCEFILE | sed -e "y:/:~:"`
1374 S="$tmp/$MK.$X.xmltags.tmp.txt"
1375 R="$tmp/$MK.$X.xmltags.tmp.sed"
1376 rm -f "$R"
1378 for x in 1 2 3 4 5 6 7 8 9 ; do echo "/}/d" ; echo "/{/!N" ; done
1379 echo "s|\\r||g"
1380 $SED "/^[$AZ$az$NN]/!d" "$S" | { while read xmltag ; do
1381 xmltag=`echo "$xmltag" | sed -e "s/ .*//"`
1382 _xmltag=`sed_slash_key "$xmltag"`
1383 if echo " title section " | grep " $xmltag " > $NULL ; then
1384 test "$xmltag" = "section" && continue;
1385 echo "/^ *$_xmltag *[,\\n{]/bfound" >> "$R"
1386 echo "/[,\\n] *$_xmltag *[,\\n{]/bfound" >> "$R"
1387 $SED "/^[$AZ$az$NN]/!d" "$S" | { while read xmlparent ; do
1388 xmlparent=`echo "$xmlparent" | sed -e "s/ .*//"`
1389 _xmlparent=`sed_slash_key "$xmlparent"`
1390 echo "/^ *$_xmlparent *$_xmltag *[,\\n{]/bfound"
1391 echo "/[ ,\\n] *$_xmlparent *$_xmltag *[,\\n{]/bfound"
1392 done }
1393 else
1394 echo "/^ *$_xmltag *[ ,\\n{]/bfound"
1395 echo "/[ ,\\n] *$_xmltag *[ ,\\n{]/bfound"
1397 done }
1398 echo "d" ; echo ":found"
1399 for x in 1 2 3 4 5 6 7 8 9 ; do echo "/}/!N" ; done
1400 $SED "/^[$AZ$az$NN]/!d" "$S" | { while read xmltag ; do
1401 xmltag=`echo "$xmltag" | sed -e "s/ .*//"`
1402 if echo " $HTMLTAGS $HTMLTAGS2" | grep " $xmltag " > $NULL ; then
1403 continue # keep html tags
1405 echo "s|^\\( *\\)\\($xmltag *[ ,\\n{]\\)|\\1.\\2|g"
1406 echo "s|\\([ ,\\n] *\\)\\($xmltag *[ ,\\n{]\\)|\\1.\\2|g"
1407 done }
1408 } > "$R"
1411 css_xmltags_css () # $SOURCEFILE
1413 X=`echo $SOURCEFILE | sed -e "y:/:~:"`
1414 S="$tmp/$MK.$X.xmltags.tmp.sed"
1415 R="$tmp/$MK.$X.xmltags.tmp.css"
1417 cat "$tmp/$MK.$X.xmlstylesheets.tmp.txt" | { while read xmlstylesheet ; do
1418 stylesheet=`css_sourcefile "$xmlstylesheet"`
1419 if test -f "$stylesheet" ; then
1420 echo "/* $xmlstylesheet */"
1421 cat "$stylesheet" | $SED -f "$S"
1422 else
1423 error "$xmlstylesheet : ERROR, no such stylesheet"
1425 done }
1426 } > "$R"
1429 css_xmlmapping_sed () # $SOURCEFILE
1431 X=`echo $SOURCEFILE | sed -e "y:/:~:"`
1432 S="$tmp/$MK.$X.xmltags.tmp.txt"
1433 R="$tmp/$MK.$X.xmlmapping.tmp.sed"
1434 rm -f "$R"
1436 for x in 1 2 3 4 5 6 7 8 9 ; do echo "/}/d" ; echo "/{/!N" ; done
1437 echo "s|\\r||g"
1438 $SED "/^[$AZ$az$NN]/!d" "$S" | { while read xmltag ; do
1439 xmltag=`echo "$xmltag" | sed -e "s/ .*//"`
1440 xmltag=`sed_slash_key "$xmltag"`
1441 echo "/^ *\\.$xmltag *[ ,\\n{]/bfound"
1442 echo "/[ ,\\n] *\\.$xmltag *[,\\n{]/bfound"
1443 done }
1444 echo "d" ; echo ":found"
1445 for x in 1 2 3 4 5 6 7 8 9 ; do echo "/}/!N" ; done
1446 echo "s/^/>>/"
1447 echo "/[\\n ]display *: *list-item/s|^.*>>|li>>|"
1448 echo "/[\\n ]display *: *table-caption/s|^.*>>|caption>>|"
1449 echo "/[\\n ]display *: *table-cell/s|^.*>>|td>>|"
1450 echo "/[\\n ]display *: *table-row/s|^.*>>|tr>>|"
1451 echo "/[\\n ]display *: *table/s|^.*>>|table>>|"
1452 echo "/[\\n ]display *: *block/s|^.*>>|div>>|"
1453 echo "/[\\n ]display *: *inline/s|^.*>>|span>>|"
1454 echo "/[\\n ]display *: *none/s|^.*>>|small>>|"
1455 echo "/^div>>.*[\\n ]list-style-type *: *disc/s|^.*>>|ul>>|"
1456 echo "/^div>>.*[\\n ]list-style-type *: *decimal/s|^.*>>|ol>>|"
1457 echo "/^span>>.*[\\n ]font-family *: *monospace/s|^.*>>|tt>>|"
1458 echo "/^span>>.*[\\n ]font-style *: *italic/s|^.*>>|em>>|"
1459 echo "/^span>>.*[\\n ]font-weight *: *bold/s|^.*>>|b>>|"
1460 echo "/^div>>.*[\\n ]white-space *: *pre/s|^.*>>|pre>>|"
1461 echo "/^div>>.*[\\n ]margin-left *: *[$NN]/s|^.*>>|blockquote>>|"
1462 $SED "/^[$AZ$az$NN]/!d" "$S" | { while read xmltag ; do
1463 xmltag=`echo "$xmltag" | sed -e "s/ .*//"`
1464 echo "s|^\\(.*\\)>> *\\.$xmltag *[ ,\\n{].*|\\1 .$xmltag|"
1465 echo "s|^\\(.*\\)>>.*[ ,\\n] *\\.$xmltag *[ ,\\n{].*|\\1 .$xmltag|"
1466 done }
1467 echo "s/^div \\.para\$/p .para/"
1468 echo "s/^span \\.ulink\$/a .ulink/"
1469 } > "$R"
1472 css_xmlmapping () # $SOURCEFILE
1474 X=`echo $SOURCEFILE | sed -e "y:/:~:"`
1475 cat "$tmp/$MK.$X.xmltags.tmp.css" | \
1476 $SED -f "$tmp/$MK.$X.xmlmapping.tmp.sed" \
1477 > "$tmp/$MK.$X.xmlmapping.tmp.txt"
1480 css_scan() # $SOURCEFILE
1482 css_xmltags
1483 css_xmlstyles
1484 css_xmlstyles_sed
1485 css_xmltags_css
1486 css_xmlmapping_sed
1487 css_xmlmapping
1490 tags2span_sed() # $SOURCEFILE > $++
1492 X=`echo $SOURCEFILE | sed -e "y:/:~:"`
1493 S="$tmp/$MK.$X.xmltags.tmp.txt"
1494 R="$tmp/$MK.$X.xmltags.tmp.css"
1495 echo "s|<[?]xml-stylesheet[^<>]*[?]>||"
1496 echo "s|<link *rel=['\"]*stylesheet[^<>]*>||"
1497 echo "s|<section[^<>]*>||g"
1498 echo "s|</section>||g"
1499 $SED "/^[$AZ$az$NN]/!d" "$S" | { while read xmltag ; do
1500 # note "xmltag=$xmltag"
1501 xmltag=`echo "$xmltag" | sed -e "s/ .*//"`
1502 if echo " $HTMLTAGS $HTMLTAGS2" | grep " $xmltag " > $NULL ; then
1503 continue # keep html tags
1505 _xmltag=`sed_slash_key "$xmltag"`
1506 _span_=`$SED -e "/ \\.$_xmltag\$/!d" -e "s/ .*//" -e q \
1507 < "$tmp/$MK.$X.xmlmapping.tmp.txt"`
1508 test ".$_span_" = "." && _span_="span"
1509 _xmltag=`sed_piped_key "$xmltag"`
1510 echo "s|<$xmltag\\([\\n\\t ][^<>]*\\)url=|<$_span_ class=\"$xmltag\"\\1href=|g"
1511 echo "s|<$xmltag\\([\\n\\t >]\\)|<$_span_ class=\"$xmltag\"\\1|g"
1512 echo "s|</$xmltag\\([\\n\\t >]\\)|</$_span_\\1|g"
1513 done }
1514 cat "$tmp/$MK.$X.xmlstylesheets.tmp.txt" | { while read xmlstylesheet ; do
1515 if test -f "$xmlstylesheet" ; then
1516 R="[^<>]*href=['"'"'"]$xmlstylesheet['"'"'"][^<>]*"
1517 echo "s|<[?]xml-stylesheet$R>||"
1518 echo "s|<link[^<>]* rel=['"'"'"]*stylesheet['"'"'" ]$R>||"
1520 done }
1523 tags2meta_sed() # $SOURCEFILE > $++
1525 X=`echo $SOURCEFILE | sed -e "y:/:~:"`
1526 S="$tmp/$MK.$X.xmlstylesheets.tmp.txt"
1527 R="$tmp/$MK.$X.xmltags.tmp.css"
1528 cat "$tmp/$MK.$X.xmlstylesheets.tmp.txt" | { while read xmlstylesheet ; do
1529 if test -f "$xmlstylesheet" ; then
1530 echo " <style type=\"text/css\"><!--"
1531 $SED -e "s/^/ /" < "$R"
1532 echo " --></style>"
1533 break
1535 done }
1538 # ==========================================================================
1539 # xml/docbook support is taking an dbk input file converting any html DBK
1540 # syntax into pure docbook tagging. Each file is being given a docbook
1541 # doctype so that an xml/docbook viewer can render it correctly - that
1542 # is needed atleast since docbook files do not embed stylesheet infos.
1543 # Most of the processing is related to remap html markup and some other
1544 # shortcut markup into correct docbook markup. The result is NOT checked
1545 # for being well-formed or even matching the docbook schema DTD at all.
1547 scan_xml_rootnode ()
1549 rootnode=`cat "$SOURCEFILE" | \
1550 $SED -e "/<[$AZ$az$NN]/!d" -e "s/<\\([$AZ$az$NN]*\\).*/\\1/" -e q`
1551 echo "<$Q'root'>$F $rootnode<$QX>" >> "$MK_DATA"
1554 get_xml_rootnode ()
1556 _file_=`sed_slash_key "$F"`
1557 $SED -e "/^<$Q'root'>$_file_ /!d" \
1558 -e "s|.* ||" -e "s|<.*||" -e q "$MK_DATA" # +
1561 xml_sourcefile ()
1563 _XMLFILE_=`echo "$1" | $SED -e "s/\\.xml\\$/.dbk/"`
1564 _SRCFILE_=`echo "$1" | $SED -e "s/\\.xml\\$/.htm/"`
1565 test "$1" = "$_XMLFILE_" && _XMLFILE_="///"
1566 test "$1" = "$_SRCFILE_" && _SRCFILE_="///"
1567 if test -f "$_XMLFILE_"
1568 then echo "$_XMLFILE_" # $++
1569 elif test -f "$_SRCFILE_"
1570 then echo "$_SRCFILE_" # $++
1571 elif test -f "$opt_src_dir/$_XMLFILE_"
1572 then echo "$opt_src_dir/$_XMLFILE_" # $++
1573 elif test -f "$opt_src_dir/$_SRCFILE_"
1574 then echo "$opt_src_dir/$_SRCFILE_" # $++
1575 else echo ".//$_XMLFILE_" # $++ (not found?)
1579 scan_xmlfile()
1581 SOURCEFILE=`xml_sourcefile "$F"`
1582 $hint "'$SOURCEFILE': scanning xml -> '$F'"
1583 scan_xml_rootnode
1584 rootnode=`get_xml_rootnode | sed -e "/^h[$NN]/s|\$| <?section?>|"`
1585 $hint "'$SOURCEFILE': rootnode ('$rootnode')"
1588 make_xmlfile()
1590 SOURCEFILE=`xml_sourcefile "$F"`
1591 X=`echo $SOURCEFILE | sed -e "y:/:~:"`
1592 article=`get_xml_rootnode`
1593 test ".$article" = "." && article="article"
1594 echo '<!DOCTYPE '$article' PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"' \
1595 > "$F"
1596 echo ' "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">' \
1597 >> "$F"
1598 cat "$tmp/$MK.$X.xmlstylesheets.tmp.txt" | { while read stylesheet ; do
1599 echo "<?xml-stylesheet type=\"text/css\" href=\"$stylesheet\" ?>" \
1600 >> "$F"
1601 done }
1602 __secinfo="\\1<sectioninfo>\\2</sectioninfo>"
1603 cat "$SOURCEFILE" | $SED \
1604 -e "s!<>!\&nbsp\;!g" \
1605 -e "s!\\(&\\)\\(&\\)!\\1amp;\\2amp;!g" \
1606 -e "s!\\(<[^<>]*\\)\\(width\\)\\(=\\)\\([$NN]*\%*\\)!\\1\\2\\3\"\\4\"!g" \
1607 -e "s!\\(<[^<>]*\\)\\(cellpadding\\)\\(=\\)\\([$NN]*\%*\\)!\\1\\2\\3\"\\4\"!g" \
1608 -e "s!\\(<[^<>]*\\)\\(border\\)\\(=\\)\\([$NN]*\%*\\)!\\1\\2\\3\"\\4\"!g" \
1609 -e "s!<[?]xml-stylesheet[^<>]*>!!" \
1610 -e "s!<link[^<>]* rel=[\'\"]*stylesheet[^<>]*>!!" \
1611 -e "s!<[hH][$NN]!<title!g" \
1612 -e "s!</[hH][$NN]!</title!g" \
1613 -e "s!\\(</title> *\\)\\([^<>]*[$AZ$az$NN][^<>\r\n]*\\)\$!\\1<sub>\\2</sub>!" \
1614 -e "s!\\(</title>.*\\)<sub>!\\1<subtitle>!g" \
1615 -e "s!\\(</title>.*\\)</sub>!\\1</subtitle>!g" \
1616 -e "s!\\(<section>[^<>]*\\)\\(<date>.*</date>[^<>]*\\)\$!\\1<sectioninfo>\\2</sectioninfo>!g" \
1617 -e "s!<em>!<emphasis>!g" \
1618 -e "s!</em>!</emphasis>!g" \
1619 -e "s!<i>!<emphasis>!g" \
1620 -e "s!</i>!</emphasis>!g" \
1621 -e "s!<b>!<emphasis role=\"bold\">!g" \
1622 -e "s!</b>!</emphasis>!g" \
1623 -e "s!<u>!<emphasis role=\"underline\">!g" \
1624 -e "s!</u>!</emphasis>!g" \
1625 -e "s!<big>!<emphasis role=\"strong\">!g" \
1626 -e "s!</big>!</emphasis>!g" \
1627 -e "s!<\\(strike\\)>!<emphasis role=\"strikethrough\">!g" \
1628 -e "s!<\\(s\\)>!<emphasis role=\"strikethrough\">!g" \
1629 -e "s!</\\(strike\\)>!</emphasis>!g" \
1630 -e "s!</\\(s\\)>!</emphasis>!g" \
1631 -e "s!<center>!<blockquote><para>!g" \
1632 -e "s!</center>!</para></blockquote>!g" \
1633 -e "s!<p align=\\(\"[$AZ$az$NN]*\"\\)>!<para role=\\1>!g" \
1634 -e "s!<[pP]>!<para>!g" \
1635 -e "s!</[pP]>!</para>!g" \
1636 -e "s!<\\(pre\\)>!<screen>!g" \
1637 -e "s!<\\(PRE\\)>!<screen>!g" \
1638 -e "s!</\\(pre\\)>!</screen>!g" \
1639 -e "s!</\\(PRE\\)>!</screen>!g" \
1640 -e "s!<a\\( [^<>]*\\)name=\\([^<>]*\\)/>!<anchor \\1id=\\2/>!g" \
1641 -e "s!<a\\( [^<>]*\\)name=\\([^<>]*\\)>!<anchor \\1id=\\2/>!g" \
1642 -e "s!<a\\( [^<>]*\\)href=!<ulink\\1url=!g" \
1643 -e "s!</a>!</ulink>!g" \
1644 -e "s! remap=\"url\">[^<>]*</ulink>! />!g" \
1645 -e "s!<\\(/*\\)span\\([ ][^<>]*\\)>!<\\1phrase\\2>!g" \
1646 -e "s!<\\(/*\\)span>!<\\1phrase>!g" \
1647 -e "s!<small\\([ ][^<>]*\\)>!<phrase role=\"small\"\\1>!g" \
1648 -e "s!<small>!<phrase role=\"small\">!g" \
1649 -e "s!</small>!</phrase>!g" \
1650 -e "s!<\\(/*\\)\\(sup\\)>!<\\1superscript>!g" \
1651 -e "s!<\\(/*\\)\\(sub\\)>!<\\1subscript>!g" \
1652 -e "s!\\(<\\)\\(li\\)\\(><\\)!\\1listitem\\3!g" \
1653 -e "s!\\(></\\)\\(li\\)\\(>\\)!\\1listitem\\3!g" \
1654 -e "s!\\(<\\)\\(li\\)\\(>\\)!\\1listitem\\3<para>!g" \
1655 -e "s!\\(</\\)\\(li\\)\\(>\\)!</para>\\1listitem\\3!g" \
1656 -e "s!\\(</*\\)\\(ul\\)>!\\1itemizedlist>!g" \
1657 -e "s!\\(</*\\)\\(ol\\)>!\\1orderedlist>!g" \
1658 -e "s!\\(</*\\)\\(dl\\)>!\\1variablelist>!g" \
1659 -e "s!<\\(/*\\)DT>!<\\1dt>!g" \
1660 -e "s!<\\(/*\\)DD>!<\\1dd>!g" \
1661 -e "s!<\\(/*\\)DL>!<\\1dl>!g" \
1662 -e "s!<BLOCKQUOTE>!<blockquote><para>!g" \
1663 -e "s!</BLOCKQUOTE>!</para></blockquote>!g" \
1664 -e "s!<\\(/*\\)dl>!<\\1variablelist>!g" \
1665 -e "s!<dt\\( [^<>]*\\)>!<varlistentry\\1><term>!g" \
1666 -e "s!<dt>!<varlistentry><term>!g" \
1667 -e "s!</dt>!</term>!g" \
1668 -e "s!<dd\\( [^<>]*\\)><!<listitem\\1><!g" \
1669 -e "s!<dd><!<listitem><!g" \
1670 -e "s!></dd>!></listitem></varlistentry>!g" \
1671 -e "s!<dd\\( [^<>]*\\)>!<listitem\\1><para>!g" \
1672 -e "s!<dd>!<listitem><para>!g" \
1673 -e "s!</dd>!</para></listitem></varlistentry>!g" \
1674 -e "s!<table[^<>]*><tr><td>\\(<table[^<>]*>\\)!\\1!" \
1675 -e "s!\\(</table>\\)</td></tr></table>!\\1!" \
1676 -e "s!<table\\( [^<>]*\\)>!<informaltable\\1><tgroup cols=\"2\"><tbody>!g" \
1677 -e "s!<table>!<informaltable><tgroup cols=\"2\"><tbody>!g" \
1678 -e "s!</table>!</tbody></tgroup></informaltable>!g" \
1679 -e "s!\\(</*\\)tr\\([ ][^<>]*\\)>!\\1row\\2>!g" \
1680 -e "s!\\(</*\\)tr>!\\1row>!g" \
1681 -e "s!\\(</*\\)td\\([ ][^<>]*\\)>!\\1entry\\2>!g" \
1682 -e "s!\\(</*\\)td>!\\1entry>!g" \
1683 -e "s!\\(<informaltable[^<>]*[ ]width=\"100\%\"\\)!\\1 pgwide=\"1\"!g" \
1684 -e "s!\\(<tgroup[<>]*[ ]cols=\"2\">\\)\\(<tbody>\\)!\\1<colspec colwidth=\"1*\" /><colspec colwidth=\"1*\" />\\2!g" \
1685 -e "s!\\(<entry[^<>]*[ ]\\)width=\\(\"[$NN]*\%*\"\\)!\\1remap=\\2!g" \
1686 -e "s!<nobr>\\([\'\`]*\\)<tt>!<cmdsynopsis><command>\\1!g" \
1687 -e "s!</tt>\\([\'\`]*\\)</nobr>!\\1</command></cmdsynopsis>!g" \
1688 -e "s!<nobr><\\(code\\)>\\([\`\"\']\\)!<cmdsynopsis><command>\\2!g" \
1689 -e "s!<\\(code\\)><nobr>\\([\`\"\']\\)!<cmdsynopsis><command>\\2!g" \
1690 -e "s!\\([\`\"\']\\)</\\(code\\)></nobr>!\\1</command></cmdsynopsis>!g" \
1691 -e "s!\\([\`\"\']\\)</nobr></\\(code\\)>!\\1</command></cmdsynopsis>!g" \
1692 -e "s!<nobr><\\(tt\\)>\\([\`\"\']\\)!<cmdsynopsis><command>\\2!g" \
1693 -e "s!<\\(tt\\)><nobr>\\([\`\"\']\\)!<cmdsynopsis><command>\\2!g" \
1694 -e "s!\\([\`\"\']\\)</\\(tt\\)></nobr>!\\1</command></cmdsynopsis>!g" \
1695 -e "s!\\([\`\"\']\\)</nobr></\\(tt\\)>!\\1</command></cmdsynopsis>!g" \
1696 -e "s!\\(</*\\)tt>!\\1constant>!g" \
1697 -e "s!\\(</*\\)code>!\\1literal>!g" \
1698 -e "s!<br>!<br />!g" \
1699 -e "s!<br */>!<screen role=\"linebreak\">\n</screen>!g" \
1700 >> "$F"
1701 echo "'$SOURCEFILE': " `ls -s $SOURCEFILE` ">>" `ls -s $F`
1704 make_xmlmaster ()
1706 SOURCEFILE=`xml_sourcefile "$F"`
1707 X=`echo $SOURCEFILE | sed -e "y:/:~:"`
1708 article="section" # book? chapter?
1709 echo '<!DOCTYPE' $article 'PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"' >$F
1710 echo ' "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">' >>$F
1711 cat "$tmp/$MK.$X.xmlstylesheets.tmp.txt" | { while read stylesheet ; do
1712 echo "<?xml-stylesheet type=\"text/css\" href=\"$stylesheet\" ?>" \
1713 >> "$F"
1714 done }
1715 echo "<section><title>Documentation</title>" >>$F
1716 make_xmlsitemap >> $F
1717 echo "</section>" >> $F
1718 echo "'$SOURCEFILE': " `ls -s $SOURCEFILE` ">*>" `ls -s $F`
1721 # ==========================================================================
1723 # During processing we will create a series of intermediate files that
1724 # store relations. They all have the same format being
1725 # =relationtype=key value
1726 # where key is usually s filename or an anchor. For mere convenience
1727 # we assume that the source html text does not have lines that start
1728 # off with =xxxx= (btw, ye remember perl section notation...). Of course
1729 # any other format would be usuable as well.
1732 # we scan the SITEFILE for href references to be converted
1733 # - in the new variant we use a ".gets.tmp" sed script that SECTS
1734 # marks all interesting lines so they can be checked later
1735 # with an sed anchor of sect="[$NN]" (or sect="[$AZ]")
1736 S="\\&nbsp\\;"
1737 # S="[&]nbsp[;]"
1739 # HR and EM style markups must exist in input - BR sometimes left out
1740 # these routines in(ter)ject hardspace before, between, after markups
1741 # note that "<br>" is sometimes used with HR - it must exist in input
1742 echo_HR_EM_PP ()
1744 echo "s%^\\($1$2$3*<a\\) \\(href=\\)%\\1 $4 \\2%"
1745 echo "s%^\\(<>$1$2$3*<a\\) \\(href=\\)%\\1 $4 \\2%"
1746 echo "s%^\\($S$1$2$3*<a\\) \\(href=\\)%\\1 $4 \\2%"
1747 echo "s%^\\($1<>$2$3*<a\\) \\(href=\\)%\\1 $4 \\2%"
1748 echo "s%^\\($1$S$2$3*<a\\) \\(href=\\)%\\1 $4 \\2%"
1749 echo "s%^\\($1$2<>$3*<a\\) \\(href=\\)%\\1 $4 \\2%"
1750 echo "s%^\\($1$2$S$3*<a\\) \\(href=\\)%\\1 $4 \\2%"
1753 echo_br_EM_PP ()
1755 echo_HR_EM_PP "$1" "$2" "$3" "$4"
1756 echo "s%^\\($2$3*<a\\) \\(href=\\)%\\1 $4 \\2%"
1757 echo "s%^\\(<>$2$3*<a\\) \\(href=\\)%\\1 $4 \\2%"
1758 echo "s%^\\($S$2$3*<a\\) \\(href=\\)%\\1 $4 \\2%"
1759 echo "s%^\\($2<>$3*<a\\) \\(href=\\)%\\1 $4 \\2%"
1760 echo "s%^\\($2$S$3*<a\\) \\(href=\\)%\\1 $4 \\2%"
1761 echo "s%^\\($2$3*<><a\\) \\(href=\\)%\\1 $4 \\2%"
1762 echo "s%^\\($2$3*$S<a\\) \\(href=\\)%\\1 $4 \\2%"
1765 echo_HR_PP ()
1767 echo "s%^\\($1<a\\) \\(href=\\)%\\1 $3 \\2%"
1768 echo "s%^\\($1$2*<a\\) \\(href=\\)%\\1 $3 \\2%"
1769 echo "s%^\\(<>$1$2*<a\\) \\(href=\\)%\\1 $3 \\2%"
1770 echo "s%^\\($S$1$2*<a\\) \\(href=\\)%\\1 $3 \\2%"
1771 echo "s%^\\($1<>$2*<a\\) \\(href=\\)%\\1 $3 \\2%"
1772 echo "s%^\\($1$S$2*<a\\) \\(href=\\)%\\1 $3 \\2%"
1774 echo_br_PP ()
1776 echo_HR_PP "$1" "$2" "$3"
1777 echo "s%^\\($2*<a\\) \\(href=\\)%\\1 $3 \\2%"
1778 echo "s%^\\(<>$2*<a\\) \\(href=\\)%\\1 $3 \\2%"
1779 echo "s%^\\($S$2*<a\\) \\(href=\\)%\\1 $3 \\2%"
1781 echo_sp_PP ()
1783 echo "s%^\\(<>$1*<a\\) \\(href=\\)%\\1 $2 \\2%"
1784 echo "s%^\\($S$1*<a\\) \\(href=\\)%\\1 $2 \\2%"
1785 echo "s%^\\(<><>$1*<a\\) \\(href=\\)%\\1 $2 \\2%"
1786 echo "s%^\\($S$S$1*<a\\) \\(href=\\)%\\1 $2 \\2%"
1787 echo "s%^\\(<>$1<>*<a\\) \\(href=\\)%\\1 $2 \\2%"
1788 echo "s%^\\($S$1$S*<a\\) \\(href=\\)%\\1 $2 \\2%"
1789 echo "s%^\\($1<><>*<a\\) \\(href=\\)%\\1 $2 \\2%"
1790 echo "s%^\\($1$S$S*<a\\) \\(href=\\)%\\1 $2 \\2%"
1791 echo "s%^\\($1<>*<a\\) \\(href=\\)%\\1 $2 \\2%"
1792 echo "s%^\\($1$S*<a\\) \\(href=\\)%\\1 $2 \\2%"
1795 echo_sp_SP ()
1797 echo "s%^\\($1<a\\) \\(href=\\)%\\1 $2 \\2%"
1798 echo "s%^\\(<>$1<a\\) \\(href=\\)%\\1 $2 \\2%"
1799 echo "s%^\\($S$1<a\\) \\(href=\\)%\\1 $2 \\2%"
1800 echo "s%^\\(<><>$1<a\\) \\(href=\\)%\\1 $2 \\2%"
1801 echo "s%^\\($S$S$1<a\\) \\(href=\\)%\\1 $2 \\2%"
1802 echo "s%^\\(<>$1<><a\\) \\(href=\\)%\\1 $2 \\2%"
1803 echo "s%^\\($S$1$S<a\\) \\(href=\\)%\\1 $2 \\2%"
1804 echo "s%^\\($1<><><a\\) \\(href=\\)%\\1 $2 \\2%"
1805 echo "s%^\\($1$S$S<a\\) \\(href=\\)%\\1 $2 \\2%"
1806 echo "s%^\\($1<><a\\) \\(href=\\)%\\1 $2 \\2%"
1807 echo "s%^\\($1$S<a\\) \\(href=\\)%\\1 $2 \\2%"
1810 echo_sp_sp ()
1812 echo "s%^\\($1<a\\) \\(name=\\)%\\1 $2 \\2%"
1813 echo "s%^\\(<>$1<a\\) \\(name=\\)%\\1 $2 \\2%"
1814 echo "s%^\\($S$1<a\\) \\(name=\\)%\\1 $2 \\2%"
1815 echo "s%^\\(<><>$1<a\\) \\(name=\\)%\\1 $2 \\2%"
1816 echo "s%^\\($S$S$1<a\\) \\(name=\\)%\\1 $2 \\2%"
1817 echo "s%^\\(<>$1<><a\\) \\(name=\\)%\\1 $2 \\2%"
1818 echo "s%^\\($S$1$S<a\\) \\(name=\\)%\\1 $2 \\2%"
1819 echo "s%^\\($1<><><a\\) \\(name=\\)%\\1 $2 \\2%"
1820 echo "s%^\\($1$S$S<a\\) \\(name=\\)%\\1 $2 \\2%"
1821 echo "s%^\\($1<><a\\) \\(name=\\)%\\1 $2 \\2%"
1822 echo "s%^\\($1$S<a\\) \\(name=\\)%\\1 $2 \\2%"
1825 make_sitemap_init()
1827 # build a list of detectors that map site.htm entries to a section table
1828 # note that the resulting .gets.tmp / .puts.tmp are real sed-script
1829 h1="[-$AP$AK]"
1830 b1="[*=]"
1831 b2="[-$AP$AK]"
1832 b3="[:/]"
1833 q3="[:/,$AK]"
1834 echo_HR_PP "<hr>" "$h1" "sect=\"1\"" > "$MK_GETS"
1835 echo_HR_EM_PP "<hr>" "<em>" "$h1" "sect=\"1\"" >> "$MK_GETS"
1836 echo_HR_EM_PP "<hr>" "<strong>" "$h1" "sect=\"1\"" >> "$MK_GETS"
1837 echo_HR_PP "<br>" "$b1$b1" "sect=\"1\"" >> "$MK_GETS"
1838 echo_HR_PP "<br>" "$b2$b2" "sect=\"2\"" >> "$MK_GETS"
1839 echo_HR_PP "<br>" "$b3$b3" "sect=\"3\"" >> "$MK_GETS"
1840 echo_br_PP "<br>" "$b2$b2" "sect=\"2\"" >> "$MK_GETS"
1841 echo_br_PP "<br>" "$b3$b3" "sect=\"3\"" >> "$MK_GETS"
1842 echo_br_EM_PP "<br>" "<small>" "$q3" "sect=\"3\"" >> "$MK_GETS"
1843 echo_br_EM_PP "<br>" "<em>" "$q3" "sect=\"3\"" >> "$MK_GETS"
1844 echo_br_EM_PP "<br>" "<u>" "$q3" "sect=\"3\"" >> "$MK_GETS"
1845 echo_HR_PP "<br>" "$q3" "sect=\"3\"" >> "$MK_GETS"
1846 echo_br_PP "<u>" "$b2" "sect=\"2\"" >> "$MK_GETS"
1847 echo_sp_PP "$q3" "sect=\"3\"" >> "$MK_GETS"
1848 echo_sp_SP "" "sect=\"2\"" >> "$MK_GETS"
1849 echo_sp_sp "$q3" "sect=\"9\"" >> "$MK_GETS"
1850 echo_sp_sp "<br>" "sect=\"9\"" >> "$MK_GETS"
1851 $SED -e "s/\\(>\\)\\(\\[\\)/\\1 *\\2/" "$MK_GETS" > "$MK_PUTS"
1852 # the .puts.tmp variant is used to <b><a href=..></b> some hrefs which
1853 # shall not be used otherwise for being generated - this is nice for
1854 # some quicklinks somewhere. The difference: a whitspace "<hr> <a...>"
1855 echo "" > "$MK_DATA" # fresh start
1858 _uses_="<$Q'use\\1'>\\2 \\3<$QX>"
1859 _name_="<$Q'use\\1'>name:\\2 \\3<$QX>" ;
1861 make_sitemap_list()
1863 _sitefile_="$1" ; test ".$_sitefile_" = "." && _sitefile_="$SITEFILE"
1864 # scan sitefile for references pages - store as "=use+=href+ anchortext"
1865 $SED -f "$MK_GETS" -e "/<a sect=\"[$NN]\"/!d" \
1866 -e "s|.*<a sect=\"\\([^\"]*\\)\" href=\"\\([^\"]*\\)\"[^<>]*>\\(.*\\)</a>.*|$_uses_|" \
1867 -e "s|.*<a sect=\"\\([^\"]*\\)\" name=\"\\([^\"]*\\)\"[^<>]*>\\(.*\\)</a>.*|$_name_|" \
1868 -e "s|.*<a sect=\"\\([^\"]*\\)\" name=\"\\([^\"]*\\)\"[^<>]*>\\(.*\\)|$_name_|" \
1869 -e "/^<$Q/!d" -e "/^<!/d" \
1870 "$_sitefile_" >> "$MK_DATA"
1873 _Uses_="<$Q'Use\\1'>\\2 \\3<$QX>"
1874 _Name_="<$Q'Use\\1'>name:\\2 \\3<$QX>" ;
1876 make_subsitemap_list()
1878 _sitefile_="$1" ; test ".$_sitefile_" = "." && _sitefile_="$SITEFILE"
1879 # scan sitefile for references pages - store as "=use+=href+ anchortext"
1880 $SED -f "$MK_GETS" -e "/<a sect=\"[$NN]\"/!d" \
1881 -e "s|.*<a sect=\"\\([^\"]*\\)\" href=\"\\([^\"]*\\)\"[^<>]*>\\(.*\\)</a>.*|$_Uses_|" \
1882 -e "s|.*<a sect=\"\\([^\"]*\\)\" name=\"\\([^\"]*\\)\"[^<>]*>\\(.*\\)</a>.*|$_Name_|" \
1883 -e "s|.*<a sect=\"\\([^\"]*\\)\" name=\"\\([^\"]*\\)\"[^<>]*>\\(.*\\)|$_Name_|" \
1884 -e "/^<$Q/!d" -e "/^<!/d" \
1885 -e "s|>\\([^:./][^:./]*[./]\\)|>$2\\1|" \
1886 "$_sitefile_" >> "$MK_DATA"
1889 make_sitemap_sect()
1891 # scan used pages and store prime section group relation 'sect' and 'node'
1892 # (A) each "use1" creates "'sect'>href+ href1" for all following non-"use1"
1893 # (B) each "use1" creates "'node'>href2 href1" for all following "use2"
1894 $SED -e "/^<$Q'use.'>/!d" \
1895 -e "/^<$Q'use1'>/{" \
1896 -e "h" -e "s|^<$Q'use1'>\\([^ ]*\\) .*|\\1|" \
1897 -e "x" -e "}" \
1898 -e "s|^<$Q'use.'>\\([^ ]*\\) .*|<$Q'sect'>\\1|" \
1899 -e G -e "s|\\n| |" -e "s|\$|<$QX>|" "$MK_DATA" >> "$MK_DATA"
1900 $SED -e "/^<$Q'use.'>/!d" \
1901 -e "/^<$Q'use1'>/{" \
1902 -e "h" -e "s|^<$Q'use1'>\\([^ ]*\\) .*|\\1|" \
1903 -e "x" -e "}" \
1904 -e "/^<$Q'use[13456789]'>/d" \
1905 -e "s|<$Q'use.'>\\([^ ]*\\) .*|<$Q'node'>\\1|" \
1906 -e G -e "s|\\n| |" -e "s|\$|<$QX>|" "$MK_DATA" >> "$MK_DATA"
1909 make_sitemap_page()
1911 # scan used pages and store secondary group relation 'page' and 'node'
1912 # the parenting 'node' for use3 is usually a use2 (or use1 if none there)
1913 $SED -e "/^<$Q'use.'>/!d" \
1914 -e "/^<$Q'use1'>/{" \
1915 -e "h" -e "s|^<$Q'use1'>\\([^ ]*\\) .*|\\1|" \
1916 -e "x" -e "}" \
1917 -e "/^<$Q'use2'>/{" \
1918 -e "h" -e "s|^<$Q'use2'>\\([^ ]*\\) .*|\\1|" \
1919 -e "x" -e "}" \
1920 -e "/^<$Q'use1'>/d" \
1921 -e "s|^<$Q'use.'>\\([^ ]*\\) .*|<$Q'page'>\\1<$QX>|" \
1922 -e G -e "s|\\n| |" "$MK_DATA" >> "$MK_DATA"
1923 $SED -e "/^<$Q'use.'>/!d" \
1924 -e "/^<$Q'use1'>/{" \
1925 -e "h" -e "s|^<$Q'use1'>\\([^ ]*\\) .*|\\1|" \
1926 -e "x" -e "}" \
1927 -e "/^<$Q'use2'>/{" \
1928 -e "h" -e "s|^<$Q'use2'>\\([^ ]*\\) .*|\\1|" \
1929 -e "x" -e "}" \
1930 -e "/^<$Q'use[12456789]'>/d" \
1931 -e "s|^<$Q'use.'>\\([^ ]*\\) .*|<$Q'node'>\\1<$QX>|" \
1932 -e G -e "s|\\n| |" "$MK_DATA" >> "$MK_DATA"
1933 # and for the root sections we register ".." as the parenting group
1934 $SED -e "/^<$Q'use1'>/!d" \
1935 -e "s|^<$Q'use.'>\\([^ ]*\\) .*|<$Q'node'>\\1 ..<$QX>|" "$MK_DATA" >> "$MK_DATA"
1938 echo_site_filelist()
1940 $SED -e "/^<$Q'use.'>/!d" \
1941 -e "s|^<$Q'use.'>||" -e "s| .*||" "$MK_DATA"
1944 # ==========================================================================
1945 # originally this was a one-pass compiler but the more information
1946 # we were scanning out the more slower the system ran - since we
1947 # were rescanning files for things like section information. Now
1948 # we scan the files first for global information.
1949 # 1.PASS
1951 scan_sitefile () # $F
1953 SOURCEFILE=`html_sourcefile "$F"`
1954 $hint "'$SOURCEFILE': scanning -> sitefile"
1955 if test "$SOURCEFILE" != "$F" ; then
1956 dx_init "$F"
1957 dx_text today "`timetoday`"
1958 short=`echo "$F" | $SED -e "s:.*/::" -e "s:[.].*::"` # basename for all exts
1959 short="$short ~"
1960 DC_meta title "$short"
1961 DC_meta date.available "`timetoday`"
1962 DC_meta subject sitemap
1963 DC_meta DCMIType Collection
1964 DC_VARS_Of "$SOURCEFILE" ; HTTP_VARS_Of "$SOURCEFILE"
1965 DC_modified "$SOURCEFILE" ; DC_date "$SOURCEFILE"
1966 DC_section "$F"
1967 DX_text date.formatted `timetoday`
1968 test ".$printerfriendly" != "." && \
1969 DX_text "printerfriendly" `fast_html_printerfile "$F"`
1970 test ".$USER" != "." && DC_publisher "$USER"
1971 echo "'$SOURCEFILE': $short (sitemap)"
1972 site_map_list_title "$F" "$short"
1973 site_map_long_title "$F" "generated sitemap index"
1974 site_map_list_date "$F" "`timetoday`"
1978 scan_htmlfile() # "$F"
1980 SOURCEFILE=`html_sourcefile "$F"` # SCAN :
1981 $hint "'$SOURCEFILE': scanning -> $F" # HTML :
1982 if test "$SOURCEFILE" != "$F" ; then :
1983 if test -f "$SOURCEFILE" ; then
1984 dx_init "$F"
1985 dx_text today "`timetoday`"
1986 dx_text todays "`timetodays`"
1987 DC_VARS_Of "$SOURCEFILE" ; HTTP_VARS_Of "$SOURCEFILE"
1988 DC_title "$SOURCEFILE"
1989 DC_isFormatOf "$SOURCEFILE"
1990 DC_modified "$SOURCEFILE" ; DC_date "$SOURCEFILE" ; DC_date "$SITEFILE"
1991 DC_section "$F" ; DC_selected "$F" ; DX_alternative "$SOURCEFILE"
1992 test ".$USER" != "." && DC_publisher "$USER"
1993 DX_text date.formatted "`timetoday`"
1994 test ".$printerfriendly" != "." && \
1995 DX_text "printerfriendly" `fast_html_printerfile "$F"`
1996 sectn=`info_get_entry DC.relation.section`
1997 short=`info_get_entry DC.title.selected`
1998 site_map_list_title "$F" "$short"
1999 info_map_list_title "$F" "$short"
2000 title=`info_get_entry DC.title`
2001 site_map_long_title "$F" "$title"
2002 info_map_long_title "$F" "$title"
2003 edate=`info_get_entry DC.date`
2004 issue=`info_get_entry issue`
2005 site_map_list_date "$F" "$edate"
2006 info_map_list_date "$F" "$edate"
2007 css_scan
2008 echo "'$SOURCEFILE': '$title' ('$short') @ '$issue' ('$sectn')"
2009 else
2010 echo "'$SOURCEFILE': does not exist"
2011 site_map_list_title "$F" "$F"
2012 site_map_long_title "$F" "$F (no source)"
2013 fi ; else
2014 echo "<$F> - skipped"
2018 scan_subsitemap_long ()
2020 grep "<a href=\"[^\"]*\">" "$1" | {
2021 while read _line_ ; do
2022 _href_=`echo "$_line_" | $SED -e "s|.*<a href=\"\\([^\"]*\\)\">.*|\\1|"`
2023 _date_=`echo "$_line_" | $SED -e "s|.*<small style=\"date\">\\([^<>]*\\)</small>.*|\\1|" -e "/<a href=\"[^\"]*\">/d"`
2024 _long_=`echo "$_line_" | $SED -e "s|.*<!--long-->\\([^<>]*\\)<!--/long-->.*|\\1|" -e "/<a href=\"[^\"]*\">/d"`
2025 if test ".$_href_" != "." && test ".$_date_" != "." ; then
2026 site_map_list_date "$2$_href_" "$_date_"
2028 if test ".$_href_" != "." && test ".$_long_" != "." ; then
2029 site_map_long_title "$2$_href_" "$_long_"
2031 done
2035 scan_namespec ()
2037 # nothing so far
2038 case "$1" in
2039 name:sitemap:*)
2040 short=`echo "$F" | $SED -e "s:.*/::" -e "s:[.].*::"`
2041 short=`echo "$short ~" | $SED -e "s/name:sitemap://"`
2042 site_map_list_title "$F" "$short"
2043 site_map_long_title "$F" "external sitemap index"
2044 site_map_list_date "$F" "`timetoday`"
2045 echo "'$F' external sitemap index$n"
2047 name:*.htm|name:*.html)
2048 FF=`echo "$1" | $SED -e "s|name:||"`
2049 FFF=`echo "$FF" | $SED -e "s|/[^/]*\$|/|"` # dirname
2050 case "$FFF" in */*) : ;; *) FFF="" ;; esac
2051 make_subsitemap_list "$FF" "$FFF"
2052 scan_subsitemap_long "$FF" "$FFF"
2054 esac
2056 scan_httpspec ()
2058 # nothing so far
2059 return;
2062 skip_namespec ()
2064 # nothing so far
2065 return;
2067 skip_httpspec ()
2069 # nothing so far
2070 return;
2073 # ==========================================================================
2074 # and now generate the output pages
2075 # 2.PASS
2077 head_sed_sitemap() # $filename $section
2079 FF=`sed_piped_key "$1"`
2080 SECTION=`sed_slash_key "$2"`
2081 SECTS="sect=\"[$NN$AZ]\"" ; SECTN="sect=\"[$NN]\"" # lines with hrefs
2082 echo "s|\\(<a $SECTS href=\"$FF\">.*</a>\\)|<b>\\1</b>|" # $++
2083 test ".$sectiontab" != ".no" && \
2084 echo "/ href=\"$SECTION\"/s|^<td class=\"[^\"]*\"|<td |" # $++
2087 head_sed_listsection() # $filename $section
2089 # traditional.... the sitefile is the full navigation bar
2090 FF=`sed_piped_key "$1"`
2091 SECTION=`sed_slash_key "$2"`
2092 SECTS="sect=\"[$NN$AZ]\"" ; SECTN="sect=\"[$NN]\"" # lines with hrefs
2093 echo "s|\\(<a $SECTS href=\"$FF\">.*</a>\\)|<b>\\1</b>|" # $++
2094 test ".$sectiontab" != ".no" && \
2095 echo "/ href=\"$SECTION\"/s|^<td class=\"[^\"]*\"|<td |" # $++
2098 head_sed_multisection() # $filename $section
2100 # sitefile navigation bar is split into sections
2101 FF=`sed_piped_key "$1"`
2102 SECTION=`sed_slash_key "$2"`
2103 SECTS="sect=\"[$NN$AZ]\"" ; SECTN="sect=\"[$NN]\"" # lines with hrefs
2104 # grep all pages with a class='sect' relation to current $SECTION and
2105 # build foreach an sed line "s|$SECTS\(<a href=$F>\)|<!--sectX-->\1|"
2106 # after that all the (still) numeric SECTNs are deactivated / killed.
2107 for section in $SECTION $headsection $tailsection ; do
2108 test ".$section" = ".no" && continue
2109 $SED -e "/^<$Q'sect'>[^ ]* $section/!d" \
2110 -e "s|<$Q'sect'>||" -e "s| .*||" \
2111 -e "s/.*/s|<a $SECTS \\\\(href=\"&\"\\\\)|<a sect=\"X\" \\\\1|/" \
2112 "$MK_DATA" # $++
2113 $SED -e "/^<$Q'sect'>name:[^ ]* $section/!d" \
2114 -e "s|<$Q'sect'>name:||" -e "s| .*||" \
2115 -e "s/.*/s|<a $SECTS \\\\(name=\"&\"\\\\)|<a sect=\"X\" \\\\1|/" \
2116 "$MK_DATA" # $++
2117 done
2118 echo "s|.*<a \\($SECTN href=[^<>]*\\)>.*|<!-- \\1 -->|" # $++
2119 echo "s|.*<a \\($SECTN name=[^<>]*\\)>.*|<!-- \\1 -->|" # $++
2120 echo "s|\\(<a $SECTS href=\"$FF\">\\)|<b>\\1</b>|" # $++
2121 test ".$sectiontab" != ".no" && \
2122 echo "/ href=\"$SECTION\"/s|^<td class=\"[^\"]*\"|<td |" # $++
2125 make_sitefile () # "$F"
2127 SOURCEFILE=`html_sourcefile "$F"`
2128 if test "$SOURCEFILE" != "$F" ; then
2129 if test -f "$SOURCEFILE" ; then
2130 # remember that in this case "${SITEFILE}l" = "$F" = "${SOURCEFILE}l"
2131 info2vars_sed > $MK_VARS # have <!--title--> vars substituted
2132 info2meta_sed > $MK_META # add <meta name="DC.title"> values
2133 F_HEAD="$tmp/$F.$HEAD" ; F_FOOT="$tmp/$F.$FOOT"
2134 $CAT "$MK_PUTS" > "$F_HEAD"
2135 head_sed_sitemap "$F" "`info_get_entry_section`" >> "$F_HEAD"
2136 echo "/<head>/r $MK_META" >> "$F_HEAD"
2137 $CAT "$MK_VARS" "$MK_TAGS" >> "$F_HEAD"
2138 echo "/<\\/body>/d" >> "$F_HEAD"
2139 case "$sitemaplayout" in
2140 multi) make_multisitemap > "$F_FOOT" ;; # here we use ~foot~ to
2141 *) make_listsitemap > "$F_FOOT" ;; # hold the main text
2142 esac
2144 mkpathfile "$F"
2145 $SED_LONGSCRIPT "$F_HEAD" "$SITEFILE" > $F # ~head~
2146 $CAT "$F_FOOT" >> $F # ~body~
2147 $SED -e "/<\\/body>/!d" -f "$MK_VARS" "$SITEFILE" >> $F #</body>
2148 echo "'$SOURCEFILE': " `ls -s $SOURCEFILE` ">->" `ls -s $F` "(sitemap)"
2149 else
2150 echo "'$SOURCEFILE': does not exist"
2151 fi fi
2154 make_htmlfile() # "$F"
2156 SOURCEFILE=`html_sourcefile "$F"` # 2.PASS
2157 if test "$SOURCEFILE" != "$F" ; then
2158 if test -f "$SOURCEFILE" ; then
2159 if grep '<meta name="formatter"' "$SOURCEFILE" > $NULL ; then
2160 echo "'$SOURCEFILE': SKIP, this sourcefile looks like a formatted file"
2161 echo "'$SOURCEFILE': (may be a sourcefile in place of a targetfile?)"
2162 return
2164 info2vars_sed > $MK_VARS # have <!--$title--> vars substituted
2165 info2meta_sed > $MK_META # add <meta name="DC.title"> values
2166 tags2span_sed > $MK_SPAN # extern text/css -> intern css classes
2167 tags2meta_sed >>$MK_META # extern text/css -> intern css classes
2168 F_HEAD="$tmp/$F.$HEAD" ; F_BODY="$tmp/$F.$BODY" ; F_FOOT="$tmp/$F.$FOOT"
2169 $CAT "$MK_PUTS" > "$F_HEAD"
2170 case "$sectionlayout" in
2171 multi) head_sed_multisection "$F" "`info_get_entry_section`" >> "$F_HEAD" ;;
2172 *) head_sed_listsection "$F" "`info_get_entry_section`" >> "$F_HEAD" ;;
2173 esac
2174 $CAT "$MK_VARS" "$MK_TAGS" "$MK_SPAN" >> "$F_HEAD" #tag and vars
2175 echo "/<\\/body>/d" >> "$F_HEAD" #cut lastline
2176 echo "/<head>/r $MK_META" >> "$F_HEAD" #add metatags
2177 echo "/<title>/d" > "$F_BODY" #not that line
2178 $CAT "$MK_VARS" "$MK_TAGS" "$MK_SPAN" >> "$F_BODY" #tag and vars
2179 bodymaker_for_sectioninfo >> "$F_BODY" #if sectioninfo
2180 info2body_sed >> "$F_BODY" #cut early
2181 info2head_sed >> "$F_HEAD"
2182 make_back_path "$F" >> "$F_HEAD"
2183 test ".$emailfooter" != ".no" && \
2184 body_for_emailfooter > "$F_FOOT"
2186 mkpathfile "$F"
2187 $SED_LONGSCRIPT "$F_HEAD" $SITEFILE > $F # ~head~
2188 $SED_LONGSCRIPT "$F_BODY" $SOURCEFILE >> $F # ~body~
2189 test -f "$F_FOOT" && $CAT "$F_FOOT" >> $F # ~foot~
2190 $SED -e "/<\\/body>/!d" -f "$MK_VARS" "$SITEFILE" >> $F #</body>
2191 echo "'$SOURCEFILE': " `ls -s $SOURCEFILE` "->" `ls -s $F`
2192 else # test -f $SOURDEFILE
2193 echo "'$SOURCEFILE': does not exist"
2194 fi ; else
2195 echo "<$F> - skipped"
2199 make_printerfriendly () # "$F"
2200 { # PRINTER
2201 printsitefile="0" # FRIENDLY
2202 P=`html_printerfile "$F"`
2203 P_HEAD="$tmp/$P.$HEAD"
2204 P_BODY="$tmp/$P.$BODY"
2205 case "$F" in
2206 ${SITEFILE}|${SITEFILE}l)
2207 printsitefile=">=>" ; BODY_TXT="$tmp/$F.$FOOT" ;;
2208 *.html) printsitefile="=>" ; BODY_TXT="$SOURCEFILE" ;;
2209 esac
2210 if grep '<meta name="formatter"' "$BODY_TXT" > $NULL ; then return; fi
2211 if test ".$printsitefile" != ".0" && test -f "$SOURCEFILE" ; then
2212 make_printerfile_fast "$FILELIST" > ./$MK_FAST
2213 $CAT "$MK_VARS" "$MK_TAGS" "$MK_FAST" > "$P_HEAD"
2214 $SED -e "/DC.relation.isFormatOf/s|content=\"[^\"]*\"|content=\"$F\"|" \
2215 "$MK_META" > "$MK_METT"
2216 echo "/<head>/r $MK_METT" >> "$P_HEAD" # meta
2217 echo "/<\\/body>/d" >> "$P_HEAD"
2218 select_in_printsitefile "$F" >> "$P_HEAD"
2219 _ext_=`print_extension "$printerfriendly"` # head-
2220 # line_=`sed_slash_key "$printsitefile_img_2"` # back-
2221 echo "/||topics:/s| href=\"[#][.]\"| href=\"$F\"|" >> "$P_HEAD"
2222 echo "/|||pages:/s| href=\"[#][.]\"| href=\"$F\"|" >> "$P_HEAD"
2223 make_back_path "$F" >> "$P_HEAD"
2224 $CAT "$MK_VARS" "$MK_TAGS" "$MK_FAST" > "$P_BODY"
2225 make_back_path "$F" >> "$P_BODY"
2227 mkpathfile "$P"
2228 $SED_LONGSCRIPT "$P_HEAD" $PRINTSITEFILE > $P # ~head~
2229 $SED_LONGSCRIPT "$P_BODY" $BODY_TXT >> $P # ~body~
2230 $SED -e "/<\\/body>/!d" -f $MK_VARS $PRINTSITEFILE >> $P #</body>
2231 echo "'$SOURCEFILE': " `ls -s $SOURCEFILE` "$printsitefile" `ls -s $P`
2236 # ========================================================================
2237 # ========================================================================
2238 # ========================================================================
2240 # ========================================================================
2241 # #### 0. INIT
2242 make_sitemap_init
2243 make_sitemap_list
2244 make_sitemap_sect
2245 make_sitemap_page
2247 if test -d DEBUG && test -f "$MK_DATA"
2248 then FFFF=`echo "$F" | sed -e "s,/,:,g"`
2249 cp "$MK_DATA" "DEBUG/$FFFF.DATA.tmp.htm"
2252 FILELIST=`echo_site_filelist`
2253 if test ".$opt_filelist" != "." || test ".$opt_list" = ".file"; then
2254 for F in $FILELIST; do echo "$F" ; done ; exit # --filelist
2256 if test ".$opt_files" != "." ; then FILELIST="$opt_files" ; fi # --files
2257 if test ".$FILELIST" = "."; then warn "nothing to do (no --filelist)" ; fi
2258 if test ".$FILELIST" = ".SITEFILE" ; then warn "only '$SITEFILE'?!" ; fi
2260 for F in $FILELIST ; do case "$F" in #### 1. PASS
2261 name:*) scan_namespec "$F" ;;
2262 http:*|https:*|ftp:*|mailto:*|telnet:*|news:*|gopher:*|wais:*)
2263 scan_httpspec "$F" ;;
2264 ${SITEFILE}|${SITEFILE}l) scan_sitefile "$F" ;; # ........... SCAN SITE
2265 *@*.de)
2266 echo "!! -> '$F' (skipping malformed mailto:-link)"
2268 ../*)
2269 echo "!! -> '$F' (skipping topdir build)"
2271 # */*.html)
2272 # echo "!! -> '$F' (skipping subdir build)"
2273 # ;;
2274 # */*/*/|*/*/|*/|*/index.htm|*/index.html)
2275 # echo "!! -> '$F' (skipping subdir index.html)"
2276 # ;;
2277 *.html) scan_htmlfile "$F" # ........... SCAN HTML
2278 if test ".$opt_xml" != "." ; then
2279 F=`echo "$F" | sed -e "s/\\.html$/.xml/"`
2280 scan_xmlfile "$F"
2281 fi ;;
2282 *.xml) scan_xmlfile "$F" ;;
2283 */) echo "'$F' : directory - skipped"
2284 site_map_list_title "$F" "`sed_slash_key $F`"
2285 site_map_long_title "$F" "(directory)"
2287 *) echo "?? -> '$F'"
2289 esac done
2291 if test ".$printerfriendly" != "." ; then # .......... PRINT VERSION
2292 _ext_=`print_extension "$printerfriendly" | sed -e "s/&/\\\\&/"`
2293 PRINTSITEFILE=`echo "$SITEFILE" | sed -e "s/\\.[$AA]*\$/$_ext_&/"`
2294 echo "NOTE: going to create printer-friendly sitefile $PRINTSITEFILE"
2295 make_printsitefile > "$PRINTSITEFILE"
2298 for F in $FILELIST ; do case "$F" in #### 2. PASS
2299 name:*) skip_namespec "$F" ;;
2300 http:*|https:*|ftp:*|mailto:*|telnet:*|news:*|gopher:*|wais:*)
2301 skip_httpspec "$F" ;;
2302 ${SITEFILE}|${SITEFILE}l) make_sitefile "$F" # ........ SITE FILE
2303 if test ".$printerfriendly" != "." ; then make_printerfriendly "$F" ; fi
2304 if test ".$opt_xml" != "." ; then _old_F_="$F"
2305 F=`echo "$F" | sed -e "s/\\.html$/.xml/"`
2306 make_xmlmaster "$F" ;F="$_old_F_"
2307 fi ;;
2308 *@*.de)
2309 echo "!! -> '$F' (skipping malformed mailto:-link)"
2311 ../*)
2312 echo "!! -> '$F' (skipping topdir build)"
2314 # */*.html)
2315 # echo "!! -> '$F' (skipping subdir build)"
2316 # ;;
2317 # */*/*/|*/*/|*/|*/index.htm|*/index.html)
2318 # echo "!! -> '$F' (skipping subdir index.html)"
2319 # ;;
2320 *.html) make_htmlfile "$F" # .................. HTML FILES
2321 test ".$printerfriendly" != "." && make_printerfriendly "$F"
2322 if test ".$opt_xml" != "." ; then _old_F_="$F"
2323 F=`echo "$F" | sed -e "s/\\.html$/.xml/"`
2324 make_xmlfile "$F" ;F="$_old_F_"
2325 fi ;;
2326 *.xml) make_xmlfile "$F" ;;
2327 */) echo "'$F' : directory - skipped"
2329 *) echo "?? -> '$F'"
2331 esac
2332 # .............. debug ....................
2333 if test -d DEBUG && test -f "./$F" ; then
2334 FFFF=`echo "$F" | sed -e "s,/,:,g"`
2335 test -f "$tmp/$F.$DATA" && cp "$tmp/$F.$DATA" DEBUG/$FFFF.data.tmp.htm
2336 test -f "$tmp/$F.$HEAD" && cp "$tmp/$F.$HEAD" DEBUG/$FFFF.head.tmp.sed
2337 test -f "$tmp/$F.$BODY" && cp "$tmp/$F.$BODY" DEBUG/$FFFF.body.tmp.sed
2338 test -f "$tmp/$F.$FOOT" && cp "$tmp/$F.$FOOT" DEBUG/$FFFF.foot.tmp.sed
2339 for P in tags vars span meta page date list html sect \
2340 data head body foot fast xmlmapping \
2341 gets puts site mett sect1 sect2 sect3 style ; do
2342 test -f $tmp/$MK.$P.tmp.htm && cp $tmp/$MK.$P.tmp.htm DEBUG/$FFFF.$P.tmp.htm
2343 test -f $tmp/$MK.$P.tmp.sed && cp $tmp/$MK.$P.tmp.sed DEBUG/$FFFF.$P.tmp.sed
2344 done
2346 done
2348 if test ".$opt_keeptmpfiles" = "." ; then
2349 for i in $tmp/$MK.*.tmp.htm $tmp/$MK.*.tmp.sed \
2350 $tmp/$MK.*.tmp.css $tmp/$MK.*.tmp.txt
2351 do test -f "$i" && rm "$i"
2352 done
2354 if test ".$tmp_dir_was_created" != ".no" ; then rm $tmp/* ; rmdir $tmp ; fi
2355 exit 0