diff options
Diffstat (limited to 'Build/source/libs/zziplib/zziplib-0.13.58/docs/mksite.sh')
-rw-r--r-- | Build/source/libs/zziplib/zziplib-0.13.58/docs/mksite.sh | 1476 |
1 files changed, 1021 insertions, 455 deletions
diff --git a/Build/source/libs/zziplib/zziplib-0.13.58/docs/mksite.sh b/Build/source/libs/zziplib/zziplib-0.13.58/docs/mksite.sh index 22a06431060..12af7948d00 100644 --- a/Build/source/libs/zziplib/zziplib-0.13.58/docs/mksite.sh +++ b/Build/source/libs/zziplib/zziplib-0.13.58/docs/mksite.sh @@ -6,7 +6,7 @@ # commands like sed, date, and test. And it still works. :-)=) # http://zziplib.sf.net/mksite/ # THE MKSITE.SH (ZLIB/LIBPNG) LICENSE -# Copyright (c) 2004 Guido Draheim <guidod@gmx.de> +# Copyright (c) 2004 Guido U. Draheim <guidod@gmx.de> # This software is provided 'as-is', without any express or implied warranty # In no event will the authors be held liable for any damages arising # from the use of this software. @@ -20,7 +20,7 @@ # 2. Altered source versions must be plainly marked as such, and must not # be misrepresented as being the original software. # 3. This notice may not be removed or altered from any source distribution. -# $Id: mksite.sh,v 1.4 2005/05/14 15:08:23 guidod Exp $ +# $Id: mksite.sh,v 1.5 2006-09-22 00:33:22 guidod Exp $ # Zsh is not Bourne compatible without the following: (seen in autobook) if test -n "$ZSH_VERSION"; then @@ -41,16 +41,17 @@ DATE_R="date -r" # gnu date has it / solaris date not STAT_R="stat" # gnu linux LS_L="ls -l" # linux uses one less char than solaris -INFO="~~" # extension for meta data files +DATA="~~" # extension for meta data files HEAD="~head~" # extension for head sed script BODY="~body~" # extension for body sed script FOOT="~foot~" # append to body text (non sed) -FAST="~move~" # extension for printer friendly sed NULL="/dev/null" # to divert stdout/stderr CATNULL="$CAT $NULL" # to create 0-byte files SED_LONGSCRIPT="$SED -f" +Q='q class=' +QX='/q' LOWER="abcdefghijklmnopqrstuvwxyz" UPPER="ABCDEFGHIJKLMNOPQRSTUVWXYZ" az="$LOWER" # some old sed tools can not @@ -58,20 +59,86 @@ AZ="$UPPER" # use char-ranges in the NN="0123456789" # match expressions so that AA="_$NN$AZ$az" # we use their unrolled AX="$AA.+-" # definition here -if $SED -V 2>$NULL | $GREP "GNU sed" >$NULL ; then -az="a-z" # but if we have GNU sed -AZ="A-Z" # then we assume there are -NN="0-9" # char-ranges available -AA="_$NN$AZ$az" # that makes the resulting -AX="$AA.+-" # script more readable -elif uname -s | $GREP HP-UX >$NULL ; then -SED_LONGSCRIPT="sed_longscript" # due to 100 sed lines limit -fi +AP="|" # (pipe symbol in char-range) +AK="[" # (open range in char-range) LANG="C" ; LANGUAGE="C" ; LC_COLLATE="C" # these are needed for proper export LANG LANGUAGE LC_COLLATE # lowercasing as some collate # treat A-Z to include a-z +HTMLTAGS=" a p h1 h2 h3 h4 h5 h6 dl dd dt ul ol li pre code table tr td th" +HTMLTAGS=" $HTMLTAGS b u i s q em strong strike cite big small sup sub tt" +HTMLTAGS=" $HTMLTAGS thead tbody center hr br nobr wbr" +HTMLTAGS=" $HTMLTAGS span div img adress blockquote" +HTMLTAGS2=" html head body title meta http-equiv style link" + +# ========================================================================== +if "${SHELL-/bin/sh}" -c 'foo () { exit 0; }; foo' 2>$NULL ; then : ; else +echo "!! sorry, this shell '$SHELL' does not support shell functions" ; exit 1 +fi + +error () +{ + echo "ERROR:" "$@" 1>&2 +} + +warn () +{ + echo "WARN:" "$@" 1>&2 +} + +note () +{ + echo "NOTE:" "$@" 1>&2 +} + +hint=":" + +init () +{ + if test -d DEBUG + then hint="note" + fi + if test "$SED" = "sed" ; then + if gsed --version 2>$NULL | $GREP "GNU sed" >$NULL ; then + SED="gsed" + $hint "using 'gsed' as SED" + fi + fi + if $SED --version 2>$NULL | $GREP "GNU sed" >$NULL ; then + az="a-z" # but if we have GNU sed + AZ="A-Z" # then we assume there are + NN="0-9" # char-ranges available + AA="_$NN$AZ$az" # that makes the resulting + AX="$AA.+-" # script more readable + $hint "found GNU sed - good" + elif uname -s | $GREP HP-UX >$NULL ; then + SED_LONGSCRIPT="sed_longscript" # due to 100 sed lines limit + $hint "weird sed - hpux sed has a limit of 100 lines" \ + "- using sed_longscript mode" + fi + if echo "TEST" | sed -e "s%[:[]*TEST%OK%" | grep OK 2>&1 > $NULL + then : + elif echo "TEST" | sed -e "s%[:\\[]*TEST%OK%" | grep OK 2>&1 > $NULL + then AK="\\[" ; $hint "AK=\\[" + else AK="" ; warn "buggy sed - disabled [ in char-ranges / fileref-tests" + fi + if echo "TEST" | sed -e "s%[:|]*TEST%OK%" | grep OK 2>&1 > $NULL + then : + elif echo "TEST" | sed -e "s%[:\\|]*TEST%OK%" | grep OK 2>&1 > $NULL + then AP="\\[" ; $hint "AP=\\|" + else AP="" ; warn "buggy sed - disabled | in char-ranges / fileref-tests" + fi +} + +init "NOW!!!" + +sed_debug () +{ + $note "sed" "$@" >&2 + sed "$@" +} + # ========================================================================== # reading options from the command line GETOPT opt_variables="files" @@ -89,31 +156,32 @@ do if test ".$opt" != "." ; then -*=*) opt=`echo "$arg" | $SED -e "s/-*\\([$AA][$AA-]*\\).*/\\1/" -e y/-/_/` if test ".$opt" = "." ; then - echo "ERROR: invalid option $arg" >&2 + error "invalid option $arg" else arg=`echo "$arg" | $SED -e "s/^[^=]*=//"` eval "export opt_$opt='$arg'" opt_variables="$opt_variables $opt" fi opt="" ;; - -*-*) + -*?-*) : an option with an argument --main-file=x or --main-file x opt=`echo "$arg" | $SED -e "s/-*\\([$AA][$AA-]*\\).*/\\1/" -e y/-/_/` if test ".$opt" = "." ; then - echo "ERROR: invalid option $arg" >&2 + error "invalid option $arg" opt="" else : # keep the option for next round fi ;; - -*) + -*) : a simple option --filelist or --debug or --verbose opt=`echo "$arg" | $SED -e "s/^-*\\([$AA][$AA-]*\\).*/\\1/" -e y/-/_/` if test ".$opt" = "." ; then - echo "ERROR: invalid option $arg" >&2 + error "invalid option $arg" else arg=`echo "$arg" | $SED -e "s/^[^=]*=//"` eval "export opt_$opt=' '" fi opt="" ;; - *) if test ".$opt_main_file" = "." ; then opt_main_file="$arg" ; else + *) $hint "<$arg>" + if test ".$opt_main_file" = "." ; then opt_main_file="$arg" ; else test ".$opt_files" != "." && opt_files="$opt_files$opt_fileseparator" opt_files="$opt_files$arg" ; fi opt="" ;; @@ -129,6 +197,8 @@ test ".$opt_main_file" != "." && test -f "$opt_main_file" && \ SITEFILE="$opt_main_file" test ".$opt_site_file" != "." && test -f "$opt_site_file" && \ SITEFILE="$opt_site_file" +test "$opt_debug" && \ +hint="note" if test ".$opt_help" != "." ; then F="$SITEFILE" @@ -147,14 +217,10 @@ if test ".$opt_help" != "." ; then fi if test ".$SITEFILE" = "." ; then - echo "error: no SITEFILE found (default would be 'site.htm')" + error "no SITEFILE found (default would be 'site.htm')" exit 1 else - echo "NOTE: sitefile: `ls -s $SITEFILE`" -fi - -if "${SHELL-/bin/sh}" -c 'foo () { exit 0; }; foo' 2>$NULL ; then : ; else -echo "!! sorry, this shell '$SHELL' does not support shell functions"; exit 1 + $hint "sitefile:" `ls -s $SITEFILE` fi tmp="." ; if test ".$opt_tmp_dir" != "." ; then tmp="$opt_tmp_dir" ; fi @@ -162,21 +228,21 @@ if test ".$opt_tmp_dir" = "." && test ".$opt_tmp" != "." ; then tmp="${TEMP-/tmp}/mksite.$$" ; fi # we use external files to store mappings - kind of relational tables -MK_TAGS="$tmp/$MK.tags.tmp" -MK_VARS="$tmp/$MK.vars.tmp" -MK_META="$tmp/$MK.meta.tmp" -MK_METT="$tmp/$MK.mett.tmp" -MK_TEST="$tmp/$MK.test.tmp" -MK_FAST="$tmp/$MK.fast.tmp" -MK_GETS="$tmp/$MK.gets.tmp" -MK_PUTS="$tmp/$MK.puts.tmp" -MK_OLDS="$tmp/$MK.olds.tmp" -MK_SITE="$tmp/$MK.site.tmp" -MK_SECT1="$tmp/$MK.sect1.tmp" -MK_SECT2="$tmp/$MK.sect2.tmp" -MK_SECT3="$tmp/$MK.sect3.tmp" -MK_STYLE="$tmp/$MK.style.tmp" -MK_INFO="$tmp/$MK.$INFO" +MK_TAGS="$tmp/$MK.tags.tmp.sed" +MK_VARS="$tmp/$MK.vars.tmp.sed" +MK_SPAN="$tmp/$MK.span.tmp.sed" +MK_META="$tmp/$MK.meta.tmp.htm" +MK_METT="$tmp/$MK.mett.tmp.htm" +MK_TEST="$tmp/$MK.test.tmp.htm" +MK_FAST="$tmp/$MK.fast.tmp.sed" +MK_GETS="$tmp/$MK.gets.tmp.sed" +MK_PUTS="$tmp/$MK.puts.tmp.sed" +MK_SITE="$tmp/$MK.site.tmp.sed" +MK_SECT1="$tmp/$MK.sect1.tmp.sed" +MK_SECT2="$tmp/$MK.sect2.tmp.sed" +MK_SECT3="$tmp/$MK.sect3.tmp.sed" +MK_STYLE="$tmp/$MK.style.tmp.sed" +MK_DATA="$tmp/$MK.$DATA.tmp.htm" # ======================================================================== # ======================================================================== @@ -186,11 +252,10 @@ MK_INFO="$tmp/$MK.$INFO" printerfriendly="" sectionlayout="list" sitemaplayout="list" -simplevars="warn" # <!--varname-->default attribvars=" " # <x ref="${varname:=default}"> updatevars=" " # <!--$varname:=-->default expandvars=" " # <!--$varname--> -commentvars=" " # $updatevars && $expandsvars && $simplevars +commentvars=" " # $updatevars && $expandsvars sectiontab=" " # highlight ^<td class=...>...href="$section" currenttab=" " # highlight ^<br>..<a href="$topic"> headsection="no" @@ -232,8 +297,6 @@ x=`mksite_magic_option sectionlayout` ; case "$x" in "list"|"multi") sectionlayout="$x" ;; esac x=`mksite_magic_option sitemaplayout` ; case "$x" in "list"|"multi") sitemaplayout="$x" ;; esac -x=`mksite_magic_option simplevars` ; case "$x" in - " "|"no"|"warn") simplevars="$x" ;; esac x=`mksite_magic_option attribvars` ; case "$x" in " "|"no"|"warn") attribvars="$x" ;; esac x=`mksite_magic_option updatevars` ; case "$x" in @@ -256,20 +319,13 @@ x=`mksite_magic_option emailfooter` test ".$opt_print" != "." && printerfriendly="$opt_print" test ".$commentvars" = ".no" && updatevars="no" # duplicated into test ".$commentvars" = ".no" && expandvars="no" # info2vars_sed () -test ".$commentvars" = ".no" && simplevars="no" # function above - -test -d DEBUG && \ -echo "NOTE: '$sectionlayout'sectionlayout '$sitemaplayout'sitemaplayout" -test -d DEBUG && \ -echo "NOTE: '$simplevars'simplevars '$printerfriendly'printerfriendly" -test -d DEBUG && \ -echo "NOTE: '$attribvars'attribvars '$updatevars'updatevars" -test -d DEBUG && \ -echo "NOTE: '$expandvars'expandvars '$commentvars'commentvars " -test -d DEBUG && \ -echo "NOTE: '$currenttab'currenttab '$sectiontab'sectiontab" -test -d DEBUG && \ -echo "NOTE: '$headsection'headsection '$tailsection'tailsection" + + +$hint "'$sectionlayout'sectionlayout '$sitemaplayout'sitemaplayout" +$hint "'$attribvars'attribvars '$updatevars'updatevars" +$hint "'$expandvars'expandvars '$commentvars'commentvars " +$hint "'$currenttab'currenttab '$sectiontab'sectiontab" +$hint "'$headsection'headsection '$tailsection'tailsection" if ($STAT_R "$SITEFILE" >$NULL) 2>$NULL ; then : ; else STAT_R=":" ; fi # ========================================================================== @@ -304,16 +360,21 @@ if test ! -d "$tmp" ; then mkpathdir "$tmp" ; tmp_dir_was_created="yes" ; fi # tag via "h;y;x" or something we do want to convert all the tags on # a single line of course. mknewfile "$MK_TAGS" -for P in P H1 H2 H3 H4 H5 H6 DL DD DT UL OL LI PRE CODE TABLE TR TD TH \ - B U I S Q EM STRONG STRIKE CITE BIG SMALL SUP SUB TT THEAD TBODY \ - CENTER HR BR NOBR WBR SPAN DIV IMG ADRESS BLOCKQUOTE -do M=`echo "$P" | $SED -e "y/$UPPER/$LOWER/"` +for M in `echo $HTMLTAGS` +do P=`echo "$M" | $SED -e "y/$LOWER/$UPPER/"` echo "s|<$P>|<$M class=\"$P\">|g" >> "$MK_TAGS" echo "s|<$P |<$M class=\"$P\" |g" >> "$MK_TAGS" echo "s|</$P>|</$M>|g" >> "$MK_TAGS" done echo "s|<>|\\ \\;|g" >> "$MK_TAGS" - echo "s|<->|<WBR />\\;|g" >> "$MK_TAGS" + echo "s|<->|<WBR />|g" >> "$MK_TAGS" + echo "s|<c>|<code>|g" >> "$MK_TAGS" + echo "s|</c>|</code>|g" >> "$MK_TAGS" + echo "s|<section>||g" >> "$MK_TAGS" + echo "s|</section>||g" >> "$MK_TAGS" + echo "s|<\\(a [^<>]*\\) />|<\\1></a>|g" >> "$MK_TAGS" + _ulink_="<a href=\"\\1\" remap=\"url\">\\1</a>" + echo "s|<a>\\([$az$AZ][$az$AZ]*://[^<>]*\\)</a>|$_ulink_|g" >> "$MK_TAGS" # also make sure that some non-html entries are cleaned away that # we are generally using to inject meta information. We want to see # that meta ino in the *.htm browser view during editing but they @@ -327,7 +388,8 @@ _EQUIVS="$_EQUIVS content-language content-script-type content-style-type" for P in $DC_VARS $_EQUIVS ; do # dublin core embedded echo "s|<$P>[^<>]*</$P>||g" >> "$MK_TAGS" done - echo "s|<!--sect[$AZ$NN]-->||g" >> "$MK_TAGS" + test ".$opt_keepsect" = "." && \ + echo "s|<a sect=\"[$AZ$NN]\"|<a|g" >> "$MK_TAGS" echo "s|<!--[$AX]*[?]-->||g" >> "$MK_TAGS" echo "s|<!--\\\$[$AX]*[?]:-->||g" >> "$MK_TAGS" echo "s|<!--\\\$[$AX]*:[?=]-->||g" >> "$MK_TAGS" @@ -388,13 +450,18 @@ sed_longscript () -f "$1~6~" -f "$1~7~" -f "$1~8~" -f "$1~9~" "$2" } +sed_escape_key () +{ + $SED -e "s|\\.|\\\\&|g" -e "s|\\[|\\\\&|g" -e "s|\\]|\\\\&|g" "$@" +} + sed_slash_key () # helper to escape chars special in /anchor/ regex { # currently escaping "/" "[" "]" "." - echo "$1" | $SED -e "s|[./[-]|\\\\&|g" -e "s|\\]|\\\\&|g" + echo "$1" | sed_escape_key -e "s|/|\\\\&|g" } sed_piped_key () # helper to escape chars special in s|anchor|| regex { # currently escaping "|" "[" "]" "." - echo "$1" | $SED -e "s/[.|[-]/\\\\&/g" -e "s/\\]/\\\\&/g" + echo "$1" | sed_escape_key -e "s/|/\\\\&/g" } back_path () # helper to get the series of "../" for a given path @@ -407,47 +474,15 @@ dir_name () echo "$1" | $SED -e "s:/[^/][^/]*\$::" } -info2test_sed () # cut out all old-style <!--vars--> usages -{ - INP="$1" ; test ".$INP" = "." && INP="$tmp/$F.$INFO" - V8=" *\\([^ ][^ ]*\\) \\(.*\\)" - V9=" *DC[.]\\([^ ][^ ]*\\) \\(.*\\)" - q="\\\$" - _x_="WARNING: assumed simplevar <!--\\\\1--> changed to <!--$q\\\\1:=-->" - _y_="WARNING: assumed simplevar <!--\\\\1--> changed to <!--$q\\\\1:?-->" - _X_="WARNING: assumed tailvar <!--$q\\\\1:--> changed to <!--$q\\\\1:=-->" - _Y_="WARNING: assumed tailvar <!--$q\\\\1:--> changed to <!--$q\\\\1:?-->" - echo "s/^/ /" # $++ - $SED -e "/^=....=formatter /d" \ - -e "/=text=/s%=text=$V9%s|.*<!--\\\\(\\1\\\\)-->.*|$_x_|%" \ - -e "/=Text=/s%=Text=$V9%s|.*<!--\\\\(\\1\\\\)-->.*|$_x_|%" \ - -e "/=name=/s%=name=$V9%s|.*<!--\\\\(\\1\\\\)[?]-->.*|$_y_|%" \ - -e "/=Name=/s%=Name=$V9%s|.*<!--\\\\(\\1\\\\)[?]-->.*|$_y_|%" \ - -e "/=text=/s%=text=$V8%s|.*<!--\\\\(\\1\\\\)-->.*|$_x_|%" \ - -e "/=Text=/s%=Text=$V8%s|.*<!--\\\\(\\1\\\\)-->.*|$_x_|%" \ - -e "/=name=/s%=name=$V8%s|.*<!--\\\\(\\1\\\\)[?]-->.*|$_y_|%" \ - -e "/=Name=/s%=Name=$V8%s|.*<!--\\\\(\\1\\\\)[?]-->.*|$_y_|%" \ - -e "/^=/d" -e "s|&|\\\\&|g" $INP # $++ - $SED -e "/^=....=formatter /d" \ - -e "/=text=/s%=text=$V9%s|.*<!--$q\\\\(\\1\\\\):-->.*|$_X_|%" \ - -e "/=Text=/s%=Text=$V9%s|.*<!--$q\\\\(\\1\\\\):-->.*|$_X_|%" \ - -e "/=name=/s%=name=$V9%s|.*<!--$q\\\\(\\1\\\\)[?]:-->.*|$_Y_|%" \ - -e "/=Name=/s%=Name=$V9%s|.*<!--$q\\\\(\\1\\\\)[?]:-->.*|$_Y_|%" \ - -e "/=text=/s%=text=$V8%s|.*<!--$q\\\\(\\1\\\\):-->.*|$_X_|%" \ - -e "/=Text=/s%=Text=$V8%s|.*<!--$q\\\\(\\1\\\\):-->.*|$_X_|%" \ - -e "/=name=/s%=name=$V8%s|.*<!--$q\\\\(\\1\\\\)[?]:-->.*|$_Y_|%" \ - -e "/=Name=/s%=Name=$V8%s|.*<!--$q\\\\(\\1\\\\)[?]:-->.*|$_Y_|%" \ - -e "/^=/d" -e "s|&|\\\\&|g" $INP # $++ - echo "/^WARNING:/!d" # $++ -} - +piped_value="s/|/\\\\|/g" +amp_value="s|&|\\\\&|g" info2vars_sed () # generate <!--$vars--> substition sed addon script { - INP="$1" ; test ".$INP" = "." && INP="$tmp/$F.$INFO" - V8=" *\\([^ ][^ ]*\\) \\(.*\\)" - V9=" *DC[.]\\([^ ][^ ]*\\) \\(.*\\)" - N8=" *\\([^ ][^ ]*\\) \\([$NN].*\\)" - N9=" *DC[.]\\([^ ][^ ]*\\) \\([$NN].*\\)" + INP="$1" ; test ".$INP" = "." && INP="$tmp/$F.$DATA" + V8=" *\\([^ ][^ ]*\\) \\(.*\\)<$QX>" + V9=" *DC[.]\\([^ ][^ ]*\\) \\(.*\\)<$QX>" + N8=" *\\([^ ][^ ]*\\) \\([$NN].*\\)<$QX>" + N9=" *DC[.]\\([^ ][^ ]*\\) \\([$NN].*\\)<$QX>" V0="\\\\([<]*\\\\)\\\\\\\$" V1="\\\\([^<>]*\\\\)\\\\\\\$" V2="\\\\([^{<>}]*\\\\)" @@ -455,76 +490,53 @@ info2vars_sed () # generate <!--$vars--> substition sed addon script SS="<""<>"">" # spacer so value="2004" does not make for s|\(...\)|\12004| test ".$commentvars" = ".no" && updatevars="no" # duplicated from test ".$commentvars" = ".no" && expandvars="no" # option handling - test ".$commentvars" = ".no" && simplevars="no" # tests below test ".$expandvars" != ".no" && \ - $SED -e "/^=....=formatter /d" \ - -e "/^=name=/s,=name=$V9,s|<!--$V0\\1[?]-->|- \\2|," \ - -e "/^=Name=/s,=Name=$V9,s|<!--$V0\\1[?]-->|(\\2)|," \ - -e "/^=name=/s,=name=$V8,s|<!--$V0\\1[?]-->|- \\2|," \ - -e "/^=Name=/s,=Name=$V8,s|<!--$V0\\1[?]-->|(\\2)|," \ - -e "/^=/d" -e "s|&|\\\\&|g" $INP # $++ + $SED -e "/^=....=formatter /d" -e "$piped_value" \ + -e "/^<$Q'name'>/s,<$Q'name'>$V9,s|<!--$V0\\1[?]-->|- \\2|," \ + -e "/^<$Q'Name'>/s,<$Q'Name'>$V9,s|<!--$V0\\1[?]-->|(\\2)|," \ + -e "/^<$Q'name'>/s,<$Q'name'>$V8,s|<!--$V0\\1[?]-->|- \\2|," \ + -e "/^<$Q'Name'>/s,<$Q'Name'>$V8,s|<!--$V0\\1[?]-->|(\\2)|," \ + -e "/^<$Q/d" -e "/^<!/d" -e "$amp_value" $INP # $++ test ".$expandvars" != ".no" && \ - $SED -e "/^=....=formatter /d" \ - -e "/^=text=/s,=text=$V9,s|<!--$V1\\1-->|\\\\1$SS\\2|," \ - -e "/^=Text=/s,=Text=$V9,s|<!--$V1\\1-->|\\\\1$SS\\2|," \ - -e "/^=name=/s,=name=$V9,s|<!--$V1\\1[?]-->|\\\\1$SS\\2|," \ - -e "/^=Name=/s,=Name=$V9,s|<!--$V1\\1[?]-->|\\\\1$SS\\2|," \ - -e "/^=text=/s,=text=$V8,s|<!--$V1\\1-->|\\\\1$SS\\2|," \ - -e "/^=Text=/s,=Text=$V8,s|<!--$V1\\1-->|\\\\1$SS\\2|," \ - -e "/^=name=/s,=name=$V8,s|<!--$V1\\1[?]-->|\\\\1$SS\\2|," \ - -e "/^=Name=/s,=Name=$V8,s|<!--$V1\\1[?]-->|\\\\1$SS\\2|," \ - -e "/^=/d" -e "s|&|\\\\&|g" $INP # $++ - test ".$simplevars" != ".no" && test ".$updatevars" != ".no" && \ - $SED -e "/^=....=formatter /d" \ - -e "/^=text=/s,=text=$V9,s|<!--$V0\\1:-->[$AX]*|\\2|," \ - -e "/^=Text=/s,=Text=$V9,s|<!--$V0\\1:-->[$AX]*|\\2|," \ - -e "/^=name=/s,=name=$V9,s|<!--$V0\\1[?]:-->[$AX]*|- \\2|," \ - -e "/^=Name=/s,=Name=$V9,s|<!--$V0\\1[?]:-->[$AX]*| (\\2) |," \ - -e "/^=text=/s,=text=$V8,s|<!--$V0\\1:-->[$AX]*|\\2|," \ - -e "/^=Text=/s,=Text=$V8,s|<!--$V0\\1:-->[$AX]*|\\2|," \ - -e "/^=name=/s,=name=$V8,s|<!--$V0\\1[?]:-->[$AX]*|- \\2|," \ - -e "/^=Name=/s,=Name=$V8,s|<!--$V0\\1[?]:-->[$AX]*| (\\2) |," \ - -e "/^=/d" -e "s|&|\\\\&|g" $INP # $++ + $SED -e "/^=....=formatter /d" -e "$piped_value" \ + -e "/^<$Q'text'>/s,<$Q'text'>$V9,s|<!--$V1\\1-->|\\\\1$SS\\2|," \ + -e "/^<$Q'Text'>/s,<$Q'Text'>$V9,s|<!--$V1\\1-->|\\\\1$SS\\2|," \ + -e "/^<$Q'name'>/s,<$Q'name'>$V9,s|<!--$V1\\1[?]-->|\\\\1$SS\\2|," \ + -e "/^<$Q'Name'>/s,<$Q'Name'>$V9,s|<!--$V1\\1[?]-->|\\\\1$SS\\2|," \ + -e "/^<$Q'text'>/s,<$Q'text'>$V8,s|<!--$V1\\1-->|\\\\1$SS\\2|," \ + -e "/^<$Q'Text'>/s,<$Q'Text'>$V8,s|<!--$V1\\1-->|\\\\1$SS\\2|," \ + -e "/^<$Q'name'>/s,<$Q'name'>$V8,s|<!--$V1\\1[?]-->|\\\\1$SS\\2|," \ + -e "/^<$Q'Name'>/s,<$Q'Name'>$V8,s|<!--$V1\\1[?]-->|\\\\1$SS\\2|," \ + -e "/^<$Q/d" -e "/^<!/d" -e "$amp_value" $INP # $++ test ".$updatevars" != ".no" && \ - $SED -e "/^=....=formatter /d" \ - -e "/^=name=/s,=name=$V9,s|<!--$V0\\1:[?]-->[^<>]*|- \\2|," \ - -e "/^=Name=/s,=Name=$V9,s|<!--$V0\\1:[?]-->[^<>]*| (\\2) |," \ - -e "/^=name=/s,=name=$V8,s|<!--$V0\\1:[?]-->[^<>]*|- \\2|," \ - -e "/^=Name=/s,=Name=$V8,s|<!--$V0\\1:[?]-->[^<>]*| (\\2) |," \ - -e "/^=/d" -e "s|&|\\\\&|g" $INP # $++ + $SED -e "/^=....=formatter /d" -e "$piped_value" \ + -e "/^<$Q'name'>/s,<$Q'name'>$V9,s|<!--$V0\\1:[?]-->[^<>]*|- \\2|," \ + -e "/^<$Q'Name'>/s,<$Q'Name'>$V9,s|<!--$V0\\1:[?]-->[^<>]*|(\\2)|," \ + -e "/^<$Q'name'>/s,<$Q'name'>$V8,s|<!--$V0\\1:[?]-->[^<>]*|- \\2|," \ + -e "/^<$Q'Name'>/s,<$Q'Name'>$V8,s|<!--$V0\\1:[?]-->[^<>]*|(\\2)|," \ + -e "/^<$Q/d" -e "/^<!/d" -e "$amp_value" $INP # $++ test ".$updatevars" != ".no" && \ - $SED -e "/^=....=formatter /d" \ - -e "/^=text=/s,=text=$V9,s|<!--$V1\\1:[=]-->[^<>]*|\\\\1$SS\\2|," \ - -e "/^=Text=/s,=Text=$V9,s|<!--$V1\\1:[=]-->[^<>]*|\\\\1$SS\\2|," \ - -e "/^=name=/s,=name=$V9,s|<!--$V1\\1:[?]-->[^<>]*|\\\\1$SS\\2|," \ - -e "/^=Name=/s,=Name=$V9,s|<!--$V1\\1:[?]-->[^<>]*|\\\\1$SS\\2|," \ - -e "/^=text=/s,=text=$V8,s|<!--$V1\\1:[=]-->[^<>]*|\\\\1$SS\\2|," \ - -e "/^=Text=/s,=Text=$V8,s|<!--$V1\\1:[=]-->[^<>]*|\\\\1$SS\\2|," \ - -e "/^=name=/s,=name=$V8,s|<!--$V1\\1:[?]-->[^<>]*|\\\\1$SS\\2|," \ - -e "/^=Name=/s,=Name=$V8,s|<!--$V1\\1:[?]-->[^<>]*|\\\\1$SS\\2|," \ - -e "/^=/d" -e "s|&|\\\\&|g" $INP # $++ + $SED -e "/^=....=formatter /d" -e "$piped_value" \ + -e "/^<$Q'text'>/s,<$Q'text'>$V9,s|<!--$V1\\1:[=]-->[^<>]*|\\\\1$SS\\2|," \ + -e "/^<$Q'Text'>/s,<$Q'Text'>$V9,s|<!--$V1\\1:[=]-->[^<>]*|\\\\1$SS\\2|," \ + -e "/^<$Q'name'>/s,<$Q'name'>$V9,s|<!--$V1\\1:[?]-->[^<>]*|\\\\1$SS\\2|," \ + -e "/^<$Q'Name'>/s,<$Q'Name'>$V9,s|<!--$V1\\1:[?]-->[^<>]*|\\\\1$SS\\2|," \ + -e "/^<$Q'text'>/s,<$Q'text'>$V8,s|<!--$V1\\1:[=]-->[^<>]*|\\\\1$SS\\2|," \ + -e "/^<$Q'Text'>/s,<$Q'Text'>$V8,s|<!--$V1\\1:[=]-->[^<>]*|\\\\1$SS\\2|," \ + -e "/^<$Q'name'>/s,<$Q'name'>$V8,s|<!--$V1\\1:[?]-->[^<>]*|\\\\1$SS\\2|," \ + -e "/^<$Q'Name'>/s,<$Q'Name'>$V8,s|<!--$V1\\1:[?]-->[^<>]*|\\\\1$SS\\2|," \ + -e "/^<$Q/d" -e "/^<!/d" -e "$amp_value" $INP # $++ test ".$attribvars" != ".no" && \ - $SED -e "/^=....=formatter /d" \ - -e "/^=text=/s,=text=$V9,s|<$V1{\\1:[=]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \ - -e "/^=Text=/s,=Text=$V9,s|<$V1{\\1:[=]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \ - -e "/^=name=/s,=name=$V9,s|<$V1{\\1:[?]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \ - -e "/^=Name=/s,=Name=$V9,s|<$V1{\\1:[?]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \ - -e "/^=text=/s,=text=$V8,s|<$V1{\\1:[=]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \ - -e "/^=Text=/s,=Text=$V8,s|<$V1{\\1:[=]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \ - -e "/^=name=/s,=name=$V8,s|<$V1{\\1:[?]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \ - -e "/^=Name=/s,=Name=$V8,s|<$V1{\\1:[?]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \ - -e "/^=/d" -e "s|&|\\\\&|g" $INP # $++ - test ".$simplevars" != ".no" && \ - $SED -e "/^=....=formatter /d" \ - -e "/^=text=/s,=text=$V9,s|<!--\\1-->[$AX]*|\\2|," \ - -e "/^=Text=/s,=Text=$V9,s|<!--\\1-->[$AX]*|\\2|," \ - -e "/^=name=/s,=name=$V9,s|<!--\\1[?]-->[$AX]*| - \\2|," \ - -e "/^=Name=/s,=Name=$V9,s|<!--\\1[?]-->[$AX]*| (\\2) |," \ - -e "/^=text=/s,=text=$V8,s|<!--\\1-->[$AX]*|\\2|," \ - -e "/^=Text=/s,=Text=$V8,s|<!--\\1-->[$AX]*|\\2|," \ - -e "/^=name=/s,=name=$V8,s|<!--\\1[?]-->[$AX]*| - \\2|," \ - -e "/^=Name=/s,=Name=$V8,s|<!--\\1[?]-->[$AX]*| (\\2) |," \ - -e "/^=/d" -e "s|&|\\\\&|g" $INP # $++ + $SED -e "/^=....=formatter /d" -e "$piped_value" \ + -e "/^<$Q'text'>/s,<$Q'text'>$V9,s|<$V1{\\1:[=]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \ + -e "/^<$Q'Text'>/s,<$Q'Text'>$V9,s|<$V1{\\1:[=]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \ + -e "/^<$Q'name'>/s,<$Q'name'>$V9,s|<$V1{\\1:[?]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \ + -e "/^<$Q'Name'>/s,<$Q'Name'>$V9,s|<$V1{\\1:[?]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \ + -e "/^<$Q'text'>/s,<$Q'text'>$V8,s|<$V1{\\1:[=]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \ + -e "/^<$Q'Text'>/s,<$Q'Text'>$V8,s|<$V1{\\1:[=]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \ + -e "/^<$Q'name'>/s,<$Q'name'>$V8,s|<$V1{\\1:[?]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \ + -e "/^<$Q'Name'>/s,<$Q'Name'>$V8,s|<$V1{\\1:[?]$V2}$V3>|<\\\\1$SS\\2\\\\3>|," \ + -e "/^<$Q/d" -e "/^<!/d" -e "$amp_value" $INP # $++ # if value="2004" then generated sed might be "\\12004" which is bad # instead we generate an edited value of "\\1$SS$value" and cut out # the spacer now after expanding the variable values: @@ -534,53 +546,54 @@ info2vars_sed () # generate <!--$vars--> substition sed addon script info2meta_sed () # generate <meta name..> text portion { # http://www.metatab.de/meta_tags/DC_type.htm - INP="$1" ; test ".$INP" = "." && INP="$tmp/$F.$INFO" - V6=" *HTTP[.]\\([^ ][^ ]*\\) \\(.*\\)" - V7=" *DC[.]\\([^ ][^ ]*\\) \\(.*\\)" - V8=" *\\([^ ][^ ]*\\) \\(.*\\)" - INFO_META_TYPE_SCHEME="name=\"DC.type\" content=\"\\2\" scheme=\"\\1\"" - INFO_META_DCMI="name=\"\\1\" content=\"\\2\" scheme=\"DCMIType\"" - INFO_META_NAME_TZ="name=\"\\1\" content=\"\\2 `timezone`\"" - INFO_META_NAME="name=\"\\1\" content=\"\\2\"" - INFO_META_HTTP="http-equiv=\"\\1\" content=\"\\2\"" + INP="$1" ; test ".$INP" = "." && INP="$tmp/$F.$DATA" + V6=" *HTTP[.]\\([^ ][^ ]*\\) \\(.*\\)<$QX>" + V7=" *DC[.]\\([^ ][^ ]*\\) \\(.*\\)<$QX>" + V8=" *\\([^ ][^ ]*\\) \\(.*\\)<$QX>" + DATA_META_TYPE_SCHEME="name=\"DC.type\" content=\"\\2\" scheme=\"\\1\"" + DATA_META_DCMI="name=\"\\1\" content=\"\\2\" scheme=\"DCMIType\"" + DATA_META_NAME_TZ="name=\"\\1\" content=\"\\2 `timezone`\"" + DATA_META_NAME="name=\"\\1\" content=\"\\2\"" + DATA_META_HTTP="http-equiv=\"\\1\" content=\"\\2\"" $SED -e "/=....=today /d" \ - -e "/=meta=HTTP[.]/s,=meta=$V6, <meta $INFO_META_HTTP />," \ - -e "/=meta=DC[.]DCMIType /s,=meta=$V7, <meta $INFO_META_TYPE_SCHEME />," \ - -e "/=meta=DC[.]type Collection$/s,=meta=$V8, <meta $INFO_META_DCMI />," \ - -e "/=meta=DC[.]type Dataset$/s,=meta=$V8, <meta $INFO_META_DCMI />," \ - -e "/=meta=DC[.]type Event$/s,=meta=$V8, <meta $INFO_META_DCMI />," \ - -e "/=meta=DC[.]type Image$/s,=meta=$V8, <meta $INFO_META_DCMI />," \ - -e "/=meta=DC[.]type Service$/s,=meta=$V8, <meta $INFO_META_DCMI />," \ - -e "/=meta=DC[.]type Software$/s,=meta=$V8, <meta $INFO_META_DCMI />," \ - -e "/=meta=DC[.]type Sound$/s,=meta=$V8, <meta $INFO_META_DCMI />," \ - -e "/=meta=DC[.]type Text$/s,=meta=$V8, <meta $INFO_META_DCMI />," \ - -e "/=meta=DC[.]date[.].*[+]/s,=meta=$V8, <meta $INFO_META_NAME />," \ - -e "/=meta=DC[.]date[.].*[:]/s,=meta=$V8, <meta $INFO_META_NAME_TZ />," \ - -e "/=meta=/s,=meta=$V8, <meta $INFO_META_NAME />," \ + -e "/<$Q'meta'>HTTP[.]/s,<$Q'meta'>$V6, <meta $DATA_META_HTTP />," \ + -e "/<$Q'meta'>DC[.]DCMIType /s,<$Q'meta'>$V7, <meta $DATA_META_TYPE_SCHEME />," \ + -e "/<$Q'meta'>DC[.]type Collection$/s,<$Q'meta'>$V8, <meta $DATA_META_DCMI />," \ + -e "/<$Q'meta'>DC[.]type Dataset$/s,<$Q'meta'>$V8, <meta $DATA_META_DCMI />," \ + -e "/<$Q'meta'>DC[.]type Event$/s,<$Q'meta'>$V8, <meta $DATA_META_DCMI />," \ + -e "/<$Q'meta'>DC[.]type Image$/s,<$Q'meta'>$V8, <meta $DATA_META_DCMI />," \ + -e "/<$Q'meta'>DC[.]type Service$/s,<$Q'meta'>$V8, <meta $DATA_META_DCMI />," \ + -e "/<$Q'meta'>DC[.]type Software$/s,<$Q'meta'>$V8, <meta $DATA_META_DCMI />," \ + -e "/<$Q'meta'>DC[.]type Sound$/s,<$Q'meta'>$V8, <meta $DATA_META_DCMI />," \ + -e "/<$Q'meta'>DC[.]type Text$/s,<$Q'meta'>$V8, <meta $DATA_META_DCMI />," \ + -e "/<$Q'meta'>DC[.]date[.].*[+]/s,<$Q'meta'>$V8, <meta $DATA_META_NAME />," \ + -e "/<$Q'meta'>DC[.]date[.].*[:]/s,<$Q'meta'>$V8, <meta $DATA_META_NAME_TZ />," \ + -e "/<$Q'meta'>/s,<$Q'meta'>$V8, <meta $DATA_META_NAME />," \ -e "/<meta name=\"[^\"]*\" content=\"\" /d" \ -e "/<meta http-equiv=\"[^\"]*\" content=\"\" /d" \ - -e "/^=/d" $INP # $++ + -e "/^<$Q/d" -e "/^<!/d" $INP # $++ } info_get_entry () # get the first <!--vars--> value known so far { TXT="$1" ; test ".$TXT" = "." && TXT="sect" - INP="$2" ; test ".$INP" = "." && INP="$tmp/$F.$INFO" - $SED -e "/=text=$TXT /!d" -e "s/=text=$TXT //" -e "q" $INP # $++ + INP="$2" ; test ".$INP" = "." && INP="$tmp/$F.$DATA" + $SED -e "/<$Q'text'>$TXT /!d" \ + -e "s|<$Q'text'>$TXT ||" -e "s|<$QX>||" -e "q" $INP # $++ } info1grep () # test for a <!--vars--> substition to be already present { TXT="$1" ; test ".$TXT" = "." && TXT="sect" - INP="$2" ; test ".$INP" = "." && INP="$tmp/$F.$INFO" - $GREP "^=text=$TXT " $INP >$NULL + INP="$2" ; test ".$INP" = "." && INP="$tmp/$F.$DATA" + $GREP "^<$Q'text'>$TXT " $INP >$NULL return $? } dx_init() { mkpathdir "$tmp" - dx_meta formatter `basename $opt_formatter` > "$tmp/$F.$INFO" + dx_meta formatter `basename $opt_formatter` > "$tmp/$F.$DATA" for opt in $opt_variables ; do case "$opt" in # commandline --def=value *_*) op_=`echo "$opt" | sed -e "y/_/-/"` # makes for <!--$def--> dx_meta "$op_" `eval echo "\\\$opt_$opt"` ;; @@ -590,7 +603,7 @@ dx_init() dx_line () { - echo "$1$2 "`trimmm "$3"` >> "$tmp/$F.$INFO" + echo "<$Q$1>$2 "`trimmm "$3"`"<$QX>" >> "$tmp/$F.$DATA" } DX_line () @@ -601,7 +614,7 @@ DX_line () dx_text () { - dx_line "=text=" "$1" "$2" + dx_line "'text'" "$1" "$2" } DX_text () # add a <!--vars--> substition includings format variants @@ -610,13 +623,13 @@ DX_text () # add a <!--vars--> substition includings format variants if test ".$N" != "." ; then if test ".$T" != "." ; then text=`echo "$T" | $SED -e "y/$UPPER/$LOWER/" -e "s/<[^<>]*>//g"` - dx_line "=text=" "$N" "$T" - dx_line "=name=" "$N" "$text" + dx_line "'text'" "$N" "$T" + dx_line "'name'" "$N" "$text" varname=`echo "$N" | $SED -e 's/.*[.]//'` # cut out front part if test ".$N" != ".$varname" ; then text=`echo "$varname $T" | $SED -e "y/$UPPER/$LOWER/" -e "s/<[^<>]*>//g"` - dx_line "=Text=" "$varname" "$T" - dx_line "=Name=" "$varname" "$text" + dx_line "'Text'" "$varname" "$T" + dx_line "'Name'" "$varname" "$text" fi fi fi @@ -624,25 +637,25 @@ DX_text () # add a <!--vars--> substition includings format variants dx_meta () { - DX_line "=meta=" "$1" "$2" + DX_line "'meta'" "$1" "$2" } DX_meta () # add simple meta entry and its <!--vars--> subsitution { - DX_line "=meta=" "$1" "$2" + DX_line "'meta'" "$1" "$2" DX_text "$1" "$2" } DC_meta () # add new DC.meta entry plus two <!--vars--> substitutions { - DX_line "=meta=" "DC.$1" "$2" + DX_line "'meta'" "DC.$1" "$2" DX_text "DC.$1" "$2" DX_text "$1" "$2" } HTTP_meta () # add new HTTP.meta entry plus two <!--vars--> substitutions { - DX_line "=meta=" "HTTP.$1" "$2" + DX_line "'meta'" "HTTP.$1" "$2" DX_text "HTTP.$1" "$2" DX_text "$1" "$2" } @@ -703,18 +716,18 @@ DC_publisher () # make sure there is this DC.publisher meta tag DC_modified () # make sure there is a DC.date.modified meta tag { # maybe choose from filesystem dates if possible - Q="$1" # target file + ZZ="$1" # target file if info1grep DC.date.modified ; then : else _42_chars="........................................." cut_42_55="s/^$_42_chars\\(.............\\).*/\\1/" # i.e.`cut -b 42-55` - text=`$STAT_R $Q 2>$NULL | $SED -e '/odify:/!d' -e 's|.*fy:||' -e q` + text=`$STAT_R $ZZ 2>$NULL | $SED -e '/odify:/!d' -e 's|.*fy:||' -e q` text=`echo "$text" | $SED -e "s/:..[.][$NN]*//"` text=`trimm "$text"` test ".$text" = "." && \ - text=`$DATE_R "$Q" +%Y-%m-%d 2>$NULL` # GNU sed + text=`$DATE_R "$ZZ" +%Y-%m-%d 2>$NULL` # GNU sed test ".$text" = "." && - text=`$LS_L "$Q" | $SED -e "$cut_42_55" -e "s/^ *//g" -e "q"` + text=`$LS_L "$ZZ" | $SED -e "$cut_42_55" -e "s/^ *//g" -e "q"` text=`echo "$text" | $SED -e "s/[$NN]*:.*//"` # cut way seconds DC_meta date.modified `trimm "$text"` fi @@ -722,26 +735,26 @@ DC_modified () # make sure there is a DC.date.modified meta tag DC_date () # make sure there is this DC.date meta tag { # choose from one of the available DC.date.* specials - Q="$1" # source file + ZZ="$1" # source file if info1grep DC.date then DX_text issue "dated `info_get_entry DC.date`" DX_text updated "`info_get_entry DC.date`" else text="" for kind in available issued modified created ; do text=`info_get_entry DC.date.$kind` - # test ".$text" != "." && echo "$kind = date = $text ($Q)" + # test ".$text" != "." && echo "$kind = date = $text ($ZZ)" test ".$text" != "." && break done if test ".$text" = "." ; then M="date" - part=`$SED -e "/<$M>/!d" -e "s|.*<$M>||" -e "s|</$M>.*||" -e q $Q` + part=`$SED -e "/<$M>/!d" -e "s|.*<$M>||" -e "s|</$M>.*||" -e q $ZZ` part=`trimm "$part"` text=`echo "$part" | $SED -e "s|^[$AA]*:||"` text=`trimm "$text"` fi if test ".$text" = "." ; then M="!--date:*=*--" # takeover updateable variable... - part=`$SED -e "/<$M>/!d" -e "s|.*<$M>||" -e "s|</.*||" -e q $Q` + part=`$SED -e "/<$M>/!d" -e "s|.*<$M>||" -e "s|</.*||" -e q $ZZ` part=`trimm "$part"` text=`echo "$part" | $SED -e "s|^[$AA]*:||" -e "s|\\&.*||"` text=`trimm "$text"` @@ -770,18 +783,18 @@ DC_title () { # choose a title for the document, either an explicit title-tag # or one of the section headers in the document or fallback to filename - Q="$1" # target file + ZZ="$1" # target file if info1grep DC.title ; then : else for M in TITLE title H1 h1 H2 h2 H3 H3 H4 H4 H5 h5 H6 h6 ; do - text=`$SED -e "/<$M>/!d" -e "s|.*<$M>||" -e "s|</$M>.*||" -e q $Q` + text=`$SED -e "/<$M>/!d" -e "s|.*<$M>||" -e "s|</$M>.*||" -e q $ZZ` text=`trimm "$text"` ; test ".$text" != "." && break MM="$M [^<>]*" - text=`$SED -e "/<$MM>/!d" -e "s|.*<$MM>||" -e "s|</$M>.*||" -e q $Q` + text=`$SED -e "/<$MM>/!d" -e "s|.*<$MM>||" -e "s|</$M>.*||" -e q $ZZ` text=`trimm "$text"` ; test ".$text" != "." && break done if test ".text" = "." ; then - text=`basename $Q .html` + text=`basename $ZZ .html` text=`basename $text .htm | $SED -e 'y/_/ /' -e "s/\\$/ info/"` fi term=`echo "$text" | $SED -e 's/.*[(]//' -e 's/[)].*//'` @@ -797,7 +810,9 @@ DC_title () site_get_section () # return parent section page of given page { _F_=`sed_slash_key "$1"` - $SED -e "/^=sect=$_F_ /!d" -e "s/^=sect=$_F_ //" -e q "$MK_INFO" # $++ + $SED -e "/^<$Q'sect'>$_F_ /!d" \ + -e "s|^<$Q'sect'>$_F_ ||" -e "s|<$QX>||" \ + -e q "$MK_DATA" # $++ } DC_section () # not really a DC relation (shall we use isPartOf ?) @@ -816,7 +831,9 @@ info_get_entry_section() site_get_selected () # return section of given page { _F_=`sed_slash_key "$1"` - $SED -e "/=use.=$_F_ /!d" -e "s/=use.=[^ ]* //" -e q "$MK_INFO" # $++ + $SED -e "/<$Q'use.'>$_F_ /!d" \ + -e "s|<$Q'use.'>[^ ]* ||" -e "s|<$QX>||" \ + -e q "$MK_DATA" # $++ } DC_selected () # not really a DC title (shall we use alternative ?) @@ -835,27 +852,33 @@ info_get_entry_selected () site_get_rootsections () # return all sections from root of nav tree { - $SED -e "/=use1=/!d" -e "s/=use.=\\([^ ]*\\) .*/\\1/" "$MK_INFO" # $++ + $SED -e "/^<$Q'use1'>/!d" \ + -e "s|^<$Q'use.'>\\([^ ]*\\) .*|\\1|" "$MK_DATA" # $++ } site_get_sectionpages () # return all children pages in the given section { _F_=`sed_slash_key "$1"` - $SED -e "/^=sect=[^ ]* $_F_\$/!d" -e "s/^=sect=//" \ - -e "s/ .*//" "$MK_INFO" # $++ + $SED -e "/^<$Q'sect'>[^ ]* $_F_<[^<>]*>\$/!d" \ + -e "s|^<$Q'sect'>||" -e "s|<$QX>||" \ + -e "s/ .*//" "$MK_DATA" # $++ } site_get_subpages () # return all page children of given page { _F_=`sed_slash_key "$1"` - $SED -e "/^=node=[^ ]* $_F_\$/!d" -e "s/^=node=//" -e "s/ .*//" "$MK_INFO" + $SED -e "/^<$Q'node'>[^ ]* $_F_<[^<>]*>\$/!d" \ + -e "s|^<$Q'node'>||" -e "s|<$QX>||" \ + -e "s/ .*//" "$MK_DATA" # $++ } site_get_parentpage () # return parent page for given page (".." for sections) { _F_=`sed_slash_key "$1"` - $SED -e "/^=node=$_F_ /!d" -e "s/^=node=[^ ]* //" -e "q" "$MK_INFO" # $++ + $SED -e "/^<$Q'node'>$_F_ /!d" \ + -e "s|^<$Q'node'>[^ ]* ||" -e "s|<$QX>||" \ + -e "q" "$MK_DATA" # $++ } DX_alternative () # detect wether page asks for alternative style @@ -912,97 +935,97 @@ fast_href () # args "$FILETOREFERENCE" "$FROMCURRENTFILE:$F" fi fi } -make_fast () # experimental - make a FAST file that can be applied -{ # to htm sourcefiles in a subdirectory of the sitefile. -# R="$1" ; test ".$R" = "." && R="$F" - S=`back_path "$F"` - if test ".$S" = "" ; then - # echo "backpath '$F' = none needed" - $CATNULL # $++ - else - # echo "backpath '$F' -> '$S'" - $SED -e "/href=\"[^\"]*\"/!d" -e "s/.*href=\"//" -e "s/\".*//" \ - -e "/^ *\$/d" -e "/^\\//d" -e "/^[.][.]/d" -e "/^[$AA]*:/d" \ - $SITEFILE $SOURCEFILE | sort | uniq \ - | $SED -e "s,.*,s|href=\"&\"|href=\"$S&\"|," # $++ +make_back_path () # "$FILE" +{ + R="$1" ; test ".$R" = "." && R="$F" + S=`back_path "$R"` + if test ".$S" != "." ; then + echo "s|\\(<[^<>]* href=\\\"\\)\\([$AA][^<>:]*\\\"[^<>]*>\\)|\\1$S\\2|g" + echo "s|\\(<[^<>]* src=\\\"\\)\\([$AA][^<>:]*\\\"[^<>]*>\\)|\\1$S\\2|g" fi } -# ============================================================== SITE MAP INFO +# ============================================================== SITE MAP DATA # each entry needs atleast a list-title, a long-title, and a list-date # these are the basic information to be printed in the sitemap file # where it is bound the hierarchy of sect/subsect of the entries. site_map_list_title() # $file $text { - echo "=list=$1 $2" >> "$MK_INFO" + echo "<$Q'list'>$1 $2<$QX>" >> "$MK_DATA" } info_map_list_title() # $file $text { - echo "=list=$2" >> "$tmp/$1.$INFO" + echo "<$Q'list'>$2<$QX>" >> "$tmp/$1.$DATA" } site_map_long_title() # $file $text { - echo "=long=$1 $2" >> "$MK_INFO" + echo "<$Q'long'>$1 $2<$QX>" >> "$MK_DATA" } info_map_long_title() # $file $text { - echo "=long=$2" >> "$tmp/$1.$INFO" + echo "<$Q'long'>$2<$QX>" >> "$tmp/$1.$DATA" } site_map_list_date() # $file $text { - echo "=date=$1 $2" >> "$MK_INFO" + echo "<$Q'date'>$1 $2<$QX>" >> "$MK_DATA" } info_map_list_date() # $file $text { - echo "=date=$2" >> "$tmp/$1.$INFO" + echo "<$Q'date'>$2<$QX>" >> "$tmp/$1.$DATA" } siteinfo2sitemap () # generate <name><page><date> addon sed scriptlet { # the resulting script will act on each item/line # containing <!--"filename"--> and expand any following # reference of <!--name--> or <!--date--> or <!--long--> - INP="$1" ; test ".$INP" = "." && INP="$MK_INFO" - _list_="s|<!--\"\\1\"-->.*<!--name-->|\\&<name href=\"\\1\">\\2</name>|" - _date_="s|<!--\"\\1\"-->.*<!--date-->|\\&<date>\\2</date>|" - _long_="s|<!--\"\\1\"-->.*<!--long-->|\\&<long>\\2</long>|" + INP="$1" ; test ".$INP" = "." && INP="$MK_DATA" + _list_="s|\\\\(<!--\"\\1\"-->.*\\\\)<name href=[^<>]*>.*</name>|\\\\1<name href=\"\\1\">\\2</name>|" + _date_="s|\\\\(<!--\"\\1\"-->.*\\\\)<date>.*</date>|\\\\1<date>\\2</date>|" + _long_="s|\\\\(<!--\"\\1\"-->.*\\\\)<long>.*</long>|\\\\1<long>\\2</long>|" $SED -e "s:&:\\\\&:g" \ - -e "s:=list=\\([^ ]*\\) \\(.*\\):$_list_:" \ - -e "s:=date=\\([^ ]*\\) \\(.*\\):$_date_:" \ - -e "s:=long=\\([^ ]*\\) \\(.*\\):$_long_:" \ + -e "s:<$Q'list'>\\([^ ]*\\) \\(.*\\)<$QX>:$_list_:" \ + -e "s:<$Q'date'>\\([^ ]*\\) \\(.*\\)<$QX>:$_date_:" \ + -e "s:<$Q'long'>\\([^ ]*\\) \\(.*\\)<$QX>:$_long_:" \ -e "/^s|/!d" $INP # $++ } make_multisitemap () { # each category gets its own column along with the usual entries - INPUTS="$1" ; test ".$INPUTS" = "." && INPUTS="$MK_INFO" + INPUTS="$1" ; test ".$INPUTS" = "." && INPUTS="$MK_DATA" siteinfo2sitemap > "$MK_SITE" # have <name><long><date> addon-sed - _form_="<!--\"\\2\"--><!--use\\1--><!--long--><!--end\\1-->" - _form_="$_form_<br><!--name--><!--date-->" + _form_="<!--\"\\2\"--><!--use\\1--><long>\\3</long><!--end\\1-->" + _form_="$_form_<br><name href=\"\\2\">\\3</name><date>......</date>" _tiny_="small><small><small" ; _tinyX_="small></small></small " _tabb_="<br><$_tiny_> </$_tinyX_>" ; _bigg_="<big> </big>" echo "<table width=\"100%\"><tr><td> " # $++ - $SED -e "/=use.=/!d" -e "s|=use\\(.\\)=\\([^ ]*\\) .*|$_form_|" \ + $SED -e "/^<$Q'[Uu]se.'>/!d" \ + -e "/>[$AZ$az][$AZ$az][$AZ$az][$AZ$az]*:/d" \ + -e "s|^<$Q'[Uu]se\\(.\\)'>\\([^ ]*\\) \\(.*\\)<$QX>|$_form_|" \ -f "$MK_SITE" -e "/<name/!d" \ -e "s|<!--use1-->|</td><td valign=\"top\"><b>|" \ -e "s|<!--end1-->|</b>|" \ -e "s|<!--use2-->|<br>|" \ -e "s|<!--use.-->|<br>|" -e "s/<!--[^<>]*-->/ /g" \ - -e "s|<long>||" -e "s|</long>||" \ -e "s|<name |<$_tiny_><a |" -e "s|</name>||" \ - -e "s|<date>| |" -e "s|</date>|</a><br></$_tinyX_>|" \ + -e "s|<date>|<small style=\"date\">|" \ + -e "s|</date>|</small></a><br></$_tinyX_>|" \ + -e "s|<long>|<!--long-->|" -e "s|</long>|<!--/long-->|" \ $INPUTS # $++ echo "</td><tr></table>" # $++ } make_listsitemap () { # traditional - the body contains a list with date and title extras - INPUTS="$1" ; test ".$INPUTS" = "." && INPUTS="$MK_INFO" + INPUTS="$1" ; test ".$INPUTS" = "." && INPUTS="$MK_DATA" siteinfo2sitemap > "$MK_SITE" # have <name><long><date> addon-sed - _form_="<!--\"\\2\"--><!--use\\1--><!--name--><!--date--><!--long-->" + _form_="<!--\"\\2\"--><!--use\\1--><name href=\"\\2\">\\3</name>" + _form_="$_form_<date>......</date><long>\\3</long>" _tabb_="<td>\\ \\;</td>" echo "<table cellspacing=\"0\" cellpadding=\"0\">" # $++ - $SED -e "/=use.=/!d" -e "s|=use\\(.\\)=\\([^ ]*\\) .*|$_form_|" \ + $SED -e "/^<$Q'[Uu]se.'>/!d" \ + -e "/>[$AZ$az][$AZ$az][$AZ$az][$AZ$az]*:/d" \ + -e "s|^<$Q'[Uu]se\\(.\\)'>\\([^ ]*\\) \\(.*\\)<$QX>|$_form_|" \ -f "$MK_SITE" -e "/<name/!d" \ -e "s|<!--use\\(1\\)-->|<tr class=\"listsitemap\\1\"><td>*</td>|" \ -e "s|<!--use\\(2\\)-->|<tr class=\"listsitemap\\1\"><td>-</td>|" \ @@ -1011,11 +1034,13 @@ make_listsitemap () -e "s|<!--[^<>]*-->| |g" \ -e "s|<name href=\"name:sitemap:|<name href=\"|" \ -e "s|<name |<td><a |" -e "s|</name>|</a></td>$_tabb_|" \ - -e "s|<date>|<td><small>|" -e "s|</date>|</small></td>$_tabb_|" \ - -e "s|<long>|<td><em>|" -e "s|</long>|</em></td></tr>|" \ - $INPUTS # $++ - for xx in `grep "=use.=name:sitemap:" $INPUTS` ; do - xx=`echo $xx | sed -e "s/=use.=name:sitemap://"` + -e "s|<date>|<td><small style=\"date\">|" \ + -e "s|</date>|</small></td>$_tabb_|" \ + -e "s|<long>|<td><em><!--long-->|" \ + -e "s|</long>|<!--/long--></em></td></tr>|" \ + "$INPUTS" # $++ + for xx in `grep "^<$Q'use.'>name:sitemap:" $INPUTS` ; do + xx=`echo $xx | sed -e "s/^<$Q'use.'>name:sitemap://" -e "s|<$QX>||"` if test -f "$xx" ; then grep "<tr.class=\"listsitemap[$NN]\">" $xx # $++ fi @@ -1023,6 +1048,26 @@ make_listsitemap () echo "</table>" # $++ } +_xi_include_=`echo \ + "<xi:include xmlns:xi=\"http://www.w3.org/2001/XInclude\" parse=\"xml\""` +make_xmlsitemap () +{ # traditional - the body contains a list with date and title extras + INPUTS="$1" ; test ".$INPUTS" = "." && INPUTS="$MK_DATA" + siteinfo2sitemap > "$MK_SITE" # have <name><long><date> addon-sed + _form_="<!--\"\\2\"--><name href=\"\\2\">\\3</name>" + _sitefile_=`sed_slash_key "$SITEFILE"` + $SED -e "/^<$Q'[Uu]se.'>/!d" \ + -e "/>[$AZ$az][$AZ$az][$AZ$az][$AZ$az]*:/d" \ + -e "s|^<$Q'[Uu]se\\(.\\)'>\\([^ ]*\\) \\(.*\\)<$QX>|$_form_|" \ + -f "$MK_SITE" -e "/<name/!d" \ + -e "/${_sitefile_}/d" \ + -e "/${_sitefile_}l/d" \ + -e "s|\\(href=\"[^<>]*\\)\\.html\\(\"\\)|\\1.xml\\2|g" \ + -e "s|.*<name|$_xi_include_\\n |" \ + -e "s|>.*</name>| />|" \ + "$INPUTS" # $++ +} + print_extension () { ARG="$1" ; test ".$ARG" = "." && ARG="$opt_print" @@ -1031,14 +1076,31 @@ print_extension () *) echo ".print" ;; # $++ esac } + +from_sourcefile () +{ + if test -f "$1" + then echo "$1" + elif test -f "$opt_srcdir/$1" + then echo "$opt_srcdir/$1" + else echo "$1" + fi +} html_sourcefile () # generally just cut away the trailing "l" (ell) { # making "page.html" argument into "page.htm" return + # (as a new addtion the source may be in ".dbk" xml) _SRCFILE_=`echo "$1" | $SED -e "s/l\\$//"` - if test -f "$_SRCFILE_" ; then echo "$_SRCFILE_" # $++ + _XMLFILE_=`echo "$1" | $SED -e "s/\\.html/.dbk/"` + if test -f "$_SRCFILE_" + then echo "$_SRCFILE_" # $++ + elif test -f "$_XMLFILE_" + then echo "$_XMLFILE_" # $++ elif test -f "$opt_src_dir/$_SRCFILE_" - then echo "$opt_src_dir/$_SRCFILE_" # $++ - else echo ".//$_SRCFILE_" # $++ + then echo "$opt_src_dir/$_SRCFILE_" # $++ + elif test -f "$opt_src_dir/$_XMLFILE_" + then echo "$opt_src_dir/$_XMLFILE_" # $++ + else echo ".//$_SRCFILE_" # $++ (not found?) fi } html_printerfile_sourcefile () @@ -1123,11 +1185,11 @@ make_current_entry () # $sect $file ## requires $MK_SITE S="$1" ; R="$2" SSS=`sed_slash_key "$S"` sep=" - " ; _left_=" [ " ; _right_=" ] " - echo_current_line "$S" "<a href=\"$R\"><!--\"$R\"--><!--name--></a>$sep" \ - | $SED -f "$MK_SITE" -e "s/<name[^<>]*>//" -e "s/<\\/name>//" \ + echo_current_line "$S" "<!--\"$R\"--><name href=\"$R\">$R</name>$sep" \ + | $SED -f "$MK_SITE" \ + -e "s|<!--[^<>]*--><name |<a |" -e "s|</name>|</a>|" \ -e "/<a href=\"$SSS\"/s/<a href/$_left_&/" \ - -e "/<a href=\"$SSS\"/s/<\\/a>/&$_right_/" \ - -e "s/<!--\"[^\"]*\"--><!--name-->//" # $+++ + -e "/<a href=\"$SSS\"/s/<\\/a>/&$_right_/" # $+++ } echo_subpage_line () # $sect $extra { @@ -1139,18 +1201,22 @@ make_subpage_entry () S="$1" ; R="$2" RR=`sed_slash_key "$R"` sep=" - " ; - echo_subpage_line "$S" "<a href=\"$R\"><!--\"$R\"--><!--name--></a>$sep" \ - | $SED -f "$MK_SITE" -e "s/<name[^<>]*>//" -e "s/<\\/name>//" \ - -e "s/<!--\"[^\"]*\"--><!--name-->//" # $+++ + echo_subpage_line "$S" "<!--\"$R\"--><name href=\"$R\">$R</name>$sep" \ + | $SED -f "$MK_SITE" \ + -e "s|<!--[^<>]*--><name |<a |" -e "s|</name>|</a>|" # $+++ } make_printsitefile () { # building the printsitefile looks big but its really a loop over sects - INPUTS="$1" ; test ".$INPUTS" = "." && INPUTS="$MK_INFO" + INPUTS="$1" ; test ".$INPUTS" = "." && INPUTS="$MK_DATA" siteinfo2sitemap > "$MK_SITE" # have <name><long><date> addon-sed - make_printsitefile_head $SITEFILE # $++ + if test -d DEBUG && test -f "$MK_SITE" + then FFFF=`echo "$F" | sed -e "s,/,:,g"` + cp "$MK_DATA" "DEBUG/$FFFF.SITE.tmp.sed" + fi + make_printsitefile_head $SITEFILE # $++ sep=" - " _sect1="<a href=\"#.\" title=\"section\">$printsitefile_img_1</a> ||$sep" _sect2="<a href=\"#.\" title=\"topics\">$printsitefile_img_2</a> ||$sep" @@ -1240,6 +1306,418 @@ body_for_emailfooter () echo "$_dated_</td></tr></table>" } +# =================================================================== CSS +# There was another project to support sitemap build from xml files. +# The source format was using .dbk+xml with embedded references to .css +# files for visual preview in a browser. An docbook xml file with semantic +# outlines is far better suited for quality documentation than any html +# source. It happens that the xml/css support in browsers is still not +# very portable - especially embedded css style blocks are a nightmare. +# Instead we (a) grab all non-html xml markup tags (b) grab all referenced +# css stylesheets (c) cut out css defs from [b] that are known by [a] and +# (d) append those to the <style> tag in the output html file as well as +# (e) reformatting the defs as well as markups from tags to tag classes. +# Input dbk/htm +# <?xml-stylesheet type="text/css" href="html.css" ?> <!-- dbk/xml --> +# <link rel="stylesheet" type="text/css" href="sdocbook.css" /> <!-- xhtml --> +# <article><para> +# Using some <command>exe</command> +# </para></article> +# Input css: +# article { .. ; display : block } +# para { .. ; display : block } +# command { .. ; display : inline } +# Output html: +# <html><style type="text/css"> +# div .article { .. } +# div .para { .. } +# span .command { .. } +# </style> +# <div class="article"><div class="para> +# Using some <span class="command">exe</span> +# </div></div> + +css_sourcefile () +{ + if test -f "$1" ; then echo "$1" + elif test -f "$opt_src_dir/$1" ; then echo "$opt_src_dir/$1" + elif echo "$1" | grep "^/" > $NULL ; then echo "$1" + else echo "./$1" + fi +} + +css_xmltags () # $SOURCEFILE +{ + X=`echo $SOURCEFILE | sed -e "y:/:~:"` + S="$SOURCEFILE" + cat "$S" | $SED -e "s|>[^<>]*<|><|g" -e "s|^[^<>]*<|<|" \ + -e "s|>[^<>]*\$|>|" -e "s|<|\\n|g" \ + | $SED -e "/^\\//d" -e "/^ *\$/d" -e "/>/!d" -e "s|>.*||" \ + | sort | uniq > "$tmp/$MK.$X.xmltags.tmp.txt" +} + +css_xmlstyles () # $SOURCEFILE +{ + X=`echo $SOURCEFILE | sed -e "y:/:~:"` + S="$SOURCEFILE" + cat "$S" "$SITEFILE" \ + | sed \ + -e "s|<link *rel=['\"]*stylesheet|<?xml-stylesheet |" \ + -e "/<.xml-stylesheet/!d" -e "/href/!N" -e "/href/!N" \ + -e "s|^.*<.xml-stylesheet||" -e 's|^.*href="||' -e 's|".*||' \ + | sort | uniq > "$tmp/$MK.$X.xmlstylesheets.tmp.txt" +} + +css_xmlstyles_sed () # $SOURCEFILE +{ + X=`echo $SOURCEFILE | sed -e "y:/:~:"` + S="$tmp/$MK.$X.xmltags.tmp.txt" + R="$tmp/$MK.$X.xmltags.tmp.sed" + rm -f "$R" + { + for x in 1 2 3 4 5 6 7 8 9 ; do echo "/}/d" ; echo "/{/!N" ; done + echo "s|\\r||g" + $SED "/^[$AZ$az$NN]/!d" "$S" | { while read xmltag ; do + xmltag=`echo "$xmltag" | sed -e "s/ .*//"` + _xmltag=`sed_slash_key "$xmltag"` + if echo " title section " | grep " $xmltag " > $NULL ; then + test "$xmltag" = "section" && continue; + echo "/^ *$_xmltag *[,\\n{]/bfound" >> "$R" + echo "/[,\\n] *$_xmltag *[,\\n{]/bfound" >> "$R" + $SED "/^[$AZ$az$NN]/!d" "$S" | { while read xmlparent ; do + xmlparent=`echo "$xmlparent" | sed -e "s/ .*//"` + _xmlparent=`sed_slash_key "$xmlparent"` + echo "/^ *$_xmlparent *$_xmltag *[,\\n{]/bfound" + echo "/[ ,\\n] *$_xmlparent *$_xmltag *[,\\n{]/bfound" + done } + else + echo "/^ *$_xmltag *[ ,\\n{]/bfound" + echo "/[ ,\\n] *$_xmltag *[ ,\\n{]/bfound" + fi + done } + echo "d" ; echo ":found" + for x in 1 2 3 4 5 6 7 8 9 ; do echo "/}/!N" ; done + $SED "/^[$AZ$az$NN]/!d" "$S" | { while read xmltag ; do + xmltag=`echo "$xmltag" | sed -e "s/ .*//"` + if echo " $HTMLTAGS $HTMLTAGS2" | grep " $xmltag " > $NULL ; then + continue # keep html tags + fi + echo "s|^\\( *\\)\\($xmltag *[ ,\\n{]\\)|\\1.\\2|g" + echo "s|\\([ ,\\n] *\\)\\($xmltag *[ ,\\n{]\\)|\\1.\\2|g" + done } + } > "$R" +} + +css_xmltags_css () # $SOURCEFILE +{ + X=`echo $SOURCEFILE | sed -e "y:/:~:"` + S="$tmp/$MK.$X.xmltags.tmp.sed" + R="$tmp/$MK.$X.xmltags.tmp.css" + { + cat "$tmp/$MK.$X.xmlstylesheets.tmp.txt" | { while read xmlstylesheet ; do + stylesheet=`css_sourcefile "$xmlstylesheet"` + if test -f "$stylesheet" ; then + echo "/* $xmlstylesheet */" + cat "$stylesheet" | $SED -f "$S" + else + error "$xmlstylesheet : ERROR, no such stylesheet" + fi + done } + } > "$R" +} + +css_xmlmapping_sed () # $SOURCEFILE +{ + X=`echo $SOURCEFILE | sed -e "y:/:~:"` + S="$tmp/$MK.$X.xmltags.tmp.txt" + R="$tmp/$MK.$X.xmlmapping.tmp.sed" + rm -f "$R" + { + for x in 1 2 3 4 5 6 7 8 9 ; do echo "/}/d" ; echo "/{/!N" ; done + echo "s|\\r||g" + $SED "/^[$AZ$az$NN]/!d" "$S" | { while read xmltag ; do + xmltag=`echo "$xmltag" | sed -e "s/ .*//"` + xmltag=`sed_slash_key "$xmltag"` + echo "/^ *\\.$xmltag *[ ,\\n{]/bfound" + echo "/[ ,\\n] *\\.$xmltag *[,\\n{]/bfound" + done } + echo "d" ; echo ":found" + for x in 1 2 3 4 5 6 7 8 9 ; do echo "/}/!N" ; done + echo "s/^/>>/" + echo "/[\\n ]display *: *list-item/s|^.*>>|li>>|" + echo "/[\\n ]display *: *table-caption/s|^.*>>|caption>>|" + echo "/[\\n ]display *: *table-cell/s|^.*>>|td>>|" + echo "/[\\n ]display *: *table-row/s|^.*>>|tr>>|" + echo "/[\\n ]display *: *table/s|^.*>>|table>>|" + echo "/[\\n ]display *: *block/s|^.*>>|div>>|" + echo "/[\\n ]display *: *inline/s|^.*>>|span>>|" + echo "/[\\n ]display *: *none/s|^.*>>|small>>|" + echo "/^div>>.*[\\n ]list-style-type *: *disc/s|^.*>>|ul>>|" + echo "/^div>>.*[\\n ]list-style-type *: *decimal/s|^.*>>|ol>>|" + echo "/^span>>.*[\\n ]font-family *: *monospace/s|^.*>>|tt>>|" + echo "/^span>>.*[\\n ]font-style *: *italic/s|^.*>>|em>>|" + echo "/^span>>.*[\\n ]font-weight *: *bold/s|^.*>>|b>>|" + echo "/^div>>.*[\\n ]white-space *: *pre/s|^.*>>|pre>>|" + echo "/^div>>.*[\\n ]margin-left *: *[$NN]/s|^.*>>|blockquote>>|" + $SED "/^[$AZ$az$NN]/!d" "$S" | { while read xmltag ; do + xmltag=`echo "$xmltag" | sed -e "s/ .*//"` + echo "s|^\\(.*\\)>> *\\.$xmltag *[ ,\\n{].*|\\1 .$xmltag|" + echo "s|^\\(.*\\)>>.*[ ,\\n] *\\.$xmltag *[ ,\\n{].*|\\1 .$xmltag|" + done } + echo "s/^div \\.para\$/p .para/" + echo "s/^span \\.ulink\$/a .ulink/" + } > "$R" +} + +css_xmlmapping () # $SOURCEFILE +{ + X=`echo $SOURCEFILE | sed -e "y:/:~:"` + cat "$tmp/$MK.$X.xmltags.tmp.css" | \ + $SED -f "$tmp/$MK.$X.xmlmapping.tmp.sed" \ + > "$tmp/$MK.$X.xmlmapping.tmp.txt" +} + +css_scan() # $SOURCEFILE +{ + css_xmltags + css_xmlstyles + css_xmlstyles_sed + css_xmltags_css + css_xmlmapping_sed + css_xmlmapping +} + +tags2span_sed() # $SOURCEFILE > $++ +{ + X=`echo $SOURCEFILE | sed -e "y:/:~:"` + S="$tmp/$MK.$X.xmltags.tmp.txt" + R="$tmp/$MK.$X.xmltags.tmp.css" + echo "s|<[?]xml-stylesheet[^<>]*[?]>||" + echo "s|<link *rel=['\"]*stylesheet[^<>]*>||" + echo "s|<section[^<>]*>||g" + echo "s|</section>||g" + $SED "/^[$AZ$az$NN]/!d" "$S" | { while read xmltag ; do + # note "xmltag=$xmltag" + xmltag=`echo "$xmltag" | sed -e "s/ .*//"` + if echo " $HTMLTAGS $HTMLTAGS2" | grep " $xmltag " > $NULL ; then + continue # keep html tags + fi + _xmltag=`sed_slash_key "$xmltag"` + _span_=`$SED -e "/ \\.$_xmltag\$/!d" -e "s/ .*//" -e q \ + < "$tmp/$MK.$X.xmlmapping.tmp.txt"` + test ".$_span_" = "." && _span_="span" + _xmltag=`sed_piped_key "$xmltag"` + echo "s|<$xmltag\\([\\n\\t ][^<>]*\\)url=|<$_span_ class=\"$xmltag\"\\1href=|g" + echo "s|<$xmltag\\([\\n\\t >]\\)|<$_span_ class=\"$xmltag\"\\1|g" + echo "s|</$xmltag\\([\\n\\t >]\\)|</$_span_\\1|g" + done } + cat "$tmp/$MK.$X.xmlstylesheets.tmp.txt" | { while read xmlstylesheet ; do + if test -f "$xmlstylesheet" ; then + R="[^<>]*href=['"'"'"]$xmlstylesheet['"'"'"][^<>]*" + echo "s|<[?]xml-stylesheet$R>||" + echo "s|<link[^<>]* rel=['"'"'"]*stylesheet['"'"'" ]$R>||" + fi + done } +} + +tags2meta_sed() # $SOURCEFILE > $++ +{ + X=`echo $SOURCEFILE | sed -e "y:/:~:"` + S="$tmp/$MK.$X.xmlstylesheets.tmp.txt" + R="$tmp/$MK.$X.xmltags.tmp.css" + cat "$tmp/$MK.$X.xmlstylesheets.tmp.txt" | { while read xmlstylesheet ; do + if test -f "$xmlstylesheet" ; then + echo " <style type=\"text/css\"><!--" + $SED -e "s/^/ /" < "$R" + echo " --></style>" + break + fi + done } +} + +# ========================================================================== +# xml/docbook support is taking an dbk input file converting any html DBK +# syntax into pure docbook tagging. Each file is being given a docbook +# doctype so that an xml/docbook viewer can render it correctly - that +# is needed atleast since docbook files do not embed stylesheet infos. +# Most of the processing is related to remap html markup and some other +# shortcut markup into correct docbook markup. The result is NOT checked +# for being well-formed or even matching the docbook schema DTD at all. + +scan_xml_rootnode () +{ + rootnode=`cat "$SOURCEFILE" | \ + $SED -e "/<[$AZ$az$NN]/!d" -e "s/<\\([$AZ$az$NN]*\\).*/\\1/" -e q` + echo "<$Q'root'>$F $rootnode<$QX>" >> "$MK_DATA" +} + +get_xml_rootnode () +{ + _file_=`sed_slash_key "$F"` + $SED -e "/^<$Q'root'>$_file_ /!d" \ + -e "s|.* ||" -e "s|<.*||" -e q "$MK_DATA" # + +} + +xml_sourcefile () +{ + _XMLFILE_=`echo "$1" | $SED -e "s/\\.xml\\$/.dbk/"` + _SRCFILE_=`echo "$1" | $SED -e "s/\\.xml\\$/.htm/"` + test "$1" = "$_XMLFILE_" && _XMLFILE_="///" + test "$1" = "$_SRCFILE_" && _SRCFILE_="///" + if test -f "$_XMLFILE_" + then echo "$_XMLFILE_" # $++ + elif test -f "$_SRCFILE_" + then echo "$_SRCFILE_" # $++ + elif test -f "$opt_src_dir/$_XMLFILE_" + then echo "$opt_src_dir/$_XMLFILE_" # $++ + elif test -f "$opt_src_dir/$_SRCFILE_" + then echo "$opt_src_dir/$_SRCFILE_" # $++ + else echo ".//$_XMLFILE_" # $++ (not found?) + fi +} + +scan_xmlfile() +{ + SOURCEFILE=`xml_sourcefile "$F"` + $hint "'$SOURCEFILE': scanning xml -> '$F'" + scan_xml_rootnode + rootnode=`get_xml_rootnode | sed -e "/^h[$NN]/s|\$| <?section?>|"` + $hint "'$SOURCEFILE': rootnode ('$rootnode')" +} + +make_xmlfile() +{ + SOURCEFILE=`xml_sourcefile "$F"` + X=`echo $SOURCEFILE | sed -e "y:/:~:"` + article=`get_xml_rootnode` + test ".$article" = "." && article="article" + echo '<!DOCTYPE '$article' PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"' \ + > "$F" + echo ' "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">' \ + >> "$F" + cat "$tmp/$MK.$X.xmlstylesheets.tmp.txt" | { while read stylesheet ; do + echo "<?xml-stylesheet type=\"text/css\" href=\"$stylesheet\" ?>" \ + >> "$F" + done } + __secinfo="\\1<sectioninfo>\\2</sectioninfo>" + cat "$SOURCEFILE" | $SED \ + -e "s!<>!\ \;!g" \ + -e "s!\\(&\\)\\(&\\)!\\1amp;\\2amp;!g" \ + -e "s!\\(<[^<>]*\\)\\(width\\)\\(=\\)\\([$NN]*\%*\\)!\\1\\2\\3\"\\4\"!g" \ + -e "s!\\(<[^<>]*\\)\\(cellpadding\\)\\(=\\)\\([$NN]*\%*\\)!\\1\\2\\3\"\\4\"!g" \ + -e "s!\\(<[^<>]*\\)\\(border\\)\\(=\\)\\([$NN]*\%*\\)!\\1\\2\\3\"\\4\"!g" \ + -e "s!<[?]xml-stylesheet[^<>]*>!!" \ + -e "s!<link[^<>]* rel=[\'\"]*stylesheet[^<>]*>!!" \ + -e "s!<[hH][$NN]!<title!g" \ + -e "s!</[hH][$NN]!</title!g" \ + -e "s!\\(</title> *\\)\\([^<>]*[$AZ$az$NN][^<>\r\n]*\\)\$!\\1<sub>\\2</sub>!" \ + -e "s!\\(</title>.*\\)<sub>!\\1<subtitle>!g" \ + -e "s!\\(</title>.*\\)</sub>!\\1</subtitle>!g" \ + -e "s!\\(<section>[^<>]*\\)\\(<date>.*</date>[^<>]*\\)\$!\\1<sectioninfo>\\2</sectioninfo>!g" \ + -e "s!<em>!<emphasis>!g" \ + -e "s!</em>!</emphasis>!g" \ + -e "s!<i>!<emphasis>!g" \ + -e "s!</i>!</emphasis>!g" \ + -e "s!<b>!<emphasis role=\"bold\">!g" \ + -e "s!</b>!</emphasis>!g" \ + -e "s!<u>!<emphasis role=\"underline\">!g" \ + -e "s!</u>!</emphasis>!g" \ + -e "s!<big>!<emphasis role=\"strong\">!g" \ + -e "s!</big>!</emphasis>!g" \ + -e "s!<\\(strike\\)>!<emphasis role=\"strikethrough\">!g" \ + -e "s!<\\(s\\)>!<emphasis role=\"strikethrough\">!g" \ + -e "s!</\\(strike\\)>!</emphasis>!g" \ + -e "s!</\\(s\\)>!</emphasis>!g" \ + -e "s!<center>!<blockquote><para>!g" \ + -e "s!</center>!</para></blockquote>!g" \ + -e "s!<p align=\\(\"[$AZ$az$NN]*\"\\)>!<para role=\\1>!g" \ + -e "s!<[pP]>!<para>!g" \ + -e "s!</[pP]>!</para>!g" \ + -e "s!<\\(pre\\)>!<screen>!g" \ + -e "s!<\\(PRE\\)>!<screen>!g" \ + -e "s!</\\(pre\\)>!</screen>!g" \ + -e "s!</\\(PRE\\)>!</screen>!g" \ + -e "s!<a\\( [^<>]*\\)name=\\([^<>]*\\)/>!<anchor \\1id=\\2/>!g" \ + -e "s!<a\\( [^<>]*\\)name=\\([^<>]*\\)>!<anchor \\1id=\\2/>!g" \ + -e "s!<a\\( [^<>]*\\)href=!<ulink\\1url=!g" \ + -e "s!</a>!</ulink>!g" \ + -e "s! remap=\"url\">[^<>]*</ulink>! />!g" \ + -e "s!<\\(/*\\)span\\([ ][^<>]*\\)>!<\\1phrase\\2>!g" \ + -e "s!<\\(/*\\)span>!<\\1phrase>!g" \ + -e "s!<small\\([ ][^<>]*\\)>!<phrase role=\"small\"\\1>!g" \ + -e "s!<small>!<phrase role=\"small\">!g" \ + -e "s!</small>!</phrase>!g" \ + -e "s!<\\(/*\\)\\(sup\\)>!<\\1superscript>!g" \ + -e "s!<\\(/*\\)\\(sub\\)>!<\\1subscript>!g" \ + -e "s!\\(<\\)\\(li\\)\\(><\\)!\\1listitem\\3!g" \ + -e "s!\\(></\\)\\(li\\)\\(>\\)!\\1listitem\\3!g" \ + -e "s!\\(<\\)\\(li\\)\\(>\\)!\\1listitem\\3<para>!g" \ + -e "s!\\(</\\)\\(li\\)\\(>\\)!</para>\\1listitem\\3!g" \ + -e "s!\\(</*\\)\\(ul\\)>!\\1itemizedlist>!g" \ + -e "s!\\(</*\\)\\(ol\\)>!\\1orderedlist>!g" \ + -e "s!\\(</*\\)\\(dl\\)>!\\1variablelist>!g" \ + -e "s!<\\(/*\\)DT>!<\\1dt>!g" \ + -e "s!<\\(/*\\)DD>!<\\1dd>!g" \ + -e "s!<\\(/*\\)DL>!<\\1dl>!g" \ + -e "s!<BLOCKQUOTE>!<blockquote><para>!g" \ + -e "s!</BLOCKQUOTE>!</para></blockquote>!g" \ + -e "s!<\\(/*\\)dl>!<\\1variablelist>!g" \ + -e "s!<dt\\( [^<>]*\\)>!<varlistentry\\1><term>!g" \ + -e "s!<dt>!<varlistentry><term>!g" \ + -e "s!</dt>!</term>!g" \ + -e "s!<dd\\( [^<>]*\\)><!<listitem\\1><!g" \ + -e "s!<dd><!<listitem><!g" \ + -e "s!></dd>!></listitem></varlistentry>!g" \ + -e "s!<dd\\( [^<>]*\\)>!<listitem\\1><para>!g" \ + -e "s!<dd>!<listitem><para>!g" \ + -e "s!</dd>!</para></listitem></varlistentry>!g" \ + -e "s!<table[^<>]*><tr><td>\\(<table[^<>]*>\\)!\\1!" \ + -e "s!\\(</table>\\)</td></tr></table>!\\1!" \ + -e "s!<table\\( [^<>]*\\)>!<informaltable\\1><tgroup cols=\"2\"><tbody>!g" \ + -e "s!<table>!<informaltable><tgroup cols=\"2\"><tbody>!g" \ + -e "s!</table>!</tbody></tgroup></informaltable>!g" \ + -e "s!\\(</*\\)tr\\([ ][^<>]*\\)>!\\1row\\2>!g" \ + -e "s!\\(</*\\)tr>!\\1row>!g" \ + -e "s!\\(</*\\)td\\([ ][^<>]*\\)>!\\1entry\\2>!g" \ + -e "s!\\(</*\\)td>!\\1entry>!g" \ + -e "s!\\(<informaltable[^<>]*[ ]width=\"100\%\"\\)!\\1 pgwide=\"1\"!g" \ + -e "s!\\(<tgroup[<>]*[ ]cols=\"2\">\\)\\(<tbody>\\)!\\1<colspec colwidth=\"1*\" /><colspec colwidth=\"1*\" />\\2!g" \ + -e "s!\\(<entry[^<>]*[ ]\\)width=\\(\"[$NN]*\%*\"\\)!\\1remap=\\2!g" \ + -e "s!<nobr>\\([\'\`]*\\)<tt>!<cmdsynopsis><command>\\1!g" \ + -e "s!</tt>\\([\'\`]*\\)</nobr>!\\1</command></cmdsynopsis>!g" \ + -e "s!<nobr><\\(code\\)>\\([\`\"\']\\)!<cmdsynopsis><command>\\2!g" \ + -e "s!<\\(code\\)><nobr>\\([\`\"\']\\)!<cmdsynopsis><command>\\2!g" \ + -e "s!\\([\`\"\']\\)</\\(code\\)></nobr>!\\1</command></cmdsynopsis>!g" \ + -e "s!\\([\`\"\']\\)</nobr></\\(code\\)>!\\1</command></cmdsynopsis>!g" \ + -e "s!<nobr><\\(tt\\)>\\([\`\"\']\\)!<cmdsynopsis><command>\\2!g" \ + -e "s!<\\(tt\\)><nobr>\\([\`\"\']\\)!<cmdsynopsis><command>\\2!g" \ + -e "s!\\([\`\"\']\\)</\\(tt\\)></nobr>!\\1</command></cmdsynopsis>!g" \ + -e "s!\\([\`\"\']\\)</nobr></\\(tt\\)>!\\1</command></cmdsynopsis>!g" \ + -e "s!\\(</*\\)tt>!\\1constant>!g" \ + -e "s!\\(</*\\)code>!\\1literal>!g" \ + -e "s!<br>!<br />!g" \ + -e "s!<br */>!<screen role=\"linebreak\">\n</screen>!g" \ + >> "$F" + echo "'$SOURCEFILE': " `ls -s $SOURCEFILE` ">>" `ls -s $F` +} + +make_xmlmaster () +{ + SOURCEFILE=`xml_sourcefile "$F"` + X=`echo $SOURCEFILE | sed -e "y:/:~:"` + article="section" # book? chapter? + echo '<!DOCTYPE' $article 'PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"' >$F + echo ' "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">' >>$F + cat "$tmp/$MK.$X.xmlstylesheets.tmp.txt" | { while read stylesheet ; do + echo "<?xml-stylesheet type=\"text/css\" href=\"$stylesheet\" ?>" \ + >> "$F" + done } + echo "<section><title>Documentation</title>" >>$F + make_xmlsitemap >> $F + echo "</section>" >> $F + echo "'$SOURCEFILE': " `ls -s $SOURCEFILE` ">*>" `ls -s $F` +} + # ========================================================================== # # During processing we will create a series of intermediate files that @@ -1254,7 +1732,7 @@ body_for_emailfooter () # we scan the SITEFILE for href references to be converted # - in the new variant we use a ".gets.tmp" sed script that SECTS # marks all interesting lines so they can be checked later -# with an sed anchor of <!--sect[$NN]--> (or <!--sect[$AZ]-->) +# with an sed anchor of sect="[$NN]" (or sect="[$AZ]") S="\\ \\;" # S="[&]nbsp[;]" @@ -1263,154 +1741,204 @@ S="\\ \\;" # note that "<br>" is sometimes used with HR - it must exist in input echo_HR_EM_PP () { - echo "/^$1$2$3*<a href=/s/^/$4/" - echo "/^<>$1$2$3*<a href=/s/^/$4/" - echo "/^$S$1$2$3*<a href=/s/^/$4/" - echo "/^$1<>$2$3*<a href=/s/^/$4/" - echo "/^$1$S$2$3*<a href=/s/^/$4/" - echo "/^$1$2<>$3*<a href=/s/^/$4/" - echo "/^$1$2$S$3*<a href=/s/^/$4/" + echo "s%^\\($1$2$3*<a\\) \\(href=\\)%\\1 $4 \\2%" + echo "s%^\\(<>$1$2$3*<a\\) \\(href=\\)%\\1 $4 \\2%" + echo "s%^\\($S$1$2$3*<a\\) \\(href=\\)%\\1 $4 \\2%" + echo "s%^\\($1<>$2$3*<a\\) \\(href=\\)%\\1 $4 \\2%" + echo "s%^\\($1$S$2$3*<a\\) \\(href=\\)%\\1 $4 \\2%" + echo "s%^\\($1$2<>$3*<a\\) \\(href=\\)%\\1 $4 \\2%" + echo "s%^\\($1$2$S$3*<a\\) \\(href=\\)%\\1 $4 \\2%" } echo_br_EM_PP () { echo_HR_EM_PP "$1" "$2" "$3" "$4" - echo "/^$2$3*<a href=/s/^/$4/" - echo "/^<>$2$3*<a href=/s/^/$4/" - echo "/^$S$2$3*<a href=/s/^/$4/" - echo "/^$2<>$3*<a href=/s/^/$4/" - echo "/^$2$S$3*<a href=/s/^/$4/" + echo "s%^\\($2$3*<a\\) \\(href=\\)%\\1 $4 \\2%" + echo "s%^\\(<>$2$3*<a\\) \\(href=\\)%\\1 $4 \\2%" + echo "s%^\\($S$2$3*<a\\) \\(href=\\)%\\1 $4 \\2%" + echo "s%^\\($2<>$3*<a\\) \\(href=\\)%\\1 $4 \\2%" + echo "s%^\\($2$S$3*<a\\) \\(href=\\)%\\1 $4 \\2%" + echo "s%^\\($2$3*<><a\\) \\(href=\\)%\\1 $4 \\2%" + echo "s%^\\($2$3*$S<a\\) \\(href=\\)%\\1 $4 \\2%" } echo_HR_PP () { - echo "/^$1$2*<a href=/s/^/$3/" - echo "/^<>$1$2*<a href=/s/^/$3/" - echo "/^$S$1$2*<a href=/s/^/$3/" - echo "/^$1<>$2*<a href=/s/^/$3/" - echo "/^$1$S$2*<a href=/s/^/$3/" + echo "s%^\\($1<a\\) \\(href=\\)%\\1 $3 \\2%" + echo "s%^\\($1$2*<a\\) \\(href=\\)%\\1 $3 \\2%" + echo "s%^\\(<>$1$2*<a\\) \\(href=\\)%\\1 $3 \\2%" + echo "s%^\\($S$1$2*<a\\) \\(href=\\)%\\1 $3 \\2%" + echo "s%^\\($1<>$2*<a\\) \\(href=\\)%\\1 $3 \\2%" + echo "s%^\\($1$S$2*<a\\) \\(href=\\)%\\1 $3 \\2%" } echo_br_PP () { echo_HR_PP "$1" "$2" "$3" - echo "/^$2*<a href=/s/^/$3/" - echo "/^<>$2*<a href=/s/^/$3/" - echo "/^$S$2*<a href=/s/^/$3/" + echo "s%^\\($2*<a\\) \\(href=\\)%\\1 $3 \\2%" + echo "s%^\\(<>$2*<a\\) \\(href=\\)%\\1 $3 \\2%" + echo "s%^\\($S$2*<a\\) \\(href=\\)%\\1 $3 \\2%" } echo_sp_PP () { - echo "/^<>$1*<a href=/s/^/$2/" - echo "/^$S$1*<a href=/s/^/$2/" - echo "/^<><>$1*<a href=/s/^/$2/" - echo "/^$S$S$1*<a href=/s/^/$2/" - echo "/^<>$1<>*<a href=/s/^/$2/" - echo "/^$S$1$S*<a href=/s/^/$2/" - echo "/^$1<><>*<a href=/s/^/$2/" - echo "/^$1$S$S*<a href=/s/^/$2/" - echo "/^$1<>*<a href=/s/^/$2/" - echo "/^$1$S*<a href=/s/^/$2/" + echo "s%^\\(<>$1*<a\\) \\(href=\\)%\\1 $2 \\2%" + echo "s%^\\($S$1*<a\\) \\(href=\\)%\\1 $2 \\2%" + echo "s%^\\(<><>$1*<a\\) \\(href=\\)%\\1 $2 \\2%" + echo "s%^\\($S$S$1*<a\\) \\(href=\\)%\\1 $2 \\2%" + echo "s%^\\(<>$1<>*<a\\) \\(href=\\)%\\1 $2 \\2%" + echo "s%^\\($S$1$S*<a\\) \\(href=\\)%\\1 $2 \\2%" + echo "s%^\\($1<><>*<a\\) \\(href=\\)%\\1 $2 \\2%" + echo "s%^\\($1$S$S*<a\\) \\(href=\\)%\\1 $2 \\2%" + echo "s%^\\($1<>*<a\\) \\(href=\\)%\\1 $2 \\2%" + echo "s%^\\($1$S*<a\\) \\(href=\\)%\\1 $2 \\2%" +} + +echo_sp_SP () +{ + echo "s%^\\($1<a\\) \\(href=\\)%\\1 $2 \\2%" + echo "s%^\\(<>$1<a\\) \\(href=\\)%\\1 $2 \\2%" + echo "s%^\\($S$1<a\\) \\(href=\\)%\\1 $2 \\2%" + echo "s%^\\(<><>$1<a\\) \\(href=\\)%\\1 $2 \\2%" + echo "s%^\\($S$S$1<a\\) \\(href=\\)%\\1 $2 \\2%" + echo "s%^\\(<>$1<><a\\) \\(href=\\)%\\1 $2 \\2%" + echo "s%^\\($S$1$S<a\\) \\(href=\\)%\\1 $2 \\2%" + echo "s%^\\($1<><><a\\) \\(href=\\)%\\1 $2 \\2%" + echo "s%^\\($1$S$S<a\\) \\(href=\\)%\\1 $2 \\2%" + echo "s%^\\($1<><a\\) \\(href=\\)%\\1 $2 \\2%" + echo "s%^\\($1$S<a\\) \\(href=\\)%\\1 $2 \\2%" } echo_sp_sp () { - echo "/^$1*<a name=/s/^/$2/" - echo "/^<>$1*<a name=/s/^/$2/" - echo "/^$S$1*<a name=/s/^/$2/" - echo "/^<><>$1*<a name=/s/^/$2/" - echo "/^$S$S$1*<a name=/s/^/$2/" - echo "/^<>$1<>*<a name=/s/^/$2/" - echo "/^$S$1$S*<a name=/s/^/$2/" - echo "/^$1<><>*<a name=/s/^/$2/" - echo "/^$1$S$S*<a name=/s/^/$2/" - echo "/^$1<>*<a name=/s/^/$2/" - echo "/^$1$S*<a name=/s/^/$2/" + echo "s%^\\($1<a\\) \\(name=\\)%\\1 $2 \\2%" + echo "s%^\\(<>$1<a\\) \\(name=\\)%\\1 $2 \\2%" + echo "s%^\\($S$1<a\\) \\(name=\\)%\\1 $2 \\2%" + echo "s%^\\(<><>$1<a\\) \\(name=\\)%\\1 $2 \\2%" + echo "s%^\\($S$S$1<a\\) \\(name=\\)%\\1 $2 \\2%" + echo "s%^\\(<>$1<><a\\) \\(name=\\)%\\1 $2 \\2%" + echo "s%^\\($S$1$S<a\\) \\(name=\\)%\\1 $2 \\2%" + echo "s%^\\($1<><><a\\) \\(name=\\)%\\1 $2 \\2%" + echo "s%^\\($1$S$S<a\\) \\(name=\\)%\\1 $2 \\2%" + echo "s%^\\($1<><a\\) \\(name=\\)%\\1 $2 \\2%" + echo "s%^\\($1$S<a\\) \\(name=\\)%\\1 $2 \\2%" } make_sitemap_init() { # build a list of detectors that map site.htm entries to a section table # note that the resulting .gets.tmp / .puts.tmp are real sed-script - h1="[-|[]" + h1="[-$AP$AK]" b1="[*=]" - b2="[-|[]" - b3="[\\/:]" - q3="[\\/:,[]" - echo_HR_PP "<hr>" "$h1" "<!--sect1-->" > "$MK_GETS" - echo_HR_EM_PP "<hr>" "<em>" "$h1" "<!--sect1-->" >> "$MK_GETS" - echo_HR_EM_PP "<hr>" "<strong>" "$h1" "<!--sect1-->" >> "$MK_GETS" - echo_HR_PP "<br>" "$b1$b1" "<!--sect1-->" >> "$MK_GETS" - echo_HR_PP "<br>" "$b2$b2" "<!--sect2-->" >> "$MK_GETS" - echo_HR_PP "<br>" "$b3$b3" "<!--sect3-->" >> "$MK_GETS" - echo_br_PP "<br>" "$b2$b2" "<!--sect2-->" >> "$MK_GETS" - echo_br_PP "<br>" "$b3$b3" "<!--sect3-->" >> "$MK_GETS" - echo_br_EM_PP "<br>" "<small>" "$q3" "<!--sect3-->" >> "$MK_GETS" - echo_br_EM_PP "<br>" "<em>" "$q3" "<!--sect3-->" >> "$MK_GETS" - echo_br_EM_PP "<br>" "<u>" "$q3" "<!--sect3-->" >> "$MK_GETS" - echo_HR_PP "<br>" "$q3" "<!--sect3-->" >> "$MK_GETS" - echo_sp_PP "$q3" "<!--sect3-->" >> "$MK_GETS" - echo_sp_sp "$q3" "<!--sect9-->" >> "$MK_GETS" + b2="[-$AP$AK]" + b3="[:/]" + q3="[:/,$AK]" + echo_HR_PP "<hr>" "$h1" "sect=\"1\"" > "$MK_GETS" + echo_HR_EM_PP "<hr>" "<em>" "$h1" "sect=\"1\"" >> "$MK_GETS" + echo_HR_EM_PP "<hr>" "<strong>" "$h1" "sect=\"1\"" >> "$MK_GETS" + echo_HR_PP "<br>" "$b1$b1" "sect=\"1\"" >> "$MK_GETS" + echo_HR_PP "<br>" "$b2$b2" "sect=\"2\"" >> "$MK_GETS" + echo_HR_PP "<br>" "$b3$b3" "sect=\"3\"" >> "$MK_GETS" + echo_br_PP "<br>" "$b2$b2" "sect=\"2\"" >> "$MK_GETS" + echo_br_PP "<br>" "$b3$b3" "sect=\"3\"" >> "$MK_GETS" + echo_br_EM_PP "<br>" "<small>" "$q3" "sect=\"3\"" >> "$MK_GETS" + echo_br_EM_PP "<br>" "<em>" "$q3" "sect=\"3\"" >> "$MK_GETS" + echo_br_EM_PP "<br>" "<u>" "$q3" "sect=\"3\"" >> "$MK_GETS" + echo_HR_PP "<br>" "$q3" "sect=\"3\"" >> "$MK_GETS" + echo_br_PP "<u>" "$b2" "sect=\"2\"" >> "$MK_GETS" + echo_sp_PP "$q3" "sect=\"3\"" >> "$MK_GETS" + echo_sp_SP "" "sect=\"2\"" >> "$MK_GETS" + echo_sp_sp "$q3" "sect=\"9\"" >> "$MK_GETS" + echo_sp_sp "<br>" "sect=\"9\"" >> "$MK_GETS" $SED -e "s/\\(>\\)\\(\\[\\)/\\1 *\\2/" "$MK_GETS" > "$MK_PUTS" # the .puts.tmp variant is used to <b><a href=..></b> some hrefs which # shall not be used otherwise for being generated - this is nice for # some quicklinks somewhere. The difference: a whitspace "<hr> <a...>" + echo "" > "$MK_DATA" # fresh start } -_uses_="=use\\1=\\2 \\3" ; _name_="=use\\1=name:\\2 \\3" ; -_getW_="<!--sect\\([$NN]\\)-->" -_getX_="<!--sect\\([$NN]\\)--><[^<>]*>[^<>]*" -_getY_="<!--sect\\([$NN]\\)--><[^<>]*>[^<>]*<[^<>]*>[^<>]*" +_uses_="<$Q'use\\1'>\\2 \\3<$QX>" +_name_="<$Q'use\\1'>name:\\2 \\3<$QX>" ; make_sitemap_list() { + _sitefile_="$1" ; test ".$_sitefile_" = "." && _sitefile_="$SITEFILE" # scan sitefile for references pages - store as "=use+=href+ anchortext" - $SED -f $MK_GETS -e "/^<!--sect[$NN]-->/!d" \ - -e "s|^$_getX_<a href=\"\\([^\"]*\\)\"[^<>]*>\\(.*\\)</a>.*|$_uses_|" \ - -e "s|^$_getY_<a href=\"\\([^\"]*\\)\"[^<>]*>\\(.*\\)</a>.*|$_uses_|" \ - -e "s|^$_getW_<a name=\"\\([^\"]*\\)\"[^<>]*>\\(.*\\)</a>.*|$_name_|" \ - -e "s|^$_getX_<a name=\"\\([^\"]*\\)\"[^<>]*>\\(.*\\)</a>.*|$_name_|" \ - -e "s|^$_getY_<a name=\"\\([^\"]*\\)\"[^<>]*>\\(.*\\)</a>.*|$_name_|" \ - -e "/^=....=/!d" "$SITEFILE" > "$MK_INFO" + $SED -f "$MK_GETS" -e "/<a sect=\"[$NN]\"/!d" \ + -e "s|.*<a sect=\"\\([^\"]*\\)\" href=\"\\([^\"]*\\)\"[^<>]*>\\(.*\\)</a>.*|$_uses_|" \ + -e "s|.*<a sect=\"\\([^\"]*\\)\" name=\"\\([^\"]*\\)\"[^<>]*>\\(.*\\)</a>.*|$_name_|" \ + -e "s|.*<a sect=\"\\([^\"]*\\)\" name=\"\\([^\"]*\\)\"[^<>]*>\\(.*\\)|$_name_|" \ + -e "/^<$Q/!d" -e "/^<!/d" \ + "$_sitefile_" >> "$MK_DATA" +} + +_Uses_="<$Q'Use\\1'>\\2 \\3<$QX>" +_Name_="<$Q'Use\\1'>name:\\2 \\3<$QX>" ; + +make_subsitemap_list() +{ + _sitefile_="$1" ; test ".$_sitefile_" = "." && _sitefile_="$SITEFILE" + # scan sitefile for references pages - store as "=use+=href+ anchortext" + $SED -f "$MK_GETS" -e "/<a sect=\"[$NN]\"/!d" \ + -e "s|.*<a sect=\"\\([^\"]*\\)\" href=\"\\([^\"]*\\)\"[^<>]*>\\(.*\\)</a>.*|$_Uses_|" \ + -e "s|.*<a sect=\"\\([^\"]*\\)\" name=\"\\([^\"]*\\)\"[^<>]*>\\(.*\\)</a>.*|$_Name_|" \ + -e "s|.*<a sect=\"\\([^\"]*\\)\" name=\"\\([^\"]*\\)\"[^<>]*>\\(.*\\)|$_Name_|" \ + -e "/^<$Q/!d" -e "/^<!/d" \ + -e "s|>\\([^:./][^:./]*[./]\\)|>$2\\1|" \ + "$_sitefile_" >> "$MK_DATA" } make_sitemap_sect() { - # scan used pages and store prime section group relation =sect= and =node= - # (A) each "use1" creates "=sect=href+ href1" for all following non-"use1" - # (B) each "use1" creates "=node=href2 href1" for all following "use2" - $SED -e "/=use.=/!d" \ - -e "/=use1=/{" -e "h" -e "s:=use1=\\([^ ]*\\) .*:\\1:" -e "x" -e "}" \ - -e "s/=use.=\\([^ ]*\\) .*/=sect=\\1/" \ - -e G -e "s:\\n: :" "$MK_INFO" >> "$MK_INFO" - $SED -e "/=use.=/!d" \ - -e "/=use1=/{" -e "h" -e "s:=use1=\\([^ ]*\\) .*:\\1:" -e "x" -e "}" \ - -e "/=use[13456789]=/d" \ - -e "s/=use.=\\([^ ]*\\) .*/=node=\\1/" \ - -e G -e "s:\\n: :" "$MK_INFO" >> "$MK_INFO" + # scan used pages and store prime section group relation 'sect' and 'node' + # (A) each "use1" creates "'sect'>href+ href1" for all following non-"use1" + # (B) each "use1" creates "'node'>href2 href1" for all following "use2" + $SED -e "/^<$Q'use.'>/!d" \ + -e "/^<$Q'use1'>/{" \ + -e "h" -e "s|^<$Q'use1'>\\([^ ]*\\) .*|\\1|" \ + -e "x" -e "}" \ + -e "s|^<$Q'use.'>\\([^ ]*\\) .*|<$Q'sect'>\\1|" \ + -e G -e "s|\\n| |" -e "s|\$|<$QX>|" "$MK_DATA" >> "$MK_DATA" + $SED -e "/^<$Q'use.'>/!d" \ + -e "/^<$Q'use1'>/{" \ + -e "h" -e "s|^<$Q'use1'>\\([^ ]*\\) .*|\\1|" \ + -e "x" -e "}" \ + -e "/^<$Q'use[13456789]'>/d" \ + -e "s|<$Q'use.'>\\([^ ]*\\) .*|<$Q'node'>\\1|" \ + -e G -e "s|\\n| |" -e "s|\$|<$QX>|" "$MK_DATA" >> "$MK_DATA" } make_sitemap_page() { - # scan used pages and store secondary group relation =page= and =node= - # the parenting =node= for use3 is usually a use2 (or use1 if none there) - $SED -e "/=use.=/!d" \ - -e "/=use1=/{" -e "h" -e "s:=use1=\\([^ ]*\\) .*:\\1:" -e "x" -e "}" \ - -e "/=use2=/{" -e "h" -e "s:=use2=\\([^ ]*\\) .*:\\1:" -e "x" -e "}" \ - -e "/=use[1]=/d" \ - -e "s/=use.=\\([^ ]*\\) .*/=page=\\1/" \ - -e G -e "s:\\n: :" "$MK_INFO" >> "$MK_INFO" - $SED -e "/=use.=/!d" \ - -e "/=use1=/{" -e "h" -e "s:=use1=\\([^ ]*\\) .*:\\1:" -e "x" -e "}" \ - -e "/=use2=/{" -e "h" -e "s:=use2=\\([^ ]*\\) .*:\\1:" -e "x" -e "}" \ - -e "/=use[12456789]=/d" \ - -e "s/=use.=\\([^ ]*\\) .*/=node=\\1/" \ - -e G -e "s:\\n: :" "$MK_INFO" >> "$MK_INFO" + # scan used pages and store secondary group relation 'page' and 'node' + # the parenting 'node' for use3 is usually a use2 (or use1 if none there) + $SED -e "/^<$Q'use.'>/!d" \ + -e "/^<$Q'use1'>/{" \ + -e "h" -e "s|^<$Q'use1'>\\([^ ]*\\) .*|\\1|" \ + -e "x" -e "}" \ + -e "/^<$Q'use2'>/{" \ + -e "h" -e "s|^<$Q'use2'>\\([^ ]*\\) .*|\\1|" \ + -e "x" -e "}" \ + -e "/^<$Q'use1'>/d" \ + -e "s|^<$Q'use.'>\\([^ ]*\\) .*|<$Q'page'>\\1<$QX>|" \ + -e G -e "s|\\n| |" "$MK_DATA" >> "$MK_DATA" + $SED -e "/^<$Q'use.'>/!d" \ + -e "/^<$Q'use1'>/{" \ + -e "h" -e "s|^<$Q'use1'>\\([^ ]*\\) .*|\\1|" \ + -e "x" -e "}" \ + -e "/^<$Q'use2'>/{" \ + -e "h" -e "s|^<$Q'use2'>\\([^ ]*\\) .*|\\1|" \ + -e "x" -e "}" \ + -e "/^<$Q'use[12456789]'>/d" \ + -e "s|^<$Q'use.'>\\([^ ]*\\) .*|<$Q'node'>\\1<$QX>|" \ + -e G -e "s|\\n| |" "$MK_DATA" >> "$MK_DATA" # and for the root sections we register ".." as the parenting group - $SED -e "/=use1=/!d" \ - -e "s/=use.=\\([^ ]*\\) .*/=node=\\1 ../" "$MK_INFO" >> "$MK_INFO" + $SED -e "/^<$Q'use1'>/!d" \ + -e "s|^<$Q'use.'>\\([^ ]*\\) .*|<$Q'node'>\\1 ..<$QX>|" "$MK_DATA" >> "$MK_DATA" } + echo_site_filelist() { - $SED -e "/=use.=/!d" -e "s/=use.=//" -e "s/ .*//" "$MK_INFO" + $SED -e "/^<$Q'use.'>/!d" \ + -e "s|^<$Q'use.'>||" -e "s| .*||" "$MK_DATA" } # ========================================================================== @@ -1423,6 +1951,7 @@ echo_site_filelist() scan_sitefile () # $F { SOURCEFILE=`html_sourcefile "$F"` + $hint "'$SOURCEFILE': scanning -> sitefile" if test "$SOURCEFILE" != "$F" ; then dx_init "$F" dx_text today "`timetoday`" @@ -1449,8 +1978,9 @@ scan_sitefile () # $F scan_htmlfile() # "$F" { SOURCEFILE=`html_sourcefile "$F"` # SCAN : - if test "$SOURCEFILE" != "$F" ; then : # HTML : - if test -f "$SOURCEFILE" ; then make_fast "$F" > "$tmp/$F.$FAST" + $hint "'$SOURCEFILE': scanning -> $F" # HTML : + if test "$SOURCEFILE" != "$F" ; then : + if test -f "$SOURCEFILE" ; then dx_init "$F" dx_text today "`timetoday`" dx_text todays "`timetodays`" @@ -1474,6 +2004,7 @@ scan_htmlfile() # "$F" issue=`info_get_entry issue` site_map_list_date "$F" "$edate" info_map_list_date "$F" "$edate" + css_scan echo "'$SOURCEFILE': '$title' ('$short') @ '$issue' ('$sectn')" else echo "'$SOURCEFILE': does not exist" @@ -1484,6 +2015,23 @@ scan_htmlfile() # "$F" fi } +scan_subsitemap_long () +{ + grep "<a href=\"[^\"]*\">" "$1" | { + while read _line_ ; do + _href_=`echo "$_line_" | $SED -e "s|.*<a href=\"\\([^\"]*\\)\">.*|\\1|"` + _date_=`echo "$_line_" | $SED -e "s|.*<small style=\"date\">\\([^<>]*\\)</small>.*|\\1|" -e "/<a href=\"[^\"]*\">/d"` + _long_=`echo "$_line_" | $SED -e "s|.*<!--long-->\\([^<>]*\\)<!--/long-->.*|\\1|" -e "/<a href=\"[^\"]*\">/d"` + if test ".$_href_" != "." && test ".$_date_" != "." ; then + site_map_list_date "$2$_href_" "$_date_" + fi + if test ".$_href_" != "." && test ".$_long_" != "." ; then + site_map_long_title "$2$_href_" "$_long_" + fi + done + } +} + scan_namespec () { # nothing so far @@ -1496,6 +2044,13 @@ scan_namespec () site_map_list_date "$F" "`timetoday`" echo "'$F' external sitemap index$n" ;; + name:*.htm|name:*.html) + FF=`echo "$1" | $SED -e "s|name:||"` + FFF=`echo "$FF" | $SED -e "s|/[^/]*\$|/|"` # dirname + case "$FFF" in */*) : ;; *) FFF="" ;; esac + make_subsitemap_list "$FF" "$FFF" + scan_subsitemap_long "$FF" "$FFF" + ;; esac } scan_httpspec () @@ -1521,11 +2076,10 @@ skip_httpspec () head_sed_sitemap() # $filename $section { - FF="$1" + FF=`sed_piped_key "$1"` SECTION=`sed_slash_key "$2"` - SECTS="<!--sect[$NN$AZ]-->" ; SECTN="<!--sect[$NN]-->" # lines with hrefs - echo "/^$SECTS.*<a href=\"$FF\">/s|</a>|</a></b>|" # $++ - echo "/^$SECTS.*<a href=\"$FF\">/s|<a href=|<b><a href=|" # $++ + SECTS="sect=\"[$NN$AZ]\"" ; SECTN="sect=\"[$NN]\"" # lines with hrefs + echo "s|\\(<a $SECTS href=\"$FF\">.*</a>\\)|<b>\\1</b>|" # $++ test ".$sectiontab" != ".no" && \ echo "/ href=\"$SECTION\"/s|^<td class=\"[^\"]*\"|<td |" # $++ } @@ -1533,11 +2087,10 @@ head_sed_sitemap() # $filename $section head_sed_listsection() # $filename $section { # traditional.... the sitefile is the full navigation bar - FF=`sed_slash_key "$1"` + FF=`sed_piped_key "$1"` SECTION=`sed_slash_key "$2"` - SECTS="<!--sect[$NN$AZ]-->" ; SECTN="<!--sect[$NN]-->" # lines with hrefs - echo "/^$SECTS.*<a href=\"$FF\">/s|</a>|</a></b>|" # $++ - echo "/^$SECTS.*<a href=\"$FF\">/s|<a href=|<b><a href=|" # $++ + SECTS="sect=\"[$NN$AZ]\"" ; SECTN="sect=\"[$NN]\"" # lines with hrefs + echo "s|\\(<a $SECTS href=\"$FF\">.*</a>\\)|<b>\\1</b>|" # $++ test ".$sectiontab" != ".no" && \ echo "/ href=\"$SECTION\"/s|^<td class=\"[^\"]*\"|<td |" # $++ } @@ -1545,21 +2098,26 @@ head_sed_listsection() # $filename $section head_sed_multisection() # $filename $section { # sitefile navigation bar is split into sections - FF=`sed_slash_key "$1"` + FF=`sed_piped_key "$1"` SECTION=`sed_slash_key "$2"` - SECTS="<!--sect[$NN$AZ]-->" ; SECTN="<!--sect[$NN]-->" # lines with hrefs - # grep all pages with a =sect= relation to current $SECTION and + SECTS="sect=\"[$NN$AZ]\"" ; SECTN="sect=\"[$NN]\"" # lines with hrefs + # grep all pages with a class='sect' relation to current $SECTION and # build foreach an sed line "s|$SECTS\(<a href=$F>\)|<!--sectX-->\1|" # after that all the (still) numeric SECTNs are deactivated / killed. for section in $SECTION $headsection $tailsection ; do test ".$section" = ".no" && continue - $SED -e "/^=sect=[^ ]* $section/!d" \ - -e "s, .*,\"\\\\)|<!--sectX-->\\\\1|," \ - -e "s,^=sect=,s|^$SECTS\\\\(.*<a href=\"," "$MK_INFO" # $++ + $SED -e "/^<$Q'sect'>[^ ]* $section/!d" \ + -e "s|<$Q'sect'>||" -e "s| .*||" \ + -e "s/.*/s|<a $SECTS \\\\(href=\"&\"\\\\)|<a sect=\"X\" \\\\1|/" \ + "$MK_DATA" # $++ + $SED -e "/^<$Q'sect'>name:[^ ]* $section/!d" \ + -e "s|<$Q'sect'>name:||" -e "s| .*||" \ + -e "s/.*/s|<a $SECTS \\\\(name=\"&\"\\\\)|<a sect=\"X\" \\\\1|/" \ + "$MK_DATA" # $++ done - echo "s|^$SECTN[^ ]*\\(<a href=[^<>]*>\\).*|<!-- \\1 -->|" # $++ - echo "/^$SECTS.*<a href=\"$FF\">/s|</a>|</a></b>|" # $++ - echo "/^$SECTS.*<a href=\"$FF\">/s|<a href=|<b><a href=|" # $++ + echo "s|.*<a \\($SECTN href=[^<>]*\\)>.*|<!-- \\1 -->|" # $++ + echo "s|.*<a \\($SECTN name=[^<>]*\\)>.*|<!-- \\1 -->|" # $++ + echo "s|\\(<a $SECTS href=\"$FF\">\\)|<b>\\1</b>|" # $++ test ".$sectiontab" != ".no" && \ echo "/ href=\"$SECTION\"/s|^<td class=\"[^\"]*\"|<td |" # $++ } @@ -1572,9 +2130,6 @@ make_sitefile () # "$F" # remember that in this case "${SITEFILE}l" = "$F" = "${SOURCEFILE}l" info2vars_sed > $MK_VARS # have <!--title--> vars substituted info2meta_sed > $MK_META # add <meta name="DC.title"> values - if test ".$simplevars" = ".warn" ; then - info2test_sed > $MK_TEST # check <!--title--> vars old-style - $SED_LONGSCRIPT "$MK_TEST" "$SOURCEFILE" | tee -a "$MK_OLDS" ; fi F_HEAD="$tmp/$F.$HEAD" ; F_FOOT="$tmp/$F.$FOOT" $CAT "$MK_PUTS" > "$F_HEAD" head_sed_sitemap "$F" "`info_get_entry_section`" >> "$F_HEAD" @@ -1601,31 +2156,30 @@ make_htmlfile() # "$F" SOURCEFILE=`html_sourcefile "$F"` # 2.PASS if test "$SOURCEFILE" != "$F" ; then if test -f "$SOURCEFILE" ; then - if grep '<meta name="formatter"' "$SOURCEFILE" >/dev/null ; then - echo "$SOURCEFILE: SKIP, this sourcefile looks like a formatted file" - echo "$SOURCEFILE: (may be a sourcefile in place of a targetfile?)" + if grep '<meta name="formatter"' "$SOURCEFILE" > $NULL ; then + echo "'$SOURCEFILE': SKIP, this sourcefile looks like a formatted file" + echo "'$SOURCEFILE': (may be a sourcefile in place of a targetfile?)" return fi info2vars_sed > $MK_VARS # have <!--$title--> vars substituted info2meta_sed > $MK_META # add <meta name="DC.title"> values - if test ".$simplevars" = ".warn" ; then - info2test_sed > $MK_TEST # check <!--title--> vars old-style - $SED_LONGSCRIPT "$MK_TEST" "$SOURCEFILE" | tee -a "$MK_OLDS" ; fi + tags2span_sed > $MK_SPAN # extern text/css -> intern css classes + tags2meta_sed >>$MK_META # extern text/css -> intern css classes F_HEAD="$tmp/$F.$HEAD" ; F_BODY="$tmp/$F.$BODY" ; F_FOOT="$tmp/$F.$FOOT" $CAT "$MK_PUTS" > "$F_HEAD" case "$sectionlayout" in multi) head_sed_multisection "$F" "`info_get_entry_section`" >> "$F_HEAD" ;; *) head_sed_listsection "$F" "`info_get_entry_section`" >> "$F_HEAD" ;; esac - $CAT "$MK_VARS" "$MK_TAGS" >> "$F_HEAD" #tag and vars + $CAT "$MK_VARS" "$MK_TAGS" "$MK_SPAN" >> "$F_HEAD" #tag and vars echo "/<\\/body>/d" >> "$F_HEAD" #cut lastline echo "/<head>/r $MK_META" >> "$F_HEAD" #add metatags echo "/<title>/d" > "$F_BODY" #not that line - $CAT "$MK_VARS" "$MK_TAGS" >> "$F_BODY" #tag and vars + $CAT "$MK_VARS" "$MK_TAGS" "$MK_SPAN" >> "$F_BODY" #tag and vars bodymaker_for_sectioninfo >> "$F_BODY" #if sectioninfo info2body_sed >> "$F_BODY" #cut early info2head_sed >> "$F_HEAD" - $CAT "$tmp/$F.$FAST" >> "$F_HEAD" + make_back_path "$F" >> "$F_HEAD" test ".$emailfooter" != ".no" && \ body_for_emailfooter > "$F_FOOT" @@ -1646,15 +2200,14 @@ make_printerfriendly () # "$F" { # PRINTER printsitefile="0" # FRIENDLY P=`html_printerfile "$F"` - F_FAST="$tmp/$F.$FAST" P_HEAD="$tmp/$P.$HEAD" P_BODY="$tmp/$P.$BODY" case "$F" in - ${SITEFILE}|${SITEFILE}l) make_fast "$F" > "$F_FAST" + ${SITEFILE}|${SITEFILE}l) printsitefile=">=>" ; BODY_TXT="$tmp/$F.$FOOT" ;; *.html) printsitefile="=>" ; BODY_TXT="$SOURCEFILE" ;; esac - if grep '<meta name="formatter"' "$BODY_TXT" >/dev/null ; then return; fi + if grep '<meta name="formatter"' "$BODY_TXT" > $NULL ; then return; fi if test ".$printsitefile" != ".0" && test -f "$SOURCEFILE" ; then make_printerfile_fast "$FILELIST" > ./$MK_FAST $CAT "$MK_VARS" "$MK_TAGS" "$MK_FAST" > "$P_HEAD" @@ -1663,15 +2216,13 @@ make_printerfriendly () # "$F" echo "/<head>/r $MK_METT" >> "$P_HEAD" # meta echo "/<\\/body>/d" >> "$P_HEAD" select_in_printsitefile "$F" >> "$P_HEAD" - _ext_=`print_extension "$printerfriendly"` # head- - $SED -e "s/[.]html\"|/$_ext_&/g" "$F_FAST" >> "$P_HEAD" # hrefs - # line_=`sed_slash_key "$printsitefile_img_2"` # back- + _ext_=`print_extension "$printerfriendly"` # head- + # line_=`sed_slash_key "$printsitefile_img_2"` # back- echo "/||topics:/s| href=\"[#][.]\"| href=\"$F\"|" >> "$P_HEAD" echo "/|||pages:/s| href=\"[#][.]\"| href=\"$F\"|" >> "$P_HEAD" - $CAT "$F_FAST" >> "$P_HEAD" # subdir + make_back_path "$F" >> "$P_HEAD" $CAT "$MK_VARS" "$MK_TAGS" "$MK_FAST" > "$P_BODY" - $SED -e "s/[.]html\"|/$_ext_&/g" "$F_FAST" >> "$P_BODY" # body- - $CAT "$F_FAST" >> "$P_BODY" # hrefs + make_back_path "$F" >> "$P_BODY" mkpathfile "$P" $SED_LONGSCRIPT "$P_HEAD" $PRINTSITEFILE > $P # ~head~ @@ -1693,29 +2244,42 @@ make_sitemap_list make_sitemap_sect make_sitemap_page +if test -d DEBUG && test -f "$MK_DATA" +then FFFF=`echo "$F" | sed -e "s,/,:,g"` + cp "$MK_DATA" "DEBUG/$FFFF.DATA.tmp.htm" +fi + FILELIST=`echo_site_filelist` if test ".$opt_filelist" != "." || test ".$opt_list" = ".file"; then for F in $FILELIST; do echo "$F" ; done ; exit # --filelist fi if test ".$opt_files" != "." ; then FILELIST="$opt_files" ; fi # --files -if test ".$FILELIST" = "."; then echo "nothing to do" >&2 ; fi -if test ".$FILELIST" = ".SITEFILE" ; then echo "only '$SITEFILE'?!" >&2 ; fi +if test ".$FILELIST" = "."; then warn "nothing to do (no --filelist)" ; fi +if test ".$FILELIST" = ".SITEFILE" ; then warn "only '$SITEFILE'?!" ; fi for F in $FILELIST ; do case "$F" in #### 1. PASS name:*) scan_namespec "$F" ;; -http:*|*://*) scan_httpspec "$F" ;; +http:*|https:*|ftp:*|mailto:*|telnet:*|news:*|gopher:*|wais:*) + scan_httpspec "$F" ;; ${SITEFILE}|${SITEFILE}l) scan_sitefile "$F" ;; # ........... SCAN SITE +*@*.de) + echo "!! -> '$F' (skipping malformed mailto:-link)" + ;; ../*) echo "!! -> '$F' (skipping topdir build)" ;; # */*.html) -# make_fast > $F.$FAST # try for later subdir build # echo "!! -> '$F' (skipping subdir build)" # ;; # */*/*/|*/*/|*/|*/index.htm|*/index.html) # echo "!! -> '$F' (skipping subdir index.html)" # ;; -*.html) scan_htmlfile "$F" ;; # ........... SCAN HTML +*.html) scan_htmlfile "$F" # ........... SCAN HTML + if test ".$opt_xml" != "." ; then + F=`echo "$F" | sed -e "s/\\.html$/.xml/"` + scan_xmlfile "$F" + fi ;; +*.xml) scan_xmlfile "$F" ;; */) echo "'$F' : directory - skipped" site_map_list_title "$F" "`sed_slash_key $F`" site_map_long_title "$F" "(directory)" @@ -1731,15 +2295,19 @@ if test ".$printerfriendly" != "." ; then # .......... PRINT VERSION make_printsitefile > "$PRINTSITEFILE" fi -if test ".$simplevars" = ". " ; then -mknewfile $MK_OLDS -fi - for F in $FILELIST ; do case "$F" in #### 2. PASS name:*) skip_namespec "$F" ;; -http:*|*://*) skip_httpspec "$F" ;; +http:*|https:*|ftp:*|mailto:*|telnet:*|news:*|gopher:*|wais:*) + skip_httpspec "$F" ;; ${SITEFILE}|${SITEFILE}l) make_sitefile "$F" # ........ SITE FILE - if test ".$printerfriendly" != "." ; then make_printerfriendly "$F" ; fi ;; + if test ".$printerfriendly" != "." ; then make_printerfriendly "$F" ; fi + if test ".$opt_xml" != "." ; then _old_F_="$F" + F=`echo "$F" | sed -e "s/\\.html$/.xml/"` + make_xmlmaster "$F" ;F="$_old_F_" + fi ;; +*@*.de) + echo "!! -> '$F' (skipping malformed mailto:-link)" + ;; ../*) echo "!! -> '$F' (skipping topdir build)" ;; @@ -1750,7 +2318,12 @@ ${SITEFILE}|${SITEFILE}l) make_sitefile "$F" # ........ SITE FILE # echo "!! -> '$F' (skipping subdir index.html)" # ;; *.html) make_htmlfile "$F" # .................. HTML FILES - if test ".$printerfriendly" != "." ; then make_printerfriendly "$F" ; fi ;; + test ".$printerfriendly" != "." && make_printerfriendly "$F" + if test ".$opt_xml" != "." ; then _old_F_="$F" + F=`echo "$F" | sed -e "s/\\.html$/.xml/"` + make_xmlfile "$F" ;F="$_old_F_" + fi ;; +*.xml) make_xmlfile "$F" ;; */) echo "'$F' : directory - skipped" ;; *) echo "?? -> '$F'" @@ -1758,32 +2331,25 @@ ${SITEFILE}|${SITEFILE}l) make_sitefile "$F" # ........ SITE FILE esac # .............. debug .................... if test -d DEBUG && test -f "./$F" ; then - FFFF=`echo "$F" | sed -e s,/,:,g` - cp "$tmp/$F.$INFO" DEBUG/$FFFF.info.TMP - for P in tags vars meta page date list html sect info ; do - test -f $tmp/$MK.$P.tmp && cp $tmp/$MK.$P.tmp DEBUG/$FFFF.$P.tmp - test -f $tmp/$MK.$P.TMP && cp $tmp/$MK.$P.TMP DEBUG/$FFFF.$P.TMP + FFFF=`echo "$F" | sed -e "s,/,:,g"` + test -f "$tmp/$F.$DATA" && cp "$tmp/$F.$DATA" DEBUG/$FFFF.data.tmp.htm + test -f "$tmp/$F.$HEAD" && cp "$tmp/$F.$HEAD" DEBUG/$FFFF.head.tmp.sed + test -f "$tmp/$F.$BODY" && cp "$tmp/$F.$BODY" DEBUG/$FFFF.body.tmp.sed + test -f "$tmp/$F.$FOOT" && cp "$tmp/$F.$FOOT" DEBUG/$FFFF.foot.tmp.sed + for P in tags vars span meta page date list html sect \ + data head body foot fast xmlmapping \ + gets puts site mett sect1 sect2 sect3 style ; do + test -f $tmp/$MK.$P.tmp.htm && cp $tmp/$MK.$P.tmp.htm DEBUG/$FFFF.$P.tmp.htm + test -f $tmp/$MK.$P.tmp.sed && cp $tmp/$MK.$P.tmp.sed DEBUG/$FFFF.$P.tmp.sed done fi done -if test ".$simplevars" = ".warn" ; then if test -f "$MK_OLDS" ; then -oldvars=`cat "$MK_OLDS" | wc -l | $SED -e "s/ *//g"` -if test "$oldvars" = "0" ; then -echo "HINT: you have no simplevars in your htm sources, so you may want to" -echo "hint: set the magic <!--mksite:nosimplevars--> in your $SITEFILE" -echo "hint: which makes execution _faster_ actually in the 2. pass" -echo "note: simplevars expansion was the oldstyle way of variable expansion" -else -echo "HINT: there were $oldvars simplevars found in your htm sources." -echo "hint: This style of variable expansion will be disabled in the near" -echo "hint: future. If you do not want change then add the $SITEFILE magic" -echo "hint: <!--mksite:simplevars--> somewhere to suppress this warning" -echo "note: simplevars expansion will be an explicit option in the future." -echo "note: errornous simplevar detection can be suppressed with a magic" -echo "note: hint of <!--mksite:nosimplevars--> in the $SITEFILE for now." -fi fi fi - -rm $tmp/$MK.*.tmp +if test ".$opt_keeptmpfiles" = "." ; then + for i in $tmp/$MK.*.tmp.htm $tmp/$MK.*.tmp.sed \ + $tmp/$MK.*.tmp.css $tmp/$MK.*.tmp.txt + do test -f "$i" && rm "$i" + done +fi if test ".$tmp_dir_was_created" != ".no" ; then rm $tmp/* ; rmdir $tmp ; fi exit 0 |