+2006-09-21
+ * last doc/*.py updates
+ * last doc/mksite.* updates
+ * last doc/body.htm updates - including new zzipmmapped.html docu
+ * "make install-sf" will copy the doctree directly to sourceforge
+
2006-09-18
* docs/makedocs.py docs/zzipdoc/*.py creates new docs/zziplib-man3.tar.gz
plus zziplib.html zzipmmapped.html zzipfseeko.html
rpm2: dist-bzip2 $(PACKAGE).spec
rpmbuild -ta $(PACKAGE)-$(VERSION).tar.bz2
-zzip.html zzip.xml zzip.pdf \
-doc docu clean-doc clean-docs clean-docu \
-man manpages htmpages unpack clean-unpack \
-omf install-omf install-doc install-sfnet install-man3 docu x :
+doc docs docu clean-doc clean-docs clean-docu zzip.html zzip.xml zzip.pdf \
+man mans manpages htmpages unpack clean-unpack pdfs \
+omf install-omf install-doc install-docs install-sf install-man3 install-mans :
(cd docs && $(MAKE) `basename $@`)
sdl testsdl test-sdl install-sdl :
PHONY = auto boottrap rpm doc docs man manpages htmpages sdl testsdl \
comp compats msvc6 msvc7
-docs : docu
# ------------------------------------------------------------------------
test-comp:
zip -9r $(srcdir)/$(PACKAGE)-$(VERSION)-msvc6-bin.zip bin/
zip -9r $(srcdir)/$(PACKAGE)-$(VERSION)-msvc6-lib.zip lib/ include/
rm -r bin lib include
+
+# ------------------------------------------------------------------ zzip64
+_FILE_OFFSET64 = -D_ZZIP_LARGEFILE -D_FILE_OFFSET_BITS=64
+_RELEASEINFO64 = "RELEASE_INFO=-release 0-64"
+
+zzip64-setup: zzip64-setup.tmp
+zzip64-setup.tmp : zzip/Makefile zzip/_config.h zzip/.deps/* zzip/zziplib.pc
+ - mkdir zzip64
+ cp -a zzip/Makefile zzip/_config.h zzip/.deps/ zzip/zziplib.pc zzip64/
+ date > zzip64.dir
+zzip64-build: zzip64-build.tmp
+zzip64-build.tmp : zzip64-setup.tmp $(top_srcdir)/zzip/*
+ cd zzip64 && $(MAKE) "AM_CFLAGS=$(_FILE_OFFSET64)" $(_RELEASEINFO64)
+zzip64-install: zzip64-install.tmp
+zzip64-install.tmp : zzip64-build.tmp
+ cd zzip64 && $(MAKE) install $(_RELEASEINFO64)
+ cd $(DESTDIR)$(libdir) && mv libzzip.so libzzip64.so
+ cd $(DESTDIR)$(libdir) && mv libzzip.a libzzip64.a
+ cd $(DESTDIR)$(libdir) && \
+ sed -e 's/zzip.so/zzip64.so/' \
+ -e 's/zzip.a/zzip64.a/' libzzip.la > libzzip64.la
+ cd $(DESTDIR)$(libdir)/pkgconfig && \
+ sed -e 's/largefile=/largefile= %_FILE_OFFSET64/' \
+ -e 's/-lzzip/-lzzip64/' \
+ -e 's/zziplib/zziplib64/' zziplib.pc > zziplib64.pc
+zzip32-postinstall:
+ cd $(DESTDIR)$(libdir) && mv libzzip.so libzzip32.so
+ cd $(DESTDIR)$(libdir) && mv libzzip.a libzzip32.a
+ cd $(DESTDIR)$(libdir) && ln -s libzzip32.so libzzip.so
+ cd $(DESTDIR)$(libdir) && ln -s libzzip32.a libzzip.a
+ cd $(DESTDIR)$(libdir) && \
+ sed -e 's/zzip.so/zzip32.so/' \
+ -e 's/zzip.a/zzip32.a/' libzzip.la > libzzip32.la
+ cd $(DESTDIR)$(libdir)/pkgconfig && \
+ sed -e 's/-lzzip/-lzzip32/' \
+ -e 's/zziplib/zziplib32/' zziplib.pc > zziplib32.pc
+zzip-postinstall:
+ : "the 12.8x and 11.8x and 10.8x packages are all the same actually"
+ cd $(DESTDIR)$(libdir) || exit 1 \
+ ; for i in libzzip*.so.1? ; do : \
+ ; v10=`echo $i | sed -e "s/.so.../.so.10/"` \
+ ; v11=`echo $i | sed -e "s/.so.../.so.11/"` \
+ ; v12=`echo $i | sed -e "s/.so.../.so.12/"` \
+ ; test ! -e $v10 && test -e $v12 && ln -s $v12 $v10 \
+ ; test ! -e $v12 && test -e $v10 && ln -s $v10 $v12 \
+ ; ln -s $v10 $v11 || true; done
PHONY = auto boottrap rpm doc docs man manpages htmpages sdl testsdl \
comp compats msvc6 msvc7
+
+# ------------------------------------------------------------------ zzip64
+_FILE_OFFSET64 = -D_ZZIP_LARGEFILE -D_FILE_OFFSET_BITS=64
+_RELEASEINFO64 = "RELEASE_INFO=-release 0-64"
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
rpm2: dist-bzip2 $(PACKAGE).spec
rpmbuild -ta $(PACKAGE)-$(VERSION).tar.bz2
-zzip.html zzip.xml zzip.pdf \
-doc docu clean-doc clean-docs clean-docu \
-man manpages htmpages unpack clean-unpack \
-omf install-omf install-doc install-sfnet install-man3 docu x :
+doc docs docu clean-doc clean-docs clean-docu zzip.html zzip.xml zzip.pdf \
+man mans manpages htmpages unpack clean-unpack pdfs \
+omf install-omf install-doc install-docs install-sf install-man3 install-mans :
(cd docs && $(MAKE) `basename $@`)
sdl testsdl test-sdl install-sdl :
check-zzxor check-zzxordir check-zzxorcat \
check-sfx check-readme : \
(cd test && $(MAKE) `basename $@`)
-docs : docu
# ------------------------------------------------------------------------
test-comp:
zip -9r $(srcdir)/$(PACKAGE)-$(VERSION)-msvc6-bin.zip bin/
zip -9r $(srcdir)/$(PACKAGE)-$(VERSION)-msvc6-lib.zip lib/ include/
rm -r bin lib include
+
+zzip64-setup: zzip64-setup.tmp
+zzip64-setup.tmp : zzip/Makefile zzip/_config.h zzip/.deps/* zzip/zziplib.pc
+ - mkdir zzip64
+ cp -a zzip/Makefile zzip/_config.h zzip/.deps/ zzip/zziplib.pc zzip64/
+ date > zzip64.dir
+zzip64-build: zzip64-build.tmp
+zzip64-build.tmp : zzip64-setup.tmp $(top_srcdir)/zzip/*
+ cd zzip64 && $(MAKE) "AM_CFLAGS=$(_FILE_OFFSET64)" $(_RELEASEINFO64)
+zzip64-install: zzip64-install.tmp
+zzip64-install.tmp : zzip64-build.tmp
+ cd zzip64 && $(MAKE) install $(_RELEASEINFO64)
+ cd $(DESTDIR)$(libdir) && mv libzzip.so libzzip64.so
+ cd $(DESTDIR)$(libdir) && mv libzzip.a libzzip64.a
+ cd $(DESTDIR)$(libdir) && \
+ sed -e 's/zzip.so/zzip64.so/' \
+ -e 's/zzip.a/zzip64.a/' libzzip.la > libzzip64.la
+ cd $(DESTDIR)$(libdir)/pkgconfig && \
+ sed -e 's/largefile=/largefile= %_FILE_OFFSET64/' \
+ -e 's/-lzzip/-lzzip64/' \
+ -e 's/zziplib/zziplib64/' zziplib.pc > zziplib64.pc
+zzip32-postinstall:
+ cd $(DESTDIR)$(libdir) && mv libzzip.so libzzip32.so
+ cd $(DESTDIR)$(libdir) && mv libzzip.a libzzip32.a
+ cd $(DESTDIR)$(libdir) && ln -s libzzip32.so libzzip.so
+ cd $(DESTDIR)$(libdir) && ln -s libzzip32.a libzzip.a
+ cd $(DESTDIR)$(libdir) && \
+ sed -e 's/zzip.so/zzip32.so/' \
+ -e 's/zzip.a/zzip32.a/' libzzip.la > libzzip32.la
+ cd $(DESTDIR)$(libdir)/pkgconfig && \
+ sed -e 's/-lzzip/-lzzip32/' \
+ -e 's/zziplib/zziplib32/' zziplib.pc > zziplib32.pc
+zzip-postinstall:
+ : "the 12.8x and 11.8x and 10.8x packages are all the same actually"
+ cd $(DESTDIR)$(libdir) || exit 1 \
+ ; for i in libzzip*.so.1? ; do : \
+ ; v10=`echo $i | sed -e "s/.so.../.so.10/"` \
+ ; v11=`echo $i | sed -e "s/.so.../.so.11/"` \
+ ; v12=`echo $i | sed -e "s/.so.../.so.12/"` \
+ ; test ! -e $v10 && test -e $v12 && ln -s $v12 $v10 \
+ ; test ! -e $v12 && test -e $v10 && ln -s $v10 $v12 \
+ ; ln -s $v10 $v11 || true; done
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
automake -a -c
rpm: dist-bzip $(PACKAGE).spec
- rpmbuild -ta $(PACKAGE)-$(VERSION).tar.bz2
+ rpmbuild -ta pub/$(PACKAGE)-$(VERSION).tar.bz2
dist-bzip : dist-bzip2
$(MAKE) dist-bzip2-done
PYRUN = $(PYDEFS) @PYTHON@ $(PYFLAGS)
PLRUN = $(PLDEFS) @PERL@ $(PLFLAGS)
+DELETE = echo deleting...
doc_FILES = README.MSVC6 README.SDL COPYING.MPL COPYING.LIB COPYING.ZLIB \
- zziplib.html
+ zziplib.html zzipmmapped.html zzipfseeko.html
htm_FILES = zzip-index.htm zzip-zip.htm zzip-file.htm zzip-sdl-rwops.htm \
zzip-extio.htm zzip-xor.htm zzip-crypt.htm zzip-cryptoid.htm \
zzip-api.htm zzip-basics.htm zzip-extras.htm zzip-parse.htm \
64on32.htm future.htm fseeko.htm mmapped.htm memdisk.htm \
configs.htm sfx-make.htm developer.htm download.htm \
- history.htm referentials.htm faq.htm copying.htm
+ history.htm referentials.htm faq.htm copying.htm \
+ functions.htm
SDL = @top_srcdir@/SDL
SDL_RWOPS = $(SDL)/SDL_rwops_zzcat.c \
$(SDL)/SDL_rwops_zzip.c $(SDL)/SDL_rwops_zzip.h
EXTRA_DIST = make-doc.py $(doc_FILES) $(htm_FILES) $(SDL_RWOPS) \
make-doc.pl make-dbk.pl mksite.sh mksite.pl body.htm \
- manpages.ar zziplib-master.dbk $(zzipdoc_FILES)
+ manpages.ar zziplib-manpages.dbk zziplib-master.dbk \
+ $(zzipdoc_FILES) sdocbook.css
CLEANFILES = *.pc *.omf
DISTCLEANFILES = zziplib.spec manpages.ar htmpages.ar *.html *.xml
zzipdoc/dbk2htm.py zzipdoc/htm2dbk.py \
zzipdoc/functionheader.py zzipdoc/options.py \
zzipdoc/functionlisthtmlpage.py zzipdoc/textfileheader.py \
- zzipdoc/functionlistreference.py zzipdoc/textfile.py
- zzipdoc/functionprototype.py
+ zzipdoc/functionlistreference.py zzipdoc/textfile.py \
+ zzipdoc/functionprototype.py zzipdoc/htmldocument.py \
+ zzipdoc/docbookdocument.py
html_FILES = $(htm_FILES:.htm=.html) \
$(htm_FILES:.htm=.print.html) \
# docu : docs
docu :
- rm zziplib2.html zzipmmapped.html zzipfseeko.html
- $(MAKE) zziplib2.html
- $(MAKE) zzipmmapped.html
- $(MAKE) zzipfseeko.html
- $(MAKE) zziplib-man3.tar.gz
-
-zziplib.html : zziplib1.html zziplib0.html
- - test -s zziplib0.html && cp zziplib0.html zziplib.html
- - test -s zziplib1.html && cp zziplib1.html zziplib.html
- - test -s zziplib2.html && cp zziplib2.html zziplib.html
- test -s $@
-zziplib.xml : zziplib1.xml zziplib0.xml
- - test -s zziplib0.xml && cp zziplib0.xml zziplib.xml
- - test -s zziplib1.xml && cp zziplib1.xml zziplib.xml
- - test -s zziplib2.xml && cp zziplib2.xml zziplib.xml
- test -s $@ || rm $@
-
-_zziplib0 = $(zziplib0) \
- "suffix=0" "package=$(PACKAGE)" "version=$(VERSION)" \
- "mainheader=zzip/zzip.h" "exported=<zzip/zzip.h> // or <zziplib.h>" \
- "docbookfile=$@"
-zziplib0.html : zziplib0.xml
-zziplib0.xml : zziplib.spec @srcdir@/Makefile.am @srcdir@/make-doc.pl \
- $(srcdir)/make-doc.pl @top_srcdir@/zzip/*.c
- - $(PLRUN) $(srcdir)/make-doc.pl @top_srcdir@/zzip/*.c $(_zziplib0)
- - test -s $@
-_zziplib1 = $(zziplib1) \
- "--suffix=1"
-zziplib1.html : zziplib1.xml
-zziplib1.xml : zziplib.spec @srcdir@/Makefile.am @srcdir@/make-doc.py \
- $(srcdir)/make-doc.py @top_srcdir@/zzip/*.c
- - $(PYRUN) $(srcdir)/make-doc.py @top_srcdir@/zzip/*.c $(_zziplib1)
- - test -f zziplib1.docbook && mv zziplib1.docbook $@ ; test -s $@
-_zziplib2 = $(zziplib2) "--package=$(PACKAGE)" "--version=$(VERSION)" \
- "--onlymainheader=zzip/lib.h" "--suffix=2"
-zziplib2.html : zziplib2.xml
-zziplib2.xml : zziplib.spec $(srcdir)/Makefile.am $(srcdir)/zzipdoc/*.py \
- $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c
- - $(PYRUN) $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c $(_zziplib2)
- - test -f zziplib2.docbook && mv zziplib2.docbook $@ ; test -s $@
-_zzipmmapped = $(zziplib2) "--package=$(PACKAGE)" "--version=$(VERSION)" \
- "--onlymainheader=zzip/mmapped.h" "--suffix=3"
-zzipmmapped.html : zzipmmapped.xml
-zzipmmapped.xml : zziplib.spec $(srcdir)/Makefile.am $(srcdir)/zzipdoc/*.py \
- $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c
- - $(PYRUN) $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c $(_zzipmmapped)
- - test -f zziplib3.docbook && mv zziplib3.docbook $@ ; test -s $@
-_zzipfseeko = $(zziplib2) "--package=$(PACKAGE)" "--version=$(VERSION)" \
- "--onlymainheader=zzip/fseeko.h" "--suffix=4"
-zzipfseeko.html : zzipfseeko.xml
-zzipfseeko.xml : zziplib.spec $(srcdir)/Makefile.am $(srcdir)/zzipdoc/*.py \
- $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c
- - $(PYRUN) $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c $(_zzipfseeko)
- - test -f zziplib4.docbook && mv zziplib4.docbook $@ ; test -s $@
-
-zziplib-man3.tar.gz : zziplib2.xml
- - mkdir zziplib-man3 || rm zziplib-man3/*
- (cd zziplib-man3 && xmlto man ../zziplib2.xml)
- (cd zziplib-man3 && xmlto man ../zzipmmapped.xml)
- (cd zziplib-man3 && xmlto man ../zzipfseeko.xml)
- tar czf $@ zziplib-man3/
+ $(MAKE) manpages.ar htmpages.ar DELETE=exit
+
+zziplib.html zziplib.xml : zziplib.spec $(srcdir)/Makefile.am \
+ $(srcdir)/zzipdoc/*.py \
+ $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c
+ $(PYRUN) $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c $(zziplib) \
+ "--package=$(PACKAGE)" "--version=$(VERSION)" \
+ "--onlymainheader=zzip/lib.h" "--output=zziplib"
+ test -s zziplib.docbook && mv zziplib.docbook zziplib.xml
+zzipmmapped.html zzipmmapped.xml : zziplib.spec $(srcdir)/Makefile.am \
+ $(srcdir)/zzipdoc/*.py \
+ $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c
+ $(PYRUN) $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c $(zziplib) \
+ "--package=$(PACKAGE)" "--version=$(VERSION)" \
+ "--onlymainheader=zzip/mmapped.h" "--output=zzipmmapped"
+ test -s zzipmmapped.docbook && mv zzipmmapped.docbook zzipmmapped.xml
+zzipfseeko.html zzipfseeko.xml : zziplib.spec $(srcdir)/Makefile.am \
+ $(srcdir)/zzipdoc/*.py \
+ $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c
+ $(PYRUN) $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c $(zziplib) \
+ "--package=$(PACKAGE)" "--version=$(VERSION)" \
+ "--onlymainheader=zzip/fseeko.h" "--output=zzipfseeko"
+ test -s zzipfseeko.docbook && mv zzipfseeko.docbook zzipfseeko.xml
omfdir=${datadir}/omf
pkgomfdir=${omfdir}/${PACKAGE}
SFNETDIR=/groups/z/zz/zziplib/htdocs
-SFNETDOC=${datadir}${SFNETDIR}
-pkgdocdir=${datadir}${SFNETDIR}
+pkgdocdir=${mandir}/../doc/${PACKAGE}
bins = @top_srcdir@/bins
DOCEXAMPLES = $(bins)/zzdir.c $(bins)/zzcat.c \
$(bins)/zzobfuscated.c $(bins)/zziptest.c \
$(bins)/zzxordir.c $(bins)/zzxorcat.c \
$(bins)/zzxorcopy.c $(SDL_RWOPS)
-install-docu: $(doc_FILES) $(man_FILES) site.html $(PACKAGE)-doc.omf
+install-docs: $(doc_FILES) $(man_FILES) site.html htmpages.ar
$(mkinstalldirs) $(DESTDIR)$(pkgdocdir)
- for i in $(html_FILES) ; do cat $$i \
- | sed -e 's:--START-->:-- :' -e 's:<!--ENDS--: --:' \
- -e "s:\\(href=\"[^/\"]*\\)[.]html\":\\1.htm\":" \
- -e "s:\\(href=\"[^/\"]*\\)[.]html\#:\\1.htm\#:" \
- > $(DESTDIR)$(pkgdocdir)/$$i ; done
- @ for i in $(doc_FILES) $(DOCEXAMPLES) $(srcdir)/README.* \
- ; do $(INSTALL_DATA) `test -f $$i || echo $(srcdir)/`$$i \
- $(DESTDIR)$(pkgdocdir) ; done
- (cd $(DESTDIR)$(pkgdocdir) && ln -sf zziplib.html zziplib.htm)
+ $(INSTALL_DATA) $(html_FILES) $(DESTDIR)$(pkgdocdir)
+ for i in $(doc_FILES) $(DOCEXAMPLES) $(changelog) $(srcdir)/README.* \
+ ; do $(INSTALL_DATA) `test -f $$i || echo $(srcdir)/`$$i \
+ $(DESTDIR)$(pkgdocdir) ; done
+ cd $(DESTDIR)$(pkgdocdir) && ln -sf zzip-index.html index.html
+ $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/man
+ @ echo ar x htmpages.ar '>>>' $(DESTDIR)$(pkgdocdir)/man/ \
+ ; test -f htmpages.ar || cd "$srcdir" ; P=`pwd` \
+ ; cd $(DESTDIR)$(pkgdocdir)/man && ar x $$P/htmpages.ar
+
+install-doc : install-docs $(PACKAGE)-doc.omf
$(mkinstalldirs) $(DESTDIR)$(pkgomfdir)
$(INSTALL_DATA) $(PACKAGE)-doc.omf $(DESTDIR)$(pkgomfdir)/
- test ".$(DESTDIR)" != "." || scrollkeeper-update
-install-sfnet: $(doc_FILES) $(man_FILES) site.html htmpages.ar
- $(mkinstalldirs) $(DESTDIR)$(SFNETDOC)
- $(INSTALL_DATA) $(html_FILES) $(DESTDIR)$(SFNETDOC)
- for i in $(doc_FILES) $(DOCEXAMPLES) $(changelog) $(srcdir)/README.* \
- ; do $(INSTALL_DATA) `test -f $$i || echo $(srcdir)/`$$i \
- $(DESTDIR)$(SFNETDOC) ; done
- (cd $(DESTDIR)$(SFNETDOC) && ln -sf zzip-index.html index.html)
- $(mkinstalldirs) $(DESTDIR)$(SFNETDOC)/man
- (test -f htmpages.ar || cd "$srcdir" ; P=`pwd` \
- ; cd $(DESTDIR)$(SFNETDOC)/man && ar x $$P/htmpages.ar)
+install-sf:
+ $(MAKE) install-docs DESTDIR=/tmp/zziplib-htdocs-$$USER/
+ echo scp ... shell.sf.net:$(pkgdocdir)/ ; sleep 4
+ scp -r /tmp/zziplib-htdocs-$$USER/$(pkgdocdir)/* \
+ shell.sf.net:/home/$(SFNETDIR)/
+ rm -r /tmp/zziplib-htdocs-$$USER/
-install-doc : install-docu install-sfnet
+# ------------------------------------------------------------ package manpages
+mans : man3
+install-mans : install-man3
-# --------------------------------------------------------------------
-man manpages : manpages.ar
-htm htmpages : htmpages.ar
+man3 man manpages : manpages.ar
+html htm htmpages : htmpages.ar
-manpages.ar : zziplib.xml
+manpages.ar : zziplib.xml zzipmmapped.xml zzipfseeko.xml
+ : "unix man format of the manpages - goes to ../share/man/man3"
@ if test "$(XMLTO)" = ":" \
; then echo no xmlto found - could not regenerate "$@" - skipped \
; echo just touching the output file "$@" ; touch "$@" \
; else echo going to regenerate "$@" in subdir "'"man"'" \
- ; echo 'test ! -d man || rm man/* ; test -d man || mkdir man' \
- ; test ! -d man || rm man/* ; test -d man || mkdir man \
- ; echo '(cd man && xmlto man ../zziplib.xml)' \
- ; (cd man && xmlto man ../zziplib.xml) \
+ ; echo 'test ! -d man3 || rm man3/* ; test -d man3 || mkdir man3' \
+ ; test ! -d man3 || rm man3/* ; test -d man3 || mkdir man3 \
+ ; echo '$(XMLTO) -o man3 man zziplib.xml' \
+ ; $(XMLTO) -o man3 man zziplib.xml \
+ ; echo '$(XMLTO) -o man3 man zzipmmapped.xml' \
+ ; $(XMLTO) -o man3 man zzipmmapped.xml \
+ ; echo '$(XMLTO) -o man3 man zzipfseeko.xml' \
+ ; $(XMLTO) -o man3 man zzipfseeko.xml \
; echo 'test ! -f $@ || mv $@ $@.old' \
; test ! -f $@ || mv $@ $@.old \
- ; echo '(cd man && ar qc ../$@ *.3)' \
- ; (cd man && ar qc ../$@ *.3) \
- ; echo '(rm man/*.3 ; rmdir man)' \
- ; (rm man/*.3 ; rmdir man) \
+ ; echo 'ar qc "$@" man3/*.3' \
+ ; ar qc "$@" man3/*.3 \
+ ; echo '$(DELETE); rm man/*.3 ; rmdir man' \
+ ; $(DELETE); rm man/*.3 ; rmdir man \
; fi ; test -s $@ || mv $@.old $@ \
|| mv $(srcdir)/$@.old $@ || test -s $@.old >$@
-htmpages.ar : zziplib.xml
+htmpages.ar : zziplib.xml zzipmmapped.xml zzipfseeko.xml zziplib-manpages.dbk
+ : "html format of the manpages - put into zziplib/htdocs/man/*"
@ if test "$(XMLTO)" = ":" \
; then echo no xmlto found - could not regenerate "$@" - skipped \
; echo just touching the output file "$@" ; touch "$@" \
- ; else echo going to regenerate "$@" in subdir "'"man"'" \
- ; echo 'test ! -d man || rm /* ; test -d man || mkdir man' \
- ; test ! -d man || rm man/* ; test -d man || mkdir man \
- ; echo '(cd man && xmlto html ../zziplib.xml | tee written.lst)' \
- ; (cd man && xmlto html ../zziplib.xml | tee written.lst) \
+ ; else echo going to regenerate "$@" in subdir "'"html"'" \
+ ; echo 'test ! -d html || rm /* ; test -d html || mkdir html' \
+ ; test ! -d html || rm html/* ; test -d html || mkdir html \
+ ; echo 'cp $(srcdir)/zziplib-manpages.dbk zziplib-manpages.xml' \
+ ; cp $(srcdir)/zziplib-manpages.dbk zziplib-manpages.xml \
+ ; echo '$(XMLTO) -o html html zziplib-manpages.xml | tee written.lst' \
+ ; $(XMLTO) -o html html zziplib-manpages.xml | tee written.lst \
; echo 'test ! -f $@ || mv $@ $@.old' \
; test ! -f $@ || mv $@ $@.old \
- ; echo '(cd man && ar qc ../$@ *.*)' \
- ; (cd man && ar qc ../$@ *.*) \
- ; echo '(rm man/*.* ; rmdir man)' \
- ; (rm man/*.* ; rmdir man) \
+ ; echo 'ar qc $@ html/*.*' \
+ ; ar qc $@ html/*.* \
+ ; echo '$(DELETE); rm html/*.* ; rmdir html' \
+ ; $(DELETE); rm html/*.* ; rmdir html \
; fi ; test -s $@ || mv $@.old $@ \
|| mv $(srcdir)/$@.old $@ || test -s $@.old >$@
rm -rf _htm
rm -rf _man
-# -------------------------------------------------------------------
+# --------------------------------------------------------------- OMF handling
spec_file=$(top_srcdir)/$(PACKAGE).spec
DOCSERIES= 775fb73e-1874-11d7-93e9-e18cd7ea3c2e
FROMSPEC= $(spec_file) | head -1 | sed -e 's,<,\<,g' -e 's,>,\>,g'
DATESPEC= `date +%Y-%m-%d`
$(PACKAGE)-doc.omf : $(spec_file) Makefile
+ : "OMF for the html documentation - a copy of zziplib.sf.net"
echo '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>' >$@
echo '<omf><resource><creator> Guido Draheim </creator>' >>$@
grep Packager $(FROMSPEC) | sed -e 's,Packager *: *, <maintainer>,' \
grep Group $(FROMSPEC) | sed -e 's,Group *: *, <subject category=",' \
-e 's,/,|,g' -e '/<subject/s,$$," />,' >>$@
echo ' <format mime="text/html"/>' >>$@
- echo ' <identifier url="file:$(pkgdocdir)/zzip-index.htm"/>' >>$@
+ pkgdocdir=`echo "$(pkgdocdir)" | sed -e "s|/[a-z][a-z]*/[.][.]/|/|"` \
+ echo ' <identifier url="file:'"$$pkgdocdir"'/zzip-index.html"/>' >>$@
echo ' <language code="C"/>' >>$@
echo ' <relation seriesid="$(DOCSERIES)"/>' >>$@
echo ' <rights type="GNU LGPL" holder="Guido Draheim"' >>$@
- echo ' license="$(pkgdocdir)/COPYING.LIB"/>' >>$@
+ pkgdocdir=`echo "$(pkgdocdir)" | sed -e "s|/[a-z][a-z]*/[.][.]/|/|"` \
+ echo ' license="'"$$pkgdocdir"')/COPYING.LIB"/>' >>$@
echo '</resource></omf>' >>$@
DOCBOOKDTD= -//OASIS/DTD Docbook V4.1.2//EN
MANSERIES= a302c642-1888-11d7-86f6-ba4b52ef847d
$(PACKAGE)-man.omf : $(PACKAGE)-doc.omf $(PACKAGE).xml
+ : "OMF for functions reference - the docbook master of the manpages"
sed -e 's,"text/html","text/xml" dtd="$(DOCBOOKDTD)",' \
-e 's,</title>, (Function Reference)</title>,' \
- -e 's,/index.html,/manpages.xml,' \
+ -e 's,/index.html,/xml/manpages.xml,' \
-e 's,$(DOCSERIES),$(MANSERIES),' $(PACKAGE)-doc.omf > $@
test -s $@ || rm $@
-omf : $(PACKAGE)-doc.omf $(PACKAGE)-man.omf $(PACKAGE).xml
-install-omf : $(PACKAGE)-doc.omf $(PACKAGE)-man.omf $(PACKAGE).xml
+omf : $(PACKAGE)-doc.omf $(PACKAGE)-man.omf
+install-omf : omf zziplib.xml zzipmmapped.xml zzipfseeko.xml
+ : "not installed by default anymore - 'make install-doc' has one OMF"
$(mkinstalldirs) $(DESTDIR)$(pkgomfdir)
$(INSTALL_DATA) $(PACKAGE)-doc.omf $(DESTDIR)$(pkgomfdir)/
$(mkinstalldirs) $(DESTDIR)$(pkgdocdir)
- $(INSTALL_DATA) $(PACKAGE).xml $(DESTDIR)$(pkgdocdir)/manpages.xml
+ $(INSTALL_DATA) $(srcdir)/zziplib-manpages.xml \
+ $(DESTDIR)$(pkgdocdir)/xml/manpages.xml
+ $(INSTALL_DATA) zziplib.xml zzipmmapped.xml zzipfseeko.xml \
+ $(DESTDIR)$(pkgdocdir)/xml/
$(INSTALL_DATA) $(PACKAGE)-man.omf $(DESTDIR)$(pkgomfdir)/
- test ".$(DESTDIR)" != "." || scrollkeeper-update -v
-# -------------------------------------------------------------------
+# ----------------------------------------------- mksite.sh for the main html
site.htm : body.htm
cp $(srcdir)/body.htm site.htm
-mksite_sh_args = --VERSION=$(VERSION) --xml --src-dir=$(srcdir)
-site.html : site.htm mksite.sh $(htm_FILES)
+mksite_sh_args = --VERSION=$(VERSION) --xml --src-dir=$(srcdir) --print
+site.html : body.htm site.htm mksite.sh $(htm_FILES)
+ cp $(srcdir)/body.htm site.htm
perl $(srcdir)/mksite.pl $(mksite_sh_args) site.htm || \
$(SHELL) $(srcdir)/mksite.sh $(mksite_sh_args) site.htm
# ----------------------------------------------- create pdf via docbook xml
+# sorry, the xmlto / docbook-xsl are too broken to rebuild the PDF anymore
+
zzip.xml : $(htm_FILES) zziplib.xml make-dbk.pl
: '@PERL@ make-dbk.pl $(htm_FILES) zziplib.xml >$@'
@PYTHON@ $(srcdir)/zzipdoc/htm2dbk.py $(htm_FILES) zziplib.xml >$@
xmlto pdf zziplib.docbook ; rm zziplib.docbook
test -s zziplib.pdf
-pdf : zziplib.pdf
+pdfs : zziplib.pdf
AUTOTOOL_VERSION = autoconf-2.52 automake-1.5 libtool-1.4.2
PYRUN = $(PYDEFS) @PYTHON@ $(PYFLAGS)
PLRUN = $(PLDEFS) @PERL@ $(PLFLAGS)
+DELETE = echo deleting...
doc_FILES = README.MSVC6 README.SDL COPYING.MPL COPYING.LIB COPYING.ZLIB \
- zziplib.html
+ zziplib.html zzipmmapped.html zzipfseeko.html
htm_FILES = zzip-index.htm zzip-zip.htm zzip-file.htm zzip-sdl-rwops.htm \
zzip-extio.htm zzip-xor.htm zzip-crypt.htm zzip-cryptoid.htm \
zzip-api.htm zzip-basics.htm zzip-extras.htm zzip-parse.htm \
64on32.htm future.htm fseeko.htm mmapped.htm memdisk.htm \
configs.htm sfx-make.htm developer.htm download.htm \
- history.htm referentials.htm faq.htm copying.htm
+ history.htm referentials.htm faq.htm copying.htm \
+ functions.htm
SDL_RWOPS = $(SDL)/SDL_rwops_zzcat.c \
$(SDL)/SDL_rwops_zzip.c $(SDL)/SDL_rwops_zzip.h
changelog = @top_srcdir@/ChangeLog
EXTRA_DIST = make-doc.py $(doc_FILES) $(htm_FILES) $(SDL_RWOPS) \
make-doc.pl make-dbk.pl mksite.sh mksite.pl body.htm \
- manpages.ar zziplib-master.dbk $(zzipdoc_FILES)
+ manpages.ar zziplib-manpages.dbk zziplib-master.dbk \
+ $(zzipdoc_FILES) sdocbook.css
CLEANFILES = *.pc *.omf
DISTCLEANFILES = zziplib.spec manpages.ar htmpages.ar *.html *.xml
zzipdoc/dbk2htm.py zzipdoc/htm2dbk.py \
zzipdoc/functionheader.py zzipdoc/options.py \
zzipdoc/functionlisthtmlpage.py zzipdoc/textfileheader.py \
- zzipdoc/functionlistreference.py zzipdoc/textfile.py
+ zzipdoc/functionlistreference.py zzipdoc/textfile.py \
+ zzipdoc/functionprototype.py zzipdoc/htmldocument.py \
+ zzipdoc/docbookdocument.py
html_FILES = $(htm_FILES:.htm=.html) \
$(htm_FILES:.htm=.print.html) \
site.html site.print.html
-_zziplib0 = $(zziplib0) \
- "suffix=0" "package=$(PACKAGE)" "version=$(VERSION)" \
- "mainheader=zzip/zzip.h" "exported=<zzip/zzip.h> // or <zziplib.h>" \
- "docbookfile=$@"
-
-_zziplib1 = $(zziplib1) \
- "--suffix=1"
-
-_zziplib2 = $(zziplib2) "--package=$(PACKAGE)" "--version=$(VERSION)" \
- "--onlymainheader=zzip/lib.h" "--suffix=2"
-
-_zzipmmapped = $(zziplib2) "--package=$(PACKAGE)" "--version=$(VERSION)" \
- "--onlymainheader=zzip/mmapped.h" "--suffix=3"
-
-_zzipfseeko = $(zziplib2) "--package=$(PACKAGE)" "--version=$(VERSION)" \
- "--onlymainheader=zzip/fseeko.h" "--suffix=4"
-
omfdir = ${datadir}/omf
pkgomfdir = ${omfdir}/${PACKAGE}
SFNETDIR = /groups/z/zz/zziplib/htdocs
-SFNETDOC = ${datadir}${SFNETDIR}
-pkgdocdir = ${datadir}${SFNETDIR}
+pkgdocdir = ${mandir}/../doc/${PACKAGE}
bins = @top_srcdir@/bins
DOCEXAMPLES = $(bins)/zzdir.c $(bins)/zzcat.c \
$(bins)/zzobfuscated.c $(bins)/zziptest.c \
$(bins)/zzxorcopy.c $(SDL_RWOPS)
-# -------------------------------------------------------------------
+# --------------------------------------------------------------- OMF handling
spec_file = $(top_srcdir)/$(PACKAGE).spec
DOCSERIES = 775fb73e-1874-11d7-93e9-e18cd7ea3c2e
FROMSPEC = $(spec_file) | head -1 | sed -e 's,<,\<,g' -e 's,>,\>,g'
DATESPEC = `date +%Y-%m-%d`
DOCBOOKDTD = -//OASIS/DTD Docbook V4.1.2//EN
MANSERIES = a302c642-1888-11d7-86f6-ba4b52ef847d
-mksite_sh_args = --VERSION=$(VERSION) --xml --src-dir=$(srcdir)
+mksite_sh_args = --VERSION=$(VERSION) --xml --src-dir=$(srcdir) --print
all: all-am
.SUFFIXES:
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+pdf: pdf-am
+
pdf-am:
ps: ps-am
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
uninstall-info-am
- zzipdoc/functionprototype.py
default : doc
clean-doc clean-docs : clean-unpack
# docu : docs
docu :
- rm zziplib2.html zzipmmapped.html zzipfseeko.html
- $(MAKE) zziplib2.html
- $(MAKE) zzipmmapped.html
- $(MAKE) zzipfseeko.html
- $(MAKE) zziplib-man3.tar.gz
-
-zziplib.html : zziplib1.html zziplib0.html
- - test -s zziplib0.html && cp zziplib0.html zziplib.html
- - test -s zziplib1.html && cp zziplib1.html zziplib.html
- - test -s zziplib2.html && cp zziplib2.html zziplib.html
- test -s $@
-zziplib.xml : zziplib1.xml zziplib0.xml
- - test -s zziplib0.xml && cp zziplib0.xml zziplib.xml
- - test -s zziplib1.xml && cp zziplib1.xml zziplib.xml
- - test -s zziplib2.xml && cp zziplib2.xml zziplib.xml
- test -s $@ || rm $@
-zziplib0.html : zziplib0.xml
-zziplib0.xml : zziplib.spec @srcdir@/Makefile.am @srcdir@/make-doc.pl \
- $(srcdir)/make-doc.pl @top_srcdir@/zzip/*.c
- - $(PLRUN) $(srcdir)/make-doc.pl @top_srcdir@/zzip/*.c $(_zziplib0)
- - test -s $@
-zziplib1.html : zziplib1.xml
-zziplib1.xml : zziplib.spec @srcdir@/Makefile.am @srcdir@/make-doc.py \
- $(srcdir)/make-doc.py @top_srcdir@/zzip/*.c
- - $(PYRUN) $(srcdir)/make-doc.py @top_srcdir@/zzip/*.c $(_zziplib1)
- - test -f zziplib1.docbook && mv zziplib1.docbook $@ ; test -s $@
-zziplib2.html : zziplib2.xml
-zziplib2.xml : zziplib.spec $(srcdir)/Makefile.am $(srcdir)/zzipdoc/*.py \
- $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c
- - $(PYRUN) $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c $(_zziplib2)
- - test -f zziplib2.docbook && mv zziplib2.docbook $@ ; test -s $@
-zzipmmapped.html : zzipmmapped.xml
-zzipmmapped.xml : zziplib.spec $(srcdir)/Makefile.am $(srcdir)/zzipdoc/*.py \
- $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c
- - $(PYRUN) $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c $(_zzipmmapped)
- - test -f zziplib3.docbook && mv zziplib3.docbook $@ ; test -s $@
-zzipfseeko.html : zzipfseeko.xml
-zzipfseeko.xml : zziplib.spec $(srcdir)/Makefile.am $(srcdir)/zzipdoc/*.py \
- $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c
- - $(PYRUN) $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c $(_zzipfseeko)
- - test -f zziplib4.docbook && mv zziplib4.docbook $@ ; test -s $@
-
-zziplib-man3.tar.gz : zziplib2.xml
- - mkdir zziplib-man3 || rm zziplib-man3/*
- (cd zziplib-man3 && xmlto man ../zziplib2.xml)
- (cd zziplib-man3 && xmlto man ../zzipmmapped.xml)
- (cd zziplib-man3 && xmlto man ../zzipfseeko.xml)
- tar czf $@ zziplib-man3/
-
-install-docu: $(doc_FILES) $(man_FILES) site.html $(PACKAGE)-doc.omf
+ $(MAKE) manpages.ar htmpages.ar DELETE=exit
+
+zziplib.html zziplib.xml : zziplib.spec $(srcdir)/Makefile.am \
+ $(srcdir)/zzipdoc/*.py \
+ $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c
+ $(PYRUN) $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c $(zziplib) \
+ "--package=$(PACKAGE)" "--version=$(VERSION)" \
+ "--onlymainheader=zzip/lib.h" "--output=zziplib"
+ test -s zziplib.docbook && mv zziplib.docbook zziplib.xml
+zzipmmapped.html zzipmmapped.xml : zziplib.spec $(srcdir)/Makefile.am \
+ $(srcdir)/zzipdoc/*.py \
+ $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c
+ $(PYRUN) $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c $(zziplib) \
+ "--package=$(PACKAGE)" "--version=$(VERSION)" \
+ "--onlymainheader=zzip/mmapped.h" "--output=zzipmmapped"
+ test -s zzipmmapped.docbook && mv zzipmmapped.docbook zzipmmapped.xml
+zzipfseeko.html zzipfseeko.xml : zziplib.spec $(srcdir)/Makefile.am \
+ $(srcdir)/zzipdoc/*.py \
+ $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c
+ $(PYRUN) $(srcdir)/makedocs.py @top_srcdir@/zzip/*.c $(zziplib) \
+ "--package=$(PACKAGE)" "--version=$(VERSION)" \
+ "--onlymainheader=zzip/fseeko.h" "--output=zzipfseeko"
+ test -s zzipfseeko.docbook && mv zzipfseeko.docbook zzipfseeko.xml
+
+install-docs: $(doc_FILES) $(man_FILES) site.html htmpages.ar
$(mkinstalldirs) $(DESTDIR)$(pkgdocdir)
- for i in $(html_FILES) ; do cat $$i \
- | sed -e 's:--START-->:-- :' -e 's:<!--ENDS--: --:' \
- -e "s:\\(href=\"[^/\"]*\\)[.]html\":\\1.htm\":" \
- -e "s:\\(href=\"[^/\"]*\\)[.]html\#:\\1.htm\#:" \
- > $(DESTDIR)$(pkgdocdir)/$$i ; done
- @ for i in $(doc_FILES) $(DOCEXAMPLES) $(srcdir)/README.* \
- ; do $(INSTALL_DATA) `test -f $$i || echo $(srcdir)/`$$i \
- $(DESTDIR)$(pkgdocdir) ; done
- (cd $(DESTDIR)$(pkgdocdir) && ln -sf zziplib.html zziplib.htm)
+ $(INSTALL_DATA) $(html_FILES) $(DESTDIR)$(pkgdocdir)
+ for i in $(doc_FILES) $(DOCEXAMPLES) $(changelog) $(srcdir)/README.* \
+ ; do $(INSTALL_DATA) `test -f $$i || echo $(srcdir)/`$$i \
+ $(DESTDIR)$(pkgdocdir) ; done
+ cd $(DESTDIR)$(pkgdocdir) && ln -sf zzip-index.html index.html
+ $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/man
+ @ echo ar x htmpages.ar '>>>' $(DESTDIR)$(pkgdocdir)/man/ \
+ ; test -f htmpages.ar || cd "$srcdir" ; P=`pwd` \
+ ; cd $(DESTDIR)$(pkgdocdir)/man && ar x $$P/htmpages.ar
+
+install-doc : install-docs $(PACKAGE)-doc.omf
$(mkinstalldirs) $(DESTDIR)$(pkgomfdir)
$(INSTALL_DATA) $(PACKAGE)-doc.omf $(DESTDIR)$(pkgomfdir)/
- test ".$(DESTDIR)" != "." || scrollkeeper-update
-install-sfnet: $(doc_FILES) $(man_FILES) site.html htmpages.ar
- $(mkinstalldirs) $(DESTDIR)$(SFNETDOC)
- $(INSTALL_DATA) $(html_FILES) $(DESTDIR)$(SFNETDOC)
- for i in $(doc_FILES) $(DOCEXAMPLES) $(changelog) $(srcdir)/README.* \
- ; do $(INSTALL_DATA) `test -f $$i || echo $(srcdir)/`$$i \
- $(DESTDIR)$(SFNETDOC) ; done
- (cd $(DESTDIR)$(SFNETDOC) && ln -sf zzip-index.html index.html)
- $(mkinstalldirs) $(DESTDIR)$(SFNETDOC)/man
- (test -f htmpages.ar || cd "$srcdir" ; P=`pwd` \
- ; cd $(DESTDIR)$(SFNETDOC)/man && ar x $$P/htmpages.ar)
+install-sf:
+ $(MAKE) install-docs DESTDIR=/tmp/zziplib-htdocs-$$USER/
+ echo scp ... shell.sf.net:$(pkgdocdir)/ ; sleep 4
+ scp -r /tmp/zziplib-htdocs-$$USER/$(pkgdocdir)/* \
+ shell.sf.net:/home/$(SFNETDIR)/
+ rm -r /tmp/zziplib-htdocs-$$USER/
-install-doc : install-docu install-sfnet
+# ------------------------------------------------------------ package manpages
+mans : man3
+install-mans : install-man3
-# --------------------------------------------------------------------
-man manpages : manpages.ar
-htm htmpages : htmpages.ar
+man3 man manpages : manpages.ar
+html htm htmpages : htmpages.ar
-manpages.ar : zziplib.xml
+manpages.ar : zziplib.xml zzipmmapped.xml zzipfseeko.xml
+ : "unix man format of the manpages - goes to ../share/man/man3"
@ if test "$(XMLTO)" = ":" \
; then echo no xmlto found - could not regenerate "$@" - skipped \
; echo just touching the output file "$@" ; touch "$@" \
; else echo going to regenerate "$@" in subdir "'"man"'" \
- ; echo 'test ! -d man || rm man/* ; test -d man || mkdir man' \
- ; test ! -d man || rm man/* ; test -d man || mkdir man \
- ; echo '(cd man && xmlto man ../zziplib.xml)' \
- ; (cd man && xmlto man ../zziplib.xml) \
+ ; echo 'test ! -d man3 || rm man3/* ; test -d man3 || mkdir man3' \
+ ; test ! -d man3 || rm man3/* ; test -d man3 || mkdir man3 \
+ ; echo '$(XMLTO) -o man3 man zziplib.xml' \
+ ; $(XMLTO) -o man3 man zziplib.xml \
+ ; echo '$(XMLTO) -o man3 man zzipmmapped.xml' \
+ ; $(XMLTO) -o man3 man zzipmmapped.xml \
+ ; echo '$(XMLTO) -o man3 man zzipfseeko.xml' \
+ ; $(XMLTO) -o man3 man zzipfseeko.xml \
; echo 'test ! -f $@ || mv $@ $@.old' \
; test ! -f $@ || mv $@ $@.old \
- ; echo '(cd man && ar qc ../$@ *.3)' \
- ; (cd man && ar qc ../$@ *.3) \
- ; echo '(rm man/*.3 ; rmdir man)' \
- ; (rm man/*.3 ; rmdir man) \
+ ; echo 'ar qc "$@" man3/*.3' \
+ ; ar qc "$@" man3/*.3 \
+ ; echo '$(DELETE); rm man/*.3 ; rmdir man' \
+ ; $(DELETE); rm man/*.3 ; rmdir man \
; fi ; test -s $@ || mv $@.old $@ \
|| mv $(srcdir)/$@.old $@ || test -s $@.old >$@
-htmpages.ar : zziplib.xml
+htmpages.ar : zziplib.xml zzipmmapped.xml zzipfseeko.xml zziplib-manpages.dbk
+ : "html format of the manpages - put into zziplib/htdocs/man/*"
@ if test "$(XMLTO)" = ":" \
; then echo no xmlto found - could not regenerate "$@" - skipped \
; echo just touching the output file "$@" ; touch "$@" \
- ; else echo going to regenerate "$@" in subdir "'"man"'" \
- ; echo 'test ! -d man || rm /* ; test -d man || mkdir man' \
- ; test ! -d man || rm man/* ; test -d man || mkdir man \
- ; echo '(cd man && xmlto html ../zziplib.xml | tee written.lst)' \
- ; (cd man && xmlto html ../zziplib.xml | tee written.lst) \
+ ; else echo going to regenerate "$@" in subdir "'"html"'" \
+ ; echo 'test ! -d html || rm /* ; test -d html || mkdir html' \
+ ; test ! -d html || rm html/* ; test -d html || mkdir html \
+ ; echo 'cp $(srcdir)/zziplib-manpages.dbk zziplib-manpages.xml' \
+ ; cp $(srcdir)/zziplib-manpages.dbk zziplib-manpages.xml \
+ ; echo '$(XMLTO) -o html html zziplib-manpages.xml | tee written.lst' \
+ ; $(XMLTO) -o html html zziplib-manpages.xml | tee written.lst \
; echo 'test ! -f $@ || mv $@ $@.old' \
; test ! -f $@ || mv $@ $@.old \
- ; echo '(cd man && ar qc ../$@ *.*)' \
- ; (cd man && ar qc ../$@ *.*) \
- ; echo '(rm man/*.* ; rmdir man)' \
- ; (rm man/*.* ; rmdir man) \
+ ; echo 'ar qc $@ html/*.*' \
+ ; ar qc $@ html/*.* \
+ ; echo '$(DELETE); rm html/*.* ; rmdir html' \
+ ; $(DELETE); rm html/*.* ; rmdir html \
; fi ; test -s $@ || mv $@.old $@ \
|| mv $(srcdir)/$@.old $@ || test -s $@.old >$@
rm -rf _man
$(PACKAGE)-doc.omf : $(spec_file) Makefile
+ : "OMF for the html documentation - a copy of zziplib.sf.net"
echo '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>' >$@
echo '<omf><resource><creator> Guido Draheim </creator>' >>$@
grep Packager $(FROMSPEC) | sed -e 's,Packager *: *, <maintainer>,' \
grep Group $(FROMSPEC) | sed -e 's,Group *: *, <subject category=",' \
-e 's,/,|,g' -e '/<subject/s,$$," />,' >>$@
echo ' <format mime="text/html"/>' >>$@
- echo ' <identifier url="file:$(pkgdocdir)/zzip-index.htm"/>' >>$@
+ pkgdocdir=`echo "$(pkgdocdir)" | sed -e "s|/[a-z][a-z]*/[.][.]/|/|"` \
+ echo ' <identifier url="file:'"$$pkgdocdir"'/zzip-index.html"/>' >>$@
echo ' <language code="C"/>' >>$@
echo ' <relation seriesid="$(DOCSERIES)"/>' >>$@
echo ' <rights type="GNU LGPL" holder="Guido Draheim"' >>$@
- echo ' license="$(pkgdocdir)/COPYING.LIB"/>' >>$@
+ pkgdocdir=`echo "$(pkgdocdir)" | sed -e "s|/[a-z][a-z]*/[.][.]/|/|"` \
+ echo ' license="'"$$pkgdocdir"')/COPYING.LIB"/>' >>$@
echo '</resource></omf>' >>$@
$(PACKAGE)-man.omf : $(PACKAGE)-doc.omf $(PACKAGE).xml
+ : "OMF for functions reference - the docbook master of the manpages"
sed -e 's,"text/html","text/xml" dtd="$(DOCBOOKDTD)",' \
-e 's,</title>, (Function Reference)</title>,' \
- -e 's,/index.html,/manpages.xml,' \
+ -e 's,/index.html,/xml/manpages.xml,' \
-e 's,$(DOCSERIES),$(MANSERIES),' $(PACKAGE)-doc.omf > $@
test -s $@ || rm $@
-omf : $(PACKAGE)-doc.omf $(PACKAGE)-man.omf $(PACKAGE).xml
-install-omf : $(PACKAGE)-doc.omf $(PACKAGE)-man.omf $(PACKAGE).xml
+omf : $(PACKAGE)-doc.omf $(PACKAGE)-man.omf
+install-omf : omf zziplib.xml zzipmmapped.xml zzipfseeko.xml
+ : "not installed by default anymore - 'make install-doc' has one OMF"
$(mkinstalldirs) $(DESTDIR)$(pkgomfdir)
$(INSTALL_DATA) $(PACKAGE)-doc.omf $(DESTDIR)$(pkgomfdir)/
$(mkinstalldirs) $(DESTDIR)$(pkgdocdir)
- $(INSTALL_DATA) $(PACKAGE).xml $(DESTDIR)$(pkgdocdir)/manpages.xml
+ $(INSTALL_DATA) $(srcdir)/zziplib-manpages.xml \
+ $(DESTDIR)$(pkgdocdir)/xml/manpages.xml
+ $(INSTALL_DATA) zziplib.xml zzipmmapped.xml zzipfseeko.xml \
+ $(DESTDIR)$(pkgdocdir)/xml/
$(INSTALL_DATA) $(PACKAGE)-man.omf $(DESTDIR)$(pkgomfdir)/
- test ".$(DESTDIR)" != "." || scrollkeeper-update -v
-# -------------------------------------------------------------------
+# ----------------------------------------------- mksite.sh for the main html
site.htm : body.htm
cp $(srcdir)/body.htm site.htm
-site.html : site.htm mksite.sh $(htm_FILES)
+site.html : body.htm site.htm mksite.sh $(htm_FILES)
+ cp $(srcdir)/body.htm site.htm
perl $(srcdir)/mksite.pl $(mksite_sh_args) site.htm || \
$(SHELL) $(srcdir)/mksite.sh $(mksite_sh_args) site.htm
# ----------------------------------------------- create pdf via docbook xml
+# sorry, the xmlto / docbook-xsl are too broken to rebuild the PDF anymore
+
zzip.xml : $(htm_FILES) zziplib.xml make-dbk.pl
: '@PERL@ make-dbk.pl $(htm_FILES) zziplib.xml >$@'
@PYTHON@ $(srcdir)/zzipdoc/htm2dbk.py $(htm_FILES) zziplib.xml >$@
xmlto pdf zziplib.docbook ; rm zziplib.docbook
test -s zziplib.pdf
-pdf : zziplib.pdf
+pdfs : zziplib.pdf
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
<br>-<a href="sfx-make.html"> Making a zip/exe</a>
<br>=<a href="history.html">Hints And Links</a>
<br>-<a href="referentials.html"> Referentials</a>
-<br> -<a href="zziplib.html"> Functions List #</a>
+<br>-<a href="functions.html"> Functions List..</a>
+<br> -<a href="zziplib.html"> zziplib.*</a>
+<br> -<a href="zzipmmapped.html"> zzipmmapped.*</a>
+<br> -<a href="zzipfseeko.html"> zzipfseeko.*</a>
<!--START-->
-<br> -<a href="man/index.html"> <small>The</small> Manual Pages #</a>
+<br> -<a href="man/index.html"><small> unix man pages</small></a>
<!--ENDS-->
-<br>    <small>(# autogenerated)</small>
-
+<br> 
<br>
<hr><a href="download.html"> Download Area </a>
<br><><a href="developer.html"> Developer Area </a>
--- /dev/null
+<H2> Exported Functions </H2>
+<date>2006-09-21</date>
+
+<P>
+ The ZZipLib Project does already profive THREE libraries. The classic
+ zziplib.so (via "zzip/lib.h") is the most prominent one and used in
+ a number of different projects. The zzipfseeko.so ("zzip/fseeko.html")
+ and zzipmmapped.so ("zzip/mmapped.html") are technology demonstrations.
+</P>
+
+<ul>
+<li><a href="zzip/lib.h"> zzip/lib.h </a> - Main User Library </li>
+<li><a href="zzip/mmapped.h"> zzip/mmapped.h </a> - MMap Library </li>
+<li><a href="zzip/fseeko.h"> zzip/fseeko.h </a> - Fseeko Library </li>
+</ul>
+
+<P>
+ Additonally, there is a complete set of unpacked documentation - the
+ unix manual pages are translated to html manual pages.
+</P>
+
+<ul>
+<li><a href="manual">zzip man pages</a>
+</ul>
+
+<p> </p>
+<p> </p>
+<p> </p>
from zzipdoc.functionlisthtmlpage import *
from zzipdoc.functionlistreference import *
from zzipdoc.dbk2htm import *
+from zzipdoc.htmldocument import *
+from zzipdoc.docbookdocument import *
def _src_to_xml(text):
return text.replace("&", "&").replace("<", "<").replace(">", ">")
# per_file.print_list_mainheader()
# per_function.print_list_titleline()
# per_function.print_list_name()
- per_family.print_list_name()
+ # per_family.print_list_name()
+ #
html = FunctionListHtmlPage(o)
for item in per_family.entries:
for func in item.functions:
html.add(func_adapter)
html.cut()
html.cut()
- html_filename = "zziplib"+o.suffix+".html"
- try:
- print "writing "+html_filename
- fd = open(html_filename, "w")
- print >>fd, section2html(paramdef2html(html.xml_text()))
- fd.close()
- except IOError, e:
- print "could not open '"+html_filename+"'file", e
+ class _Html_:
+ def __init__(self, html):
+ self.html = html
+ def html_text(self):
+ return section2html(paramdef2html(self.html.xml_text()))
+ def get_title(self):
+ return self.html.get_title()
+ HtmlDocument(o).add(_Html_(html)).save(o.output+o.suffix)
+ #
man3 = FunctionListReference(o)
for item in per_family.entries:
for func in item.functions:
& func_adapter.src_mainheader()):
continue
man3.add(func_adapter)
- man3.add_overview(func_adapter)
man3.cut()
man3.cut()
- man3_filename = "zziplib"+o.suffix+".docbook"
- try:
- print "writing "+man3_filename
- fd = open(man3_filename, "w")
- print >>fd, man3.xml_text()
- fd.close()
- except IOError, e:
- print "could not open '"+man3_filename+"'file", e
+ DocbookDocument(o).add(man3).save(o.output+o.suffix)
if __name__ == "__main__":
o = Options()
o.package = "ZZipLib"
o.program = sys.argv[0]
+ o.html = "html"
+ o.docbook = "docbook"
+ o.output = "zziplib"
+ o.suffix = ""
for item in sys.argv[1:]:
if o.scan(item): continue
filenames += [ item ]
# this is the perl variant of the mksite script. It based directly on a
# copy of mksite.sh which is derived from snippets that I was using to
# finish doc pages for website publishing. Using only sh/sed along with
-# files has a great disadvantage: it is very slow process atleast. The
+# files has a great disadvantage: it is a very slow process atleast. The
# perl language in contrast has highly optimized string, replace, search
# functions as well as data structures to store intermediate values. As
# an advantage large parts of the syntax are similar to the sh/sed variant.
#
# 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.
# 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.pl,v 1.1 2005-12-13 00:27:06 guidod Exp $
+# $Id: mksite.pl,v 1.2 2006-09-22 00:33:22 guidod Exp $
use strict; use warnings; no warnings "uninitialized";
use File::Basename qw(basename);
# my $MK="-mksite"; # note the "-" at the start
my $SED="sed";
-my $INFO="~~"; # extension for meta data files
+my $DATA="~~"; # extension for meta data files
my $HEAD="~head~"; # extension for head sed script
my $BODY="~body~"; # extension for body sed script
my $FOOT="~foot~"; # append to body text (non sed)
my $AX="$AA.+-"; # script more readable
my $n = "\n";
+my $Q = "q class";
+my $QX = "/q";
# 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
+my @HTMLTAGS = qw/a 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/;
+my @HTMLTAGS2 = qw/html head body title meta http-equiv style link/;
+
+# ==========================================================================
+my $hint="";
+
+sub echo
+{
+ print join(" ",@_),$n;
+}
+sub error
+{
+ print STDERR "ERROR: ", join(" ",@_),$n;
+}
+sub warns
+{
+ print STDERR "WARN: ", join(" ",@_), $n;
+}
+sub hint
+{
+ print STDERR "NOTE: ", join(" ", @_), $n if $hint;
+}
+sub init
+{
+ $hint="1" if -d "DEBUG";
+}
+
+&init ("NOW!!!");
+
+sub ls_s {
+ my $x=`ls -s @_`;
+ chomp($x);
+ return $x;
+}
+
# ==========================================================================
# reading options from the command line GETOPT
my %o = (); # to store option variables
if (/^-.*=.*$/) {
$opt=$arg; $opt =~ s/-*([$AA][$AA-]*).*/$1/; $opt =~ y/-/_/;
if (not $opt) {
- print STDERR "ERROR: invalid option $arg$n";
+ error "invalid option $arg";
} else {
$arg =~ s/^[^=]*=//;
$o{$opt} = $arg;
$o{variables} .= " ".$opt;
}
$opt="";;
- } elsif (/^-.*-.*$/) {
+ } elsif (/^-.*.-.*$/) {
$opt=$arg; $opt =~ s/-*([$AA][$AA-]*).*/$1/; $opt =~ y/-/_/;
if (not $opt) {
- print STDERR "ERROR: invalid option $arg$n";
+ error "invalid option $arg";
$opt="";
} else {
# keep the option for next round
} elsif (/^-.*/) {
$opt=$arg; $opt =~ s/^-*([$AA][$AA-]*).*/$1/; $opt =~ y/-/_/;
if (not $opt) {
- print STDERR "ERROR: invalid option $arg$n";
+ error "invalid option $arg";
} else {
$arg =~ s/^[^=]*=//;
$o{$opt} = ' ';
}
$opt="" ;;
} else {
+ hint "<$arg>";
if (not $o{main_file}) { $o{main_file} = $arg; } else {
$o{files} .= $o{fileseparator} if $o{files};
$o{files} .= $arg; };
$SITEFILE=$o{main_file} if $o{main_file} and -f $o{main_file};
$SITEFILE=$o{site_file} if $o{site_file} and -f $o{site_file};
+$hint="1" if $o{debug};
if ($o{help}) {
$_=$SITEFILE;
- print "$0 [sitefile]$n";
- print " default sitefile = $_$n";
- print "options:$n"
- . " --filelist : show list of target files as ectracted from $_$n"
- . " --src xx : if source files are not where mksite is executed$n";
+ echo "$0 [sitefile]";
+ echo " default sitefile = $_ ($o{main_file}) ($o{files})";
+ echo "options:";
+ echo " --filelist : show list of target files as ectracted from $_";
+ echo " --src-dir xx : if source files are not where mksite is executed";
+ echo " --tmp-dir xx : use temp instead of local directory";
+ echo " --tmp : use automatic temp directory in \$TEMP/mksite.*";
exit;
- print " internal:$n"
- ."--fileseparator=x : for building the internal filelist (def. '?')$n"
- ."--files xx : for list of additional files to be processed$n"
- ."--main-file xx : for the main sitefile to take file list from$n";
+ echo " internal:";
+ echo "--fileseparator=x : for building the internal filelist (def. '?')";
+ echo "--files xx : for list of additional files to be processed";
+ echo "--main-file xx : for the main sitefile to take file list from";
}
if (not $SITEFILE) {
- print STDERR "error: no SITEFILE found (default would be 'site.htm')$n";
+ error "no SITEFILE found (default would be 'site.htm')$n";
exit 1;
} else {
- print STDERR "NOTE: sitefile: ",`ls -s $SITEFILE`,"$n";
+ hint "sitefile: ", ls_s($SITEFILE);
}
# we use internal hashes to store mappings - kind of relational tables
my @MK_TAGS= (); # "./$MK.tags.tmp"
my @MK_VARS= (); # "./$MK.vars.tmp"
+my @MK_SPAN= (); # "./$MK.span.tmp"
my @MK_META= (); # "./$MK.meta.tmp"
my @MK_METT= (); # "./$MK.mett.tmp"
my @MK_TEST= (); # "./$MK.test.tmp"
my @MK_SECT1= (); # "./$MK.sect1.tmp"
my @MK_SECT2= (); # "./$MK.sect2.tmp"
my @MK_SECT3= (); # "./$MK.sect3.tmp"
-my @MK_INFO= (); # "./$MK~~"
-my %INFO= (); # used for $F.$PARTs
-my %FAST= ();
+my @MK_DATA= (); # "./$MK~~"
+my %DATA= (); # used for $F.$PARTs
# ========================================================================
# ========================================================================
my $printerfriendly="";
my $sectionlayout="list";
my $sitemaplayout="list";
-my $simplevars="warn"; # <!--varname-->default
my $attribvars=" "; # <x ref="${varname:=default}">
my $updatevars=" "; # <!--$varname:=-->default
my $expandvars=" "; # <!--$varname-->
-my $commentvars=" "; # $updatevars && $expandsvars && $simplevars
+my $commentvars=" "; # $updatevars && $expandsvars
my $sectiontab=" "; # highlight ^<td class=...>...href="$section"
my $currenttab=" "; # highlight ^<br>..<a href="$topic">
my $headsection="no";
for (source($SITEFILE)) {
if (/<!--multi-->/) {
- warn("WARNING: do not use <!--multi-->,"
+ warns("do not use <!--multi-->,"
." change to <!--mksite:multi--> $SITEFILE"
."warning: or"
." <!--mksite:multisectionlayout-->"
($x =~ /^(list|multi)$/) { $sectionlayout="$x" ; }
$x=mksite_magic_option("sitemaplayout"); if
($x =~ /^(list|multi)$/) { $sitemaplayout="$x" ; }
- $x=mksite_magic_option("simplevars"); if
- ($x =~ /^( |no|warn)$/) { $simplevars="$x" ; }
$x=mksite_magic_option("attribvars"); if
($x =~ /^( |no|warn)$/) { $attribvars="$x" ; }
$x=mksite_magic_option("updatevars"); if
$printerfriendly=$o{print} if $o{print};
$updatevars="no" if $commentvars eq "no"; # duplicated into
$expandvars="no" if $commentvars eq "no"; # info2vars_sed
-$simplevars="no" if $commentvars eq "no"; # function above
-
-print "NOTE: '$sectionlayout\'sectionlayout '$sitemaplayout\'sitemaplayout$n"
- if -d "DEBUG";
-print "NOTE: '$simplevars\'simplevars '$printerfriendly\'printerfriendly$n"
- if -d "DEBUG";
-print "NOTE: '$attribvars\'attribvars '$updatevars\'updatevars$n"
- if -d "DEBUG";
-print "NOTE: '$expandvars\'expandvars '$commentvars\'commentvars $n"
- if -d "DEBUG";
-print "NOTE: '$currenttab\'currenttab '$sectiontab\'sectiontab$n"
- if -d "DEBUG";
-print "NOTE: '$headsection\'headsection '$tailsection\'tailsection$n"
- if -d "DEBUG";
+
+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";
# ==========================================================================
# init a few global variables
# tag via "h;y;x" or something we do want to convert all the tags on
# a single line of course.
@MK_TAGS=();
-for my $P (qw/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/) {
- my $M=lc($P);
+{ my ($M,$P); for $M (@HTMLTAGS) {
+ $P=uc($M);
push @MK_TAGS, "s|<$P>|<$M class=\\\"$P\\\">|g;";
push @MK_TAGS, "s|<$P |<$M class=\\\"$P\\\" |g;";
push @MK_TAGS, "s|</$P>|</$M>|g;";
-}
+}}
push @MK_TAGS, "s|<>|\\ \\;|g;";
push @MK_TAGS, "s|<->|<WBR />\\;|g;";
+push @MK_TAGS, "s|<c>|<code>|g;";
+push @MK_TAGS, "s|</c>|</code>|g;";
+push @MK_TAGS, "s|<section>||g;";
+push @MK_TAGS, "s|</section>||g;";
+push @MK_TAGS, "s|<(a [^<>]*) />|<\$1></a>|g";
+my $_ulink_="<a href=\"\$1\" remap=\"url\">\$1</a>";
+push @MK_TAGS, "s|<a>\\s*(\\w+://[^<>]*)</a>|$_ulink_|g;";
# 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
("refresh", "expires", "content-type", "cache-control",
"redirect", "charset", # mapped to refresh / content-type
"content-language", "content-script-type", "content-style-type");
-for my $P (@DC_VARS) { # dublin core embedded
+{ my $P; for $P (@DC_VARS) { # dublin core embedded
push @MK_TAGS, "s|<$P>[^<>]*</$P>||g;";
-}
-for my $P (@_EQUIVS) {
+}}
+{ my $P; for $P (@_EQUIVS) {
push @MK_TAGS, "s|<$P>[^<>]*</$P>||g;";
-}
-push @MK_TAGS, "s|<!--sect[$AZ$NN]-->||g;";
+}}
+push @MK_TAGS, "s|<a sect=\\\"[$AZ$NN]\\\"|<a|g;" if not $o{keepsect};
push @MK_TAGS, "s|<!--[$AX]*[?]-->||g;";
push @MK_TAGS, "s|<!--\\\$[$AX]*[?]:-->||g;";
push @MK_TAGS, "s|<!--\\\$[$AX]*:[?=]-->||g;";
my $i = 100;
sub savelist {
if (-d "DEBUG") {
- my $X = "$F._$i"; $i++; $X =~ s|/|:|g;
+ my ($script,$ext,$Z) = @_;
+ if (not $ext) { $ext = "_".$i; $i++; }
+ my $X = "$F.$ext.tmp.PL"; $X =~ s|/|:|g;
open X, ">DEBUG/$X" or die "could not open $X: $!";
- print X "#! /usr/bin/perl -".$#_."$n";
- print X join("$n", @{$_[0]}),$n; close X;
+ print X "#! /usr/bin/env perl",$n;
+ print X "# ",$#_," $ext files ",localtime(),$n;
+ my $TEXT = join("$n", @{$script});
+ $TEXT =~ s|source\([^()]*\)|<>|;
+ print X $TEXT,$n; close X;
}
}
sub eval_MK_LIST # $str @list
{
+ my $FILETYPE = $_[0]; shift @_;
my $result = $_[0]; shift @_;
my $extra = "";
my $script = "\$_ = \$result; my \$Z;";
$script .= join(";$n ", @_);
$script .= "$n;\$result = \$_;$n";
+ savelist([$script],$FILETYPE);
eval $script;
return $result.$extra;
}
sub eval_MK_FILE {
+ my $FILETYPE = $_[0]; shift @_;
my $FILENAME = $_[0]; shift @_;
my $result = "";
my $script = "my \$FILE; my \$extra = ''; my \$Z; $n";
$script.= "$n; \$result .= \$_; ";
$script.= "$n if(\$extra){\$result.=\$extra;\$extra='';\$result.=\"\\n\"}";
$script.= "$n} if(\$extra){\$result.=\$extra;}$n";
- savelist([$script,""]);
+ savelist([$script],$FILETYPE);
eval $script;
return $result;
}
my $sed_add = "\$extra .= "; # "/r ";
sub foo { print " '$F'$n"; }
-sub ls_s {
- my $result = `ls -s @_`;
- chomp($result);
- return $result;
-}
# ======================================================================
# FUNCS
return $R;
}
-sub info2test_sed # \@ \@ # cut out all old-style <!--vars--> usages
-{
- my ($INP,$XXX) = @_;
- $INP = \@{$INFO{$F}} if not $INP;
- my @OUT = ();
- my $V8=" *([^ ][^ ]*) (.*)";
- my $V9=" *DC[.]([^ ][^ ]*) (.*)";
- my $q="\\\$";
- my ($_x_,$_y_,$_X_,$_Y_); my $W = "WARNING:";
- $_x_= sub {"$W: assumed simplevar <!--$1--> changed to <!--$q$1:=-->" };
- $_y_= sub {"$W: assumed simplevar <!--$1--> changed to <!--$q$1:?-->" };
- $_X_= sub {"$W: assumed tailvar <!--$q$1:--> changed to <!--$q$1:=-->" };
- $_Y_= sub {"$W: assumed tailvar <!--$q$1:--> changed to <!--$q$1:?-->" };
- push @OUT, "s/^/ /;";
- for (@$INP) {
- if (/^=....=formatter /) { next; };
- if (/=[Tt]ext=$V9%/){ push @OUT, esc("s|.*<!--($1)-->.*|".&$_x_."|;");}
- if (/=[Nn]ame=$V9%/){ push @OUT, esc("s|.*<!--($1)[?]-->.*|".&$_y_."|;");}
- if (/=[Tt]ext=$V8%/){ push @OUT, esc("s|.*<!--($1)-->.*|".&$_x_."|;");}
- if (/=[Nn]ame=$V8%/){ push @OUT, esc("s|.*<!--($1)[?]-->.*|".&$_y_."|;");}
- }
- for (@$INP) {
- if (/^=....=formatter /) { next; };
- if (/=[Tt]ext=$V9%/){ push @OUT, esc("s|.*<!--($1):-->.*|".&$_X_."|;");}
- if (/=[Nn]ame=$V9%/){ push @OUT, esc("s|.*<!--($1)[?]:-->.*|".&$_Y_."|;");}
- if (/=[Tt]ext=$V8%/){ push @OUT, esc("s|.*<!--($1):-->.*|".&$_X_."|;");}
- if (/=[Nn]ame=$V8%/){ push @OUT, esc("s|.*<!--($1)[?]:-->.*|".&$_Y_."|;");}
- }
- push @OUT, "/^WARNING:/ || next;";
- return @OUT;
-}
-
sub info2vars_sed # generate <!--$vars--> substition sed addon script
{
my ($INP,$Z) = @_;
- $INP = \@{$INFO{$F}} if not $INP;
+ $INP = \@{$DATA{$F}} if not $INP;
my @OUT = ();
- my $V8=" *([^ ][^ ]*) +(.*)";
- my $V9=" *DC[.]([^ ][^ ]*) +(.*)";
- my $N8=" *([^ ][^ ]*) ([$NN].*)";
- my $N9=" *DC[.]([^ ][^ ]*) ([$NN].*)";
+ my $V8=" *([^ ][^ ]*) +(.*)<$QX>";
+ my $V9=" *DC[.]([^ ][^ ]*) +(.*)<$QX>";
+ my $N8=" *([^ ][^ ]*) ([$NN].*)<$QX>";
+ my $N9=" *DC[.]([^ ][^ ]*) ([$NN].*)<$QX>";
my $V0="([<]*)\\\$";
my $V1="([^<>]*)\\\$";
my $V2="([^{<>}]*)";
$Z="\$Z=";
$updatevars = "no" if $commentvars eq "no"; # duplicated from
$expandvars = "no" if $commentvars eq "no"; # option handling
- $simplevars = "no" if $commentvars eq "no"; # tests below
- my @_INP = (); for (@{$INP}) { my $x=$_; $x =~ s/'/\\'/; push @_INP, $x; }
+ my @_INP = (); for (@{$INP}) {
+ my $x=$_; $x =~ s/(>[^<>]*)'([^<>]*<)/$1\\'$2/; push @_INP, $x; # OOOOPS
+ }
if ($expandvars ne "no") {
- for (@_INP) {
+ for (@_INP) {
if (/^=....=formatter /) { next; }
- elsif (/^=name=$V9/){push @OUT, "\$Z='$2';s|<!--$V0$1\\?-->|- \$Z|;"}
- elsif (/^=Name=$V9/){push @OUT, "\$Z='$2';s|<!--$V0$1\\?-->|(\$Z)|;"}
- elsif (/^=name=$V8/){push @OUT, "\$Z='$2';s|<!--$V0$1\\?-->|- \$Z|;"}
- elsif (/^=Name=$V8/){push @OUT, "\$Z='$2';s|<!--$V0$1\\?-->|(\$Z)|;"}
+ elsif (/^<$Q='name'>$V9/){push @OUT, "\$Z='$2';s|<!--$V0$1\\?-->|- \$Z|;"}
+ elsif (/^<$Q='Name'>$V9/){push @OUT, "\$Z='$2';s|<!--$V0$1\\?-->|(\$Z)|;"}
+ elsif (/^<$Q='name'>$V8/){push @OUT, "\$Z='$2';s|<!--$V0$1\\?-->|- \$Z|;"}
+ elsif (/^<$Q='Name'>$V8/){push @OUT, "\$Z='$2';s|<!--$V0$1\\?-->|(\$Z)|;"}
}
}
if ($expandvars ne "no") {
for (@_INP) {
if (/^=....=formatter /) { next; }
- elsif (/^=text=$V9/){push @OUT, "\$Z='$2';s|<!--$V1$1-->|\$1$SS\$Z|;"}
- elsif (/^=Text=$V9/){push @OUT, "\$Z='$2';s|<!--$V1$1-->|\$1$SS\$Z|;"}
- elsif (/^=name=$V9/){push @OUT, "\$Z='$2';s|<!--$V1$1\\?-->|\$1$SS\$Z|;"}
- elsif (/^=Name=$V9/){push @OUT, "\$Z='$2';s|<!--$V1$1\\?-->|\$1$SS\$Z|;"}
- elsif (/^=text=$V8/){push @OUT, "\$Z='$2';s|<!--$V1$1-->|\$1$SS\$Z|;"}
- elsif (/^=Text=$V8/){push @OUT, "\$Z='$2';s|<!--$V1$1-->|\$1$SS\$Z|;"}
- elsif (/^=name=$V8/){push @OUT, "\$Z='$2';s|<!--$V1$1\\?-->|\$1$SS\$Z|;"}
- elsif (/^=Name=$V8/){push @OUT, "\$Z='$2';s|<!--$V1$1\\?-->|\$1$SS\$Z|;"}
- }
- }
- if ($simplevars ne "no" && $updatevars ne "no") {
- for (@_INP) { my $Q = "[$AX]*";
- if (/^=....=formatter /) { next; }
- elsif (/^=text=$V9/){push @OUT, "\$Z='$2';s|<!--$V0$1:-->$Q|\$Z|;"}
- elsif (/^=Text=$V9/){push @OUT, "\$Z='$2';s|<!--$V0$1:-->$Q|\$Z|;"}
- elsif (/^=name=$V9/){push @OUT, "\$Z='$2';s|<!--$V0$1\\?:-->$Q|- \$Z|;"}
- elsif (/^=Name=$V9/){push @OUT, "\$Z='$2';s|<!--$V0$1\\?:-->$Q|(\$Z)|;"}
- elsif (/^=text=$V8/){push @OUT, "\$Z='$2';s|<!--$V0$1:-->$Q|\$Z|;"}
- elsif (/^=Text=$V8/){push @OUT, "\$Z='$2';s|<!--$V0$1:-->$Q|\$Z|;"}
- elsif (/^=name=$V8/){push @OUT, "\$Z='$2';s|<!--$V0$1\\?:-->$Q|- \$Z|;"}
- elsif (/^=Name=$V8/){push @OUT, "\$Z='$2';s|<!--$V0$1\\?:-->$Q|(\$Z)|;"}
+ elsif (/^<$Q='text'>$V9/){push @OUT, "\$Z='$2';s|<!--$V1$1-->|\$1$SS\$Z|;"}
+ elsif (/^<$Q='Text'>$V9/){push @OUT, "\$Z='$2';s|<!--$V1$1-->|\$1$SS\$Z|;"}
+ elsif (/^<$Q='name'>$V9/){push @OUT, "\$Z='$2';s|<!--$V1$1\\?-->|\$1$SS\$Z|;"}
+ elsif (/^<$Q='Name'>$V9/){push @OUT, "\$Z='$2';s|<!--$V1$1\\?-->|\$1$SS\$Z|;"}
+ elsif (/^<$Q='text'>$V8/){push @OUT, "\$Z='$2';s|<!--$V1$1-->|\$1$SS\$Z|;"}
+ elsif (/^<$Q='Text'>$V8/){push @OUT, "\$Z='$2';s|<!--$V1$1-->|\$1$SS\$Z|;"}
+ elsif (/^<$Q='name'>$V8/){push @OUT, "\$Z='$2';s|<!--$V1$1\\?-->|\$1$SS\$Z|;"}
+ elsif (/^<$Q='Name'>$V8/){push @OUT, "\$Z='$2';s|<!--$V1$1\\?-->|\$1$SS\$Z|;"}
}
}
if ($updatevars ne "no") {
- for (@_INP) { my $Q = "[^<>]*";
+ for (@_INP) { my $H = "[^<>]*";
if (/^=....=formatter /) { next; }
- elsif (/^=name=$V9/){push @OUT, "\$Z='$2';s|<!--$V0$1:\\?-->$Q|- \$Z|;"}
- elsif (/^=Name=$V9/){push @OUT, "\$Z='$2';s|<!--$V0$1:\\?-->$Q|(\$Z)|;"}
- elsif (/^=name=$V8/){push @OUT, "\$Z='$2';s|<!--$V0$1:\\?-->$Q|- \$Z|;"}
- elsif (/^=Name=$V8/){push @OUT, "\$Z='$2';s|<!--$V0$1:\\?-->$Q|(\$Z)|;"}
+ elsif (/^<$Q='name'>$V9/){push @OUT, "\$Z='$2';s|<!--$V0$1:\\?-->$H|- \$Z|;"}
+ elsif (/^<$Q='Name'>$V9/){push @OUT, "\$Z='$2';s|<!--$V0$1:\\?-->$H|(\$Z)|;"}
+ elsif (/^<$Q='name'>$V8/){push @OUT, "\$Z='$2';s|<!--$V0$1:\\?-->$H|- \$Z|;"}
+ elsif (/^<$Q='Name'>$V8/){push @OUT, "\$Z='$2';s|<!--$V0$1:\\?-->$H|(\$Z)|;"}
}
}
if ($updatevars ne "no") {
- for (@_INP) { my $Q = "[^<>]*";
+ for (@_INP) { my $H = "[^<>]*";
if (/^=....=formatter /) { next; }
- elsif (/^=text=$V9/){push @OUT,"\$Z='$2';s|<!--$V1$1:\\=-->$Q|\$1$SS\$Z|;"}
- elsif (/^=Text=$V9/){push @OUT,"\$Z='$2';s|<!--$V1$1:\\=-->$Q|\$1$SS\$Z|;"}
- elsif (/^=name=$V9/){push @OUT,"\$Z='$2';s|<!--$V1$1:\\?-->$Q|\$1$SS\$Z|;"}
- elsif (/^=Name=$V9/){push @OUT,"\$Z='$2';s|<!--$V1$1:\\?-->$Q|\$1$SS\$Z|;"}
- elsif (/^=text=$V8/){push @OUT,"\$Z='$2';s|<!--$V1$1:\\=-->$Q|\$1$SS\$Z|;"}
- elsif (/^=Text=$V8/){push @OUT,"\$Z='$2';s|<!--$V1$1:\\=-->$Q|\$1$SS\$Z|;"}
- elsif (/^=name=$V8/){push @OUT,"\$Z='$2';s|<!--$V1$1:\\?-->$Q|\$1$SS\$Z|;"}
- elsif (/^=Name=$V8/){push @OUT,"\$Z='$2';s|<!--$V1$1:\\?-->$Q|\$1$SS\$Z|;"}
+ elsif (/^<$Q='text'>$V9/){push @OUT,"\$Z='$2';s|<!--$V1$1:\\=-->$H|\$1$SS\$Z|;"}
+ elsif (/^<$Q='Text'>$V9/){push @OUT,"\$Z='$2';s|<!--$V1$1:\\=-->$H|\$1$SS\$Z|;"}
+ elsif (/^<$Q='name'>$V9/){push @OUT,"\$Z='$2';s|<!--$V1$1:\\?-->$H|\$1$SS\$Z|;"}
+ elsif (/^<$Q='Name'>$V9/){push @OUT,"\$Z='$2';s|<!--$V1$1:\\?-->$H|\$1$SS\$Z|;"}
+ elsif (/^<$Q='text'>$V8/){push @OUT,"\$Z='$2';s|<!--$V1$1:\\=-->$H|\$1$SS\$Z|;"}
+ elsif (/^<$Q='Text'>$V8/){push @OUT,"\$Z='$2';s|<!--$V1$1:\\=-->$H|\$1$SS\$Z|;"}
+ elsif (/^<$Q='name'>$V8/){push @OUT,"\$Z='$2';s|<!--$V1$1:\\?-->$H|\$1$SS\$Z|;"}
+ elsif (/^<$Q='Name'>$V8/){push @OUT,"\$Z='$2';s|<!--$V1$1:\\?-->$H|\$1$SS\$Z|;"}
}
}
if ($attribvars ne "no") {
- for (@_INP) { my $Q = "[^<>]*";
+ for (@_INP) { my $H = "[^<>]*";
if (/^=....=formatter /) { next; }
- elsif (/^=text=$V9/){push @OUT,"\$Z='$2';s|<$V1\{$1:[=]$V2}$V3>|<\$1$SS\$Z\$3>|;"}
- elsif (/^=Text=$V9/){push @OUT,"\$Z='$2';s|<$V1\{$1:[=]$V2}$V3>|<\$1$SS\$Z\$3>|;"}
- elsif (/^=name=$V9/){push @OUT,"\$Z='$2';s|<$V1\{$1:[?]$V2}$V3>|<\$1$SS\$Z\$3>|;"}
- elsif (/^=Name=$V9/){push @OUT,"\$Z='$2';s|<$V1\{$1:[?]$V2}$V3>|<\$1$SS\$Z\$3>|;"}
- elsif (/^=text=$V8/){push @OUT,"\$Z='$2';s|<$V1\{$1:[=]$V2}$V3>|<\$1$SS\$Z\$3>|;"}
- elsif (/^=Text=$V8/){push @OUT,"\$Z='$2';s|<$V1\{$1:[=]$V2}$V3>|<\$1$SS\$Z\$3>|;"}
- elsif (/^=name=$V8/){push @OUT,"\$Z='$2';s|<$V1\{$1:[?]$V2}$V3>|<\$1$SS\$Z\$3>|;"}
- elsif (/^=Name=$V8/){push @OUT,"\$Z='$2';s|<$V1\{$1:[?]$V2}$V3>|<\$1$SS\$Z\$3>|;"}
+ elsif (/^<$Q='text'>$V9/){push @OUT,"\$Z='$2';s|<$V1\{$1:[=]$V2}$V3>|<\$1$SS\$Z\$3>|;"}
+ elsif (/^<$Q='Text'>$V9/){push @OUT,"\$Z='$2';s|<$V1\{$1:[=]$V2}$V3>|<\$1$SS\$Z\$3>|;"}
+ elsif (/^<$Q='name'>$V9/){push @OUT,"\$Z='$2';s|<$V1\{$1:[?]$V2}$V3>|<\$1$SS\$Z\$3>|;"}
+ elsif (/^<$Q='Name'>$V9/){push @OUT,"\$Z='$2';s|<$V1\{$1:[?]$V2}$V3>|<\$1$SS\$Z\$3>|;"}
+ elsif (/^<$Q='text'>$V8/){push @OUT,"\$Z='$2';s|<$V1\{$1:[=]$V2}$V3>|<\$1$SS\$Z\$3>|;"}
+ elsif (/^<$Q='Text'>$V8/){push @OUT,"\$Z='$2';s|<$V1\{$1:[=]$V2}$V3>|<\$1$SS\$Z\$3>|;"}
+ elsif (/^<$Q='name'>$V8/){push @OUT,"\$Z='$2';s|<$V1\{$1:[?]$V2}$V3>|<\$1$SS\$Z\$3>|;"}
+ elsif (/^<$Q='Name'>$V8/){push @OUT,"\$Z='$2';s|<$V1\{$1:[?]$V2}$V3>|<\$1$SS\$Z\$3>|;"}
}
for (split / /, $o{variables}) {
{push @OUT,"\$Z='$o{$_}';s|<$V1\{$_:[?]$V2}$V3>|<\$1$SS\$Z\$3>|;"}
}
}
- if ($simplevars ne "no") {
- for (@_INP) { my $Q = "[$AX]*";
- if (/^=....=formatter /) { next; }
- elsif (/^=text=$V9/){push @OUT, "\$Z='$2';s|<!--$1-->$Q|\$Z|;"}
- elsif (/^=Text=$V9/){push @OUT, "\$Z='$2';s|<!--$1-->$Q|\$Z|;"}
- elsif (/^=name=$V9/){push @OUT, "\$Z='$2';s|<!--$1\\?-->$Q| - \$Z|;"}
- elsif (/^=Name=$V9/){push @OUT, "\$Z='$2';s|<!--$1\\?-->$Q| (\$Z)|;"}
- elsif (/^=text=$V8/){push @OUT, "\$Z='$2';s|<!--$1-->$Q|\$Z|;"}
- elsif (/^=Text=$V8/){push @OUT, "\$Z='$2';s|<!--$1-->$Q|\$Z|;"}
- elsif (/^=name=$V8/){push @OUT, "\$Z='$2';s|<!--$1\\?-->$Q| - \$Z|;"}
- elsif (/^=Name=$V8/){push @OUT, "\$Z='$2';s|<!--$1\\?-->$Q| (\$Z)|;"}
- }
- }
# 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:
sub info2meta_sed # generate <meta name..> text portion
{
my ($INP,$XXX) = @_;
- $INP = \@{$INFO{$F}} if not $INP;
+ $INP = \@{$DATA{$F}} if not $INP;
my @OUT = ();
# http://www.metatab.de/meta_tags/DC_type.htm
- my $V6=" *HTTP[.]([^ ]+) (.*)";
- my $V7=" *DC[.]([^ ]+) (.*)";
- my $V8=" *([^ ]+) (.*)" ;
+ my $V6=" *HTTP[.]([^ ]+) (.*)<$QX>";
+ my $V7=" *DC[.]([^ ]+) (.*)<$QX>";
+ my $V8=" *([^ ]+) (.*)<$QX>" ;
sub __TYPE_SCHEME { "name=\"DC.type\" content=\"$2\" scheme=\"$1\"" };
sub __DCMI { "name=\"$1\" content=\"$2\" scheme=\"DCMIType\"" };
sub __NAME { "name=\"$1\" content=\"$2\"" };
sub __HTTP { "http-equiv=\"$1\" content=\"$2\"" };
for (@$INP) {
if (/=....=today /) { next; }
- if (/=meta=HTTP[.]/ && /=meta=$V6/) {
+ if (/<$Q='meta'>HTTP[.]/ && /<$Q='meta'>$V6/) {
push @OUT, " <meta ${\(__HTTP)} />" if $2; next; }
- if (/=meta=DC[.]DCMIType / && /=meta=$V7/) {
+ if (/<$Q='meta'>DC[.]DCMIType / && /<$Q='meta'>$V7/) {
push @OUT, " <meta ${\(__TYPE_SCHEME)} />" if $2; next; }
- if (/=meta=DC[.]type Collection$/ && /=meta=$V8/) {
+ if (/<$Q='meta'>DC[.]type Collection$/ && /<$Q='meta'>$V8/) {
push @OUT, " <meta ${\(__DCMI)} />" if $2; next; }
- if (/=meta=DC[.]type Dataset$/ && /=meta=$V8/) {
+ if (/<$Q='meta'>DC[.]type Dataset$/ && /<$Q='meta'>$V8/) {
push @OUT, " <meta ${\(__DCMI)} />" if $2; next; }
- if (/=meta=DC[.]type Event$/ && /=meta=$V8/) {
+ if (/<$Q='meta'>DC[.]type Event$/ && /<$Q='meta'>$V8/) {
push @OUT, " <meta ${\(__DCMI)} />" if $2; next; }
- if (/=meta=DC[.]type Image$/ && /=meta=$V8/) {
+ if (/<$Q='meta'>DC[.]type Image$/ && /<$Q='meta'>$V8/) {
push @OUT, " <meta ${\(__DCMI)} />" if $2; next; }
- if (/=meta=DC[.]type Service$/ && /=meta=$V8/) {
+ if (/<$Q='meta'>DC[.]type Service$/ && /<$Q='meta'>$V8/) {
push @OUT, " <meta ${\(__DCMI)} />" if $2; next; }
- if (/=meta=DC[.]type Software$/ && /=meta=$V8/) {
+ if (/<$Q='meta'>DC[.]type Software$/ && /<$Q='meta'>$V8/) {
push @OUT, " <meta ${\(__DCMI)} />" if $2; next; }
- if (/=meta=DC[.]type Sound$/ && /=meta=$V8/) {
+ if (/<$Q='meta'>DC[.]type Sound$/ && /<$Q='meta'>$V8/) {
push @OUT, " <meta ${\(__DCMI)} />" if $2; next; }
- if (/=meta=DC[.]type Text$/ && /=meta=$V8/) {
+ if (/<$Q='meta'>DC[.]type Text$/ && /<$Q='meta'>$V8/) {
push @OUT, " <meta ${\(__DCMI)} />" if $2; next; }
- if (/=meta=DC[.]date[.].*[+]/ && /=meta=$V8/) {
+ if (/<$Q='meta'>DC[.]date[.].*[+]/ && /<$Q='meta'>$V8/) {
push @OUT, " <meta ${\(__NAME)} />" if $2; next; }
- if (/=meta=DC[.]date[.].*[:]/ && /=meta=$V8/) {
+ if (/<$Q='meta'>DC[.]date[.].*[:]/ && /<$Q='meta'>$V8/) {
push @OUT, " <meta ${\(__NAME_TZ)} />" if $2; next; }
- if (/=meta=/ && /=meta=$V8/) {
+ if (/<$Q='meta'>/ && /<$Q='meta'>$V8/) {
push @OUT, " <meta ${\(__NAME)} />" if $2; next; }
}
return @OUT;
{
my ($TXT,$INP,$XXX) = @_;
$TXT = "sect" if not $TXT;
- $INP = \@{$INFO{$F}} if not $INP;
- for (grep {/=text=$TXT /} @$INP) {
+ $INP = \@{$DATA{$F}} if not $INP;
+ for (grep {/<$Q='text'>$TXT /} @$INP) {
my $info = $_;
- $info =~ s/=text=$TXT //;
+ $info =~ s|<$Q='text'>$TXT ||; $info =~ s|<$QX>||;
chomp($info); chomp($info); return $info;
}
}
{
my ($TXT,$INP,$XXX) = @_;
$TXT = "sect" if not $TXT;
- $INP = \@{$INFO{$F}} if not $INP;
- return scalar(grep {/^=text=$TXT /} @$INP); # returning the count
+ $INP = \@{$DATA{$F}} if not $INP;
+ return scalar(grep {/^<$Q='text'>$TXT /} @$INP); # returning the count
}
sub dx_init
{
- @{$INFO{$F}} = ();
+ @{$DATA{$F}} = ();
&dx_meta ("formatter", basename($o{formatter}));
for (split / /, $o{variables}) { # commandline --def=value
if (/_/) { my $u=$_; $u =~ y/_/-/; # makes for <!--$def--> override
sub dx_line
{
my ($U,$V,$W,$Z) = @_; chomp($U); chomp($V);
- push @{$INFO{$F}}, $U.$V." ".trimmm($W);
+ push @{$DATA{$F}}, "<$Q=$U>".$V." ".trimmm($W)."<$QX>";
}
sub DX_line
sub dx_text
{
my ($U,$V,$Z) = @_;
- &dx_line ("=text=",$U,$V);
+ &dx_line ("'text'",$U,$V);
}
sub DX_text # add a <!--vars--> substition includings format variants
if ($N) {
if ($T) {
my $text=lc("$T"); $text =~ s/<[^<>]*>//g;
- &dx_line ("=text=",$N,$T);
- &dx_line ("=name=",$N,$text);
+ &dx_line ("'text'",$N,$T);
+ &dx_line ("'name'",$N,$text);
my $varname=$N; $varname =~ s/.*[.]//; # cut out front part
if ($N ne $varname and $varname) {
$text=lc("$varname $T"); $text =~ s/<[^<>]*>//g;
- &dx_line ("=Text=",$varname,$T);
- &dx_line ("=Name=",$varname,$text);
+ &dx_line ("'Text'",$varname,$T);
+ &dx_line ("'Name'",$varname,$text);
}
}
}
sub dx_meta
{
my ($U,$V,$Z) = @_;
- &DX_line ("=meta=",$U,$V);
+ &DX_line ("'meta'",$U,$V);
}
sub DX_meta # add simple meta entry and its <!--vars--> subsitution
{
my ($U,$V,$Z) = @_;
- &DX_line ("=meta=",$U,$V);
+ &DX_line ("'meta'",$U,$V);
&DX_text ("$U", $V);
}
sub DC_meta # add new DC.meta entry plus two <!--vars--> substitutions
{
my ($U,$V,$Z) = @_;
- &DX_line ("=meta=","DC.$U",$V);
+ &DX_line ("'meta'","DC.$U",$V);
&DX_text ("DC.$U", $V);
&DX_text ("$U", $V);
}
sub HTTP_meta # add new HTTP.meta entry plus two <!--vars--> substitutions
{
my ($U,$V,$Z) = @_;
- &DX_line ("=meta=","HTTP.$U",$V);
+ &DX_line ("'meta'","HTTP.$U",$V);
&DX_text ("HTTP.$U", $V);
&DX_text ("$U", $V);
}
sub DC_modified # make sure there is a DC.date.modified meta tag
{ # maybe choose from filesystem dates if possible
- my ($Q,$Z) = @_; # target file
+ my ($ZZ,$Z) = @_; # target file
if (not &info1grep ("DC.date.modified")) {
- my @stats = stat($Q);
+ my @stats = stat($ZZ);
my $text = strftime("%Y-%m-%d", localtime($stats[9]));
&DC_meta ("date.modified", $text);
}
sub DC_date # make sure there is this DC.date meta tag
{ # choose from one of the available DC.date.* specials
- my ($Q,$Z) = @_; # source file
+ my ($ZZ,$Z) = @_; # source file
if (&info1grep ("DC.date")) {
&DX_text ("issue", "dated ".&info_get_entry("DC.date"));
&DX_text ("updated", &info_get_entry("DC.date"));
my $text=""; my $kind;
for $kind (qw/available issued modified created/) {
$text=&info_get_entry("DC.date.$kind");
- # test ".$text" != "." && echo "$kind = date = $text ($Q)"
+ # test ".$text" != "." && echo "$kind = date = $text ($ZZ)"
last if $text;
}
if (not $text) {
my $part; my $M="date";
- for (source($Q)) {
+ for (source($ZZ)) {
/<$M>/ or next; s|.*<$M>||; s|</$M>.*||;
$part=trimm($_); last;
}
}
if (not $text) {
my $part; my $M="!--date:*=*--"; # takeover updateable variable...
- for (source($Q)) {
+ for (source($ZZ)) {
/<$M>/ or next; s|.*<$M>||; s|</.*||;
$part=trimm($_); last;
}
{
# choose a title for the document, either an explicit title-tag
# or one of the section headers in the document or fallback to filename
- my ($Q,$Z) = @_; # target file
+ my ($ZZ,$Z) = @_; # target file
my ($term, $text);
if (not &info1grep ("DC.title")) {
for my $M (qw/TITLE title H1 h1 H2 h2 H3 H3 H4 H4 H5 h5 H6 h6/) {
- for (source($Q)) {
+ for (source($ZZ)) {
/<$M>/ or next; s|.*<$M>||; s|</$M>.*||;
$text = trimm($_); last;
}
last if $text;
- for (source($Q)) {
+ for (source($ZZ)) {
/<$M [^<>]*>/ or next; s|.*<$M [^<>]*>||; s|</$M>.*||;
$text = trimm($_); last;
}
last if $text;
}
if (not $text) {
- $text=basename($Q,".html");
+ $text=basename($ZZ,".html");
$text=basename($text,".htm"); $text =~ y/_/ /; $text =~ s/$/ info/;
$text=~ s/\n/ /g;
}
sub site_get_section # return parent section page of given page
{
my $_F_ = &sed_slash_key(@_);
- for my $x (grep {/=sect=$_F_ /} @MK_INFO) {
- my $info = $x; $info =~ s/=sect=[^ ]* //; return $info;
+ for my $x (grep {/<$Q='sect'>$_F_ /} @MK_DATA) {
+ my $info = $x; $info =~ s|<$Q='sect'>[^ ]* ||; $info =~ s|<$QX>||;
+ return $info;
}
}
sub DC_section # not really a DC relation (shall we use isPartOf ?)
{ # each document should know its section father
my $sectn = &site_get_section($F);
- if ($sectn) {
+ if ($sectn) {
&DC_meta ("relation.section", $sectn);
}
}
sub site_get_selected # return section of given page
{
my $_F_ = &sed_slash_key(@_);
- for my $x (grep {/=[u]se.=$_F_ /} @MK_INFO) {
- my $info = $x; $info =~ s/=[u]se.=[^ ]* //; return $info;
+ for my $x (grep {/<$Q='[u]se.'>$_F_ /} @MK_DATA) {
+ my $info = $x;
+ $info =~ s/<$Q='[u]se.'>[^ ]* //; $info =~ s|<$QX>||;
+ return $info;
}
}
sub site_get_rootsections # return all sections from root of nav tree
{
my @OUT;
- for (grep {/=[u]se1=/} @MK_INFO) {
+ for (grep {/<$Q='[u]se1'>/} @MK_DATA) {
my $x = $_;
- $x =~ s/=[u]se.=([^ ]*) .*/$1/;
+ $x =~ s/<$Q='[u]se.'>([^ ]*) .*/$1/;
push @OUT, $x;
}
return @OUT;
{
my $_F_=&sed_slash_key(@_);
my @OUT = ();
- for (grep {/^=sect=[^ ]* $_F_$/} @MK_INFO) {
+ for (grep {/^<$Q='sect'>[^ ]* $_F_$/} @MK_DATA) {
my $x = $_;
- $x =~ s/^=sect=//; $x =~ s/ .*//;
+ $x =~ s/^<$Q='sect'>//; $x =~ s/ .*//; $x =~ s|<$QX>||;
push @OUT, $x;
}
return @OUT;
{
my $_F_=&sed_slash_key(@_);
my @OUT = ();
- for (grep {/^=node=[^ ]* $_F_$/} @MK_INFO) {
- my $x = $_;
- $x =~ s/^=node=//; $x =~ s/ .*//;
+ for (grep {/^<$Q='node'>[^ ]* $_F_<[^<>]*>$/} @MK_DATA) {
+ my $x = $_;
+ $x =~ s/^<$Q='node'>//; $x =~ s/ .*//; $x =~ s|<$QX>||;
push @OUT, $x;
}
return @OUT;
sub site_get_parentpage # ret parent page for given page (".." for sections)
{
my $_F_=&sed_slash_key(@_);
- for (grep {/^=node=$_F_ /} @MK_INFO) {
+ for (grep {/^<$Q='node'>$_F_ /} @MK_DATA) {
my $x = $_;
- $x =~ s/^=node=[^ ]* //;
+ $x =~ s/^<$Q='node'>[^ ]* //; $x =~ s|<$QX>||;
return $x;
}
}
}
}
-sub 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"
+sub make_back_path # "$FILE"
+{
my ($R,$Z) = @_;
my $S=&back_path ($R);
my @OUT = ();
- if (not $S) {
- # echo "backpath '$F' = none needed"
- return @OUT;
- } else {
- # print "backpath '$F' -> '$S'$n";
- my @hrefs = ();
- for (source($SITEFILE)) {
- /href=\"[^\"]*\"/ or next;
- s/.*href=\"//; s/\".*//; chomp;
- if (/^ *$/ || /^\// || /^[.][.]/ || /^[\w]*:/) { next; }
- push @hrefs, $_;
- }
- for (source($SOURCEFILE)) {
- /href=\"[^\"]*\"/ or next;
- s/.*href=\"//; s/\".*//; chomp;
- if (/^ *$/ || /^\// || /^[.][.]/ || /^[\w]*:/) { next; }
- push @hrefs, $_;
- }
- my $ref = "";
- for (sort(@hrefs)) {
- next if /\$/; # some href="${...}" is problematic
- next if $ref eq $_; $ref = $_; # uniq
- push @OUT, "s|href=\\\"$ref\\\"|href=\\\"$S$ref\\\"|;";
- }
- return @OUT;
- }
+ return @OUT if $S !~ /^\.\./;
+ push @OUT, "s|(<[^<>]*\\shref=\\\")(\\w[^<>:]*\\\"[^<>]*>)|\$1$S\$2|g;";
+ push @OUT, "s|(<[^<>]*\\ssrc=\\\")(\\w[^<>:]*\\\"[^<>]*>)|\$1$S\$2|g;";
+ return @OUT;
}
-# ============================================================== 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.
sub site_map_list_title # $file $text
{
my ($U,$V,$Z) = @_; chomp($U);
- push @MK_INFO, "=list=$U ".trimm($V);
+ push @MK_DATA, "<$Q='list'>$U ".trimm($V)."<$QX>";
}
sub info_map_list_title # $file $text
{
my ($U,$V,$Z) = @_; chomp($U);
- push @{$INFO{$U}}, "=list=".trimm($V);
+ push @{$DATA{$U}}, "<$Q='list'>".trimm($V)."<$QX>";
}
sub site_map_long_title # $file $text
{
my ($U,$V,$Z) = @_; chomp($U);
- push @MK_INFO, "=long=$U ".trimm($V);
+ push @MK_DATA, "<$Q='long'>$U ".trimm($V)."<$QX>";
}
sub info_map_long_title # $file $text
{
my ($U,$V,$Z) = @_; chomp($U);
- push @{$INFO{$U}}, "=long=".trimm($V);
+ push @{$DATA{$U}}, "<$Q='long'>".trimm($V)."<$QX>";
}
sub site_map_list_date # $file $text
{
my ($U,$V,$Z) = @_; chomp($U);
- push @MK_INFO, "=date=$U ".trimm($V);
+ push @MK_DATA, "<$Q='date'>$U ".trimm($V)."<$QX>";
}
sub info_map_list_date # $file $text
{
my ($U,$V,$Z) = @_; chomp($U);
- push @{$INFO{$U}}, "=date=".trimm($V);
+ push @{$DATA{$U}}, "<$Q='date'>".trimm($V)."<$QX>";
}
sub site_get_list_title
{
my ($U,$V,$Z) = @_;
- for (@MK_INFO) { if (m|^=list=$U (.*)|) { return $1; } } return "";
+ for (@MK_DATA) { if (m|^<$Q='list'>$U (.*)<$QX>|) { return $1; } } return "";
}
sub site_get_long_title
{
my ($U,$V,$Z) = @_;
- for (@MK_INFO) { if (m|^=long=$U (.*)|) { return $1; } } return "";
+ for (@MK_DATA) { if (m|^<$Q='long'>$U (.*)<$QX>|) { return $1; } } return "";
}
sub site_get_list_date
{
my ($U,$V,$Z) = @_;
- for (@MK_INFO) { if (m|^=date=$U (.*)|) { return $1; } } return "";
+ for (@MK_DATA) { if (m|^<$Q='date'>$U (.*)<$QX>|) { return $1; } } return "";
}
sub 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-->
- my ($INP,$Z) = @_ ; $INP= \@MK_INFO if not $INP;
+ my ($INP,$Z) = @_ ; $INP= \@MK_DATA if not $INP;
my @OUT = ();
my $_list_=
- sub{"s|<!--\\\"$1\\\"-->.*<!--name-->|\$\&<name href=\\\"$1\\\">$2</name>|"};
+ sub{"s|(<!--\\\"$1\\\"-->.*)<name [^<>]*>.*</name>|\$1<name href=\\\"$1\\\">$2</name>|"};
my $_date_=
- sub{"s|<!--\\\"$1\\\"-->.*<!--date-->|\$\&<date>$2</date>|"};
+ sub{"s|(<!--\\\"$1\\\"-->.*)<date>.*</date>|\$1<date>$2</date>|"};
my $_long_=
- sub{"s|<!--\\\"$1\\\"-->.*<!--long-->|\$\&<long>$2</long>|"};
+ sub{"s|(<!--\\\"$1\\\"-->.*)<long>.*</long>|\$1<long>$2</long>|"};
for (@$INP) {
my $info = $_;
- $info =~ s:=list=([^ ]*) (.*):&$_list_:e;
- $info =~ s:=date=([^ ]*) (.*):&$_date_:e;
- $info =~ s:=long=([^ ]*) (.*):&$_long_:e;
+ $info =~ s:<$Q='list'>([^ ]*) (.*)<$QX>:&$_list_:e;
+ $info =~ s:<$Q='date'>([^ ]*) (.*)<$QX>:&$_date_:e;
+ $info =~ s:<$Q='long'>([^ ]*) (.*)<$QX>:&$_long_:e;
$info =~ /^s\|/ || next;
push @OUT, $info;
}
sub make_multisitemap
{ # each category gets its own column along with the usual entries
- my ($INPUTS,$Z)= @_ ; $INPUTS=\@MK_INFO if not $INPUTS;
+ my ($INPUTS,$Z)= @_ ; $INPUTS=\@MK_DATA if not $INPUTS;
@MK_SITE = &siteinfo2sitemap(); # have <name><long><date> addon-sed
my @OUT = ();
- my $_form_= sub{"<!--\"$2\"--><!--use$1--><!--long--><!--end$1-->"
- ."<br><!--name--><!--date-->" };
+ my $_form_= sub{"<!--\"$2\"--><!--use$1--><long>$3</long><!--end$1-->"
+ ."<br><name href=\"$2\">$3</name><date>......</date>" };
my $_tiny_="small><small><small" ; my $_tinyX_="small></small></small ";
my $_tabb_="<br><$_tiny_> </$_tinyX_>" ; my $_bigg_="<big> </big>";
push @OUT, "<table width=\"100%\"><tr><td> ".$n;
- for (grep {/=[u]se.=/} @$INPUTS) {
+ for (grep {/<$Q='[Uu]se.'>/} @$INPUTS) {
my $x = $_;
- $x =~ s|=[u]se(.)=([^ ]*) .*|&$_form_|e;
- $x = &eval_MK_LIST($x, @MK_SITE); $x =~ /<name/ or next;
+ $x =~ />\w\w\w\w*:/ and next; # name: http: ftp: mailto: ...
+ $x =~ s|<$Q='[Uu]se(.)'>([^ ]*) (.*)<$QX>|&$_form_|e;
+ $x = &eval_MK_LIST("multisitemap", $x, @MK_SITE);
+ $x =~ /<name/ or next;
$x =~ s|<!--[u]se1-->|</td><td valign=\"top\"><b>|;
$x =~ s|<!--[e]nd1-->|</b>|;
$x =~ s|<!--[u]se2-->|<br>|;
$x =~ s|<!--[u]se.-->|<br>|; $x =~ s/<!--[^<>]*-->/ /g;
- $x =~ s|<long>||; $x =~ s|</long>||;
$x =~ s|<name |<$_tiny_><a |; $x =~ s|</name>||;
- $x =~ s|<date>| |; $x =~ s|</date>|</a><br></$_tinyX_>|;
+ $x =~ s|<date>|<small style="date">|;
+ $x =~ s|</date>|</small></a><br></$_tinyX_>|;
+ $x =~ s|<long>|<!--long-->|;
+ $x =~ s|</long>|<!--/long-->|;
+ chomp $x;
push @OUT, $x.$n;
}
push @OUT, "</td><tr></table>".$n;
sub make_listsitemap
{ # traditional - the body contains a list with date and title extras
- my ($INPUTS,$Z)= @_ ; $INPUTS=\@MK_INFO if not $INPUTS;
+ my ($INPUTS,$Z)= @_ ; $INPUTS=\@MK_DATA if not $INPUTS;
@MK_SITE = &siteinfo2sitemap(); # have <name><long><date> addon-sed
my @OUT = ();
my $_form_=sub{
- "<!--\"$2\"--><!--use$1--><!--name--><!--date--><!--long-->"};
+ "<!--\"$2\"--><!--use$1--><name href=\"$2\">$3</name><date>......</date><long>$3</long>"};
my $_tabb_="<td>\ \;</td>";
push @OUT, "<table cellspacing=\"0\" cellpadding=\"0\">".$n;
my $xx;
- for $xx (grep {/=[u]se.=/} @$INPUTS) {
+ for $xx (grep {/<$Q='[Uu]se.'>/} @$INPUTS) {
my $x = "".$xx;
- $x =~ s|=[u]se(.)=([^ ]*) .*|&$_form_|e;
- $x = &eval_MK_LIST($x, @MK_SITE); $x =~ /<name/ or next;
+ $x =~ />\w\w\w\w*:/ and next;
+ $x =~ s|<$Q='[Uu]se(.)'>([^ ]*) (.*)<$QX>|&$_form_|e;
+ $x = &eval_MK_LIST("listsitemap", $x, @MK_SITE);
+ $x =~ /<name/ or next;
$x =~ s|<!--[u]se(1)-->|<tr class=\"listsitemap$1\"><td>*</td>|;
$x =~ s|<!--[u]se(2)-->|<tr class=\"listsitemap$1\"><td>-</td>|;
$x =~ s|<!--[u]se(.)-->|<tr class=\"listsitemap$1\"><td> </td>|;
- $x =~ /<tr.class=\"listsitemap3\">/ and $x =~ s|<name [^<>]*>|$&- |;
+ $x =~ /<tr.class=\"listsitemap3\">/ and $x =~ s|(<name [^<>]*>)|$1- |;
$x =~ s|<!--[^<>]*-->| |g;
$x =~ s|<name href=\"name:sitemap:|<name href=\"|;
$x =~ s|<name |<td><a |; $x =~ s|</name>|</a></td>$_tabb_|;
- $x =~ s|<date>|<td><small>|; $x =~ s|</date>|</small></td>$_tabb_|;
- $x =~ s|<long>|<td><em>|; $x =~ s|</long>|</em></td></tr>|;
- push @OUT, $x;
- }
- for $xx (grep {/=[u]se.=/} @$INPUTS) {
- my $x = $xx; $x =~ s/=[u]se.=name:sitemap://; $x =~ s:\s*::gs;
+ $x =~ s|<date>|<td><small style="date">|;
+ $x =~ s|</date>|</small></td>$_tabb_|;
+ $x =~ s|<long>|<td><em><!--long-->|;
+ $x =~ s|</long>|<!--/long--></em></td></tr>|;
+ push @OUT, $x.$n;
+ }
+ for $xx (grep {/<$Q='[u]se.'>/} @$INPUTS) {
+ my $x = $xx;
+ $x =~ s/<$Q='[u]se.'>name:sitemap://; $x =~ s|<$QX>||; $x =~ s:\s*::gs;
if (-f $x) {
for (grep {/<tr.class=\"listsitemap\d\">/} source($x)) {
push @OUT, $_;
return @OUT;
}
+my $_xi_include_=
+ "<xi:include xmlns:xi=\"http://www.w3.org/2001/XInclude\" parse=\"xml\"";
+
+sub make_xmlsitemap
+{ # traditional - the body contains a list with date and title extras
+ my ($INPUTS,$Z)= @_ ; $INPUTS=\@MK_DATA if not $INPUTS;
+ @MK_SITE = &siteinfo2sitemap(); # have <name><long><date> addon-sed
+ my @OUT = ();
+ my $_form_=sub{"<!--\"$2\"--><name href=\"$2\">$3</name>"};
+ my $xx;
+ for $xx (grep {/<$Q='[Uu]se.'>/} @$INPUTS) {
+ my $x = "".$xx;
+ $x =~ />\w\w\w\w*:/ and next;
+ $x =~ s|<$Q='[Uu]se(.)'>([^ ]*) (.*)<$QX>|&$_form_|e;
+ $x = &eval_MK_LIST("listsitemap", $x, @MK_SITE);
+ $x =~ /<name/ or next;
+ $x =~ m|href="${SITEFILE}"| and next;
+ $x =~ m|href="${SITEFILE}l"| and next;
+ $x =~ s|(href="[^<>]*)\.html(")|$1.xml$2|g;
+ $x =~ s|.*<name|$_xi_include_$n |;
+ $x =~ s|>.*</name>| />|;
+ push @OUT, $x.$n;
+ }
+ return @OUT;
+}
+
sub print_extension
{
my ($ARG,$Z)= @_ ; $ARG=$o{print} if not $ARG;
return ".print";
}
}
-
+
+sub from_sourcefile
+{
+ my ($U,$Z) = @_;
+ if (-f $U) {
+ return $U;
+ } elsif (-f "$o{src_dir}/$U") {
+ return "$o{src_dir}/$U";
+ } else {
+ return $U;
+ }
+}
+
sub html_sourcefile # generally just cut away the trailing "l" (ell)
-{ # making "page.html" argument into "page.htm" return
+{ # making "page.html" argument into "page.htm" return
my ($U,$Z) = @_;
my $_SRCFILE_=$U; $_SRCFILE_ =~ s/l$//;
+ my $_XMLFILE_=$U; $_XMLFILE_ =~ s/\.html$/.dbk/;
if (-f $_SRCFILE_) {
return $_SRCFILE_;
+ } elsif (-f $_XMLFILE_) {
+ return $_XMLFILE_;
} elsif (-f "$o{src_dir}/$_SRCFILE_") {
return "$o{src_dir}/$_SRCFILE_";
+ } elsif (-f "$o{src_dir}/$_XMLFILE_") {
+ return "$o{src_dir}/$_XMLFILE_";
} else {
return ".//$_SRCFILE_";
}
sub make_printsitefile
{
# building the printsitefile looks big but its really a loop over sects
- my ($INPUTS,$Z) = @_; $INPUTS=\@MK_INFO if not $INPUTS;
+ my ($INPUTS,$Z) = @_; $INPUTS=\@MK_DATA if not $INPUTS;
@MK_SITE = &siteinfo2sitemap(); # have <name><long><date> addon-sed
- savelist(\@MK_SITE);
- my @OUT = &make_printsitefile_head ($SITEFILE);
+ savelist(\@MK_SITE,"SITE");
+ my @OUT = &make_printsitefile_head ($SITEFILE);
my $sep=" - " ;
my $_sect1=
"<a href=\"#.\" title=\"section\">$printsitefile_img_1</a> ||$sep";
} # "$r"
push @OUT, "<a name=\".\"></a>";
push @OUT, "</body></html>";
+ savelist(\@OUT,"FORM");
return @OUT;
}
push @OUT, "s/^<!--$_SECT\\\"$_section_\\\"-->//;"; # sect3
push @OUT, "s/^<!--$_SECT\[*\]:\\\"$_section_\\\"-->//;"; # children
$_selected_=&site_get_parentpage($_selected_);
- if ($F =~ /testscript/) { print "($F)parent=$_selected_$n"; }
$_section_=&sed_slash_key($_selected_);
push @OUT, "s/^<!--$_SECT\\\"$_section_\\\"-->//;"; # sect2
$_selected_=&site_get_parentpage($_selected_);
."$n";
}
+# =================================================================== 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>
+
+sub css_sourcefile
+{
+ my ($X,$XXX) = @_;
+ return $X if -f $X;
+ return "$o{src_dir}/$X" if -f "$o{src_dir}/$X";
+ return "$X" if "$X" =~ m:^/:;
+ return "./$X";
+}
+
+my %XMLTAGS = ();
+sub css_xmltags # $SOURCEFILE
+{
+ my $X=$SOURCEFILE;
+ my %R = ();
+ my $line;
+ foreach $line (source($SOURCEFILE)) {
+ $line =~ s|>[^<>]*<|><|g;
+ $line =~ s|^[^<>]*<|<|;
+ $line =~ s|>[^<>]*\$|>|;
+ my $item;
+ foreach $item (split /</, $line) {
+ $item =~ m:^/: and next;
+ $item =~ m:^\s*$: and next;
+ $item !~ m|>| and next;
+ $item =~ s|>.*||;
+ chomp $item;
+ $R{$item} = "";
+ }
+ }
+ @{$XMLTAGS{$X}} = keys %R;
+}
+
+my %XMLSTYLESHEETS = ();
+sub css_xmlstyles # $SOURCEFILE
+{
+ my $X=$SOURCEFILE;
+ my %R = ();
+ my $text = "";
+ my $line = "";
+ foreach $line (source($SOURCEFILE)) {
+ $text .= $line;
+ $text =~ s|<link *rel=[\'\"]*stylesheet|<?xml-stylesheet |;
+ if ($text !~ m/<.xml-stylesheet/) { $text = ""; next; }
+ if ($text !~ m/href=/) { next; }
+ $text =~ s|^.*<.xml-stylesheet||;
+ $text =~ s|^.*href=[\"\']||; $text =~ s|[\"\'].*||s;
+ chomp $text;
+ $R{$text} = "";
+ }
+ foreach $line (source($SITEFILE)) {
+ $text .= $line;
+ $text =~ s|<link *rel=[\'\"]*stylesheet|<?xml-stylesheet |;
+ if ($text !~ m/<.xml-stylesheet/) { $text = ""; next; }
+ if ($text !~ m/href=/) { next; }
+ $text =~ s|^.*<.xml-stylesheet||;
+ $text =~ s|^.*href=[\"\']||; $text =~ s|[\"\'].*||s;
+ chomp $text;
+ $R{$text} = "";
+ }
+ @{$XMLSTYLESHEETS{$X}} = keys %R;
+}
+
+my %XMLTAGSCSS = ();
+sub css_xmltags_css # $SOURCEFILE
+{
+ my $X=$SOURCEFILE;
+ my @S = $XMLTAGS{$X};
+ my @R = ();
+ my $xmlstylesheet;
+ foreach $xmlstylesheet (@{$XMLSTYLESHEETS{$X}}) {
+ my $stylesheet = css_sourcefile($xmlstylesheet);
+ if (-f $stylesheet) {
+ push @R, "/* $xmlstylesheet */";
+ my $text = "";
+ my $line = "";
+ my $STYLESHEET = $stylesheet;
+ open STYLESHEET, "<$STYLESHEET" or next;
+ foreach $line (<STYLESHEET>)
+ {
+ $text .= $line;
+ if ($text =~ /^[^\{]*\}/s) { $text = ""; next; }
+ if ($text !~ /^[^\{]*\{.*\}/s) { next; }
+ $text =~ s|\r||g;
+ my $xmltag; my $found = 0;
+ foreach $xmltag (grep /^\w/, @{$XMLTAGS{$X}}) {
+ $xmltag =~ s| .*||;
+ if (grep {$_ eq $xmltag} qw/title section/) {
+ next if $xmltag eq "section";
+ $found++ if $text =~
+ /\b$xmltag\s*(?:,[^{},]*)*\s*\{/s;
+ my $xmlparent;
+ foreach $xmlparent (@{$XMLTAGS{$X}}) {
+ $xmlparent =~ s| .*||;
+ /^\w/ or next;
+ $found++ if $text =~
+ /\b$xmlparent\s+$xmltag\s*(?:,[^{},]*)*\s*\{/s;
+ }
+ } else {
+ $found++ if $text =~
+ /\b$xmltag\s*(?:,[^\{\},]*)*\{/s;
+ }
+ last if $found;
+ }
+ if (not $found) { $text = ""; next; }
+ foreach $xmltag (grep /^\w/, @{$XMLTAGS{$X}}) {
+ $xmltag =~ s| .*||;
+ if (grep {$_ eq $xmltag} @HTMLTAGS) { next; }
+ if (grep {$_ eq $xmltag} @HTMLTAGS2) { next; }
+ $text =~ s/(\b$xmltag\s*(?:,[^{},]*)*\s*\{)/.$1/gs;
+ }
+ chomp $text;
+ push @R, $text; $text = ""; next;
+ }
+ } else {
+ warn "$xmlstylesheet : ERROR, no such stylesheet $xmlstylesheet";
+ }
+ }
+ @{$XMLTAGSCSS{$X}} = @R;
+}
+
+my %XMLMAPPING = ();
+sub css_xmlmapping # $SOURCEFILE
+{
+ my $X=$SOURCEFILE;
+ my %R = ();
+ foreach (@{$XMLTAGSCSS{$X}}) {
+ my $span = "";
+ $span="li" if /\bdisplay\s*:\s*list-item\b/;
+ $span="caption" if /\bdisplay\s*:\s*table-caption\b/;
+ $span="td" if /\bdisplay\s*:\s*table-cell\b/;
+ $span="tr" if /\bdisplay\s*:\s*table-row\b/;
+ $span="table" if /\bdisplay\s*:\s*table\b/;
+ $span="div" if /\bdisplay\s*:\s*block\b/;
+ $span="span" if /\bdisplay\s*:\s*inline\b/;
+ $span="small" if /\bdisplay\s*:\s*none\b/;
+ $span="ul" if /\blist-style-type\s*:\s*disc\b/ and $span eq "div";
+ $span="ol" if /\blist-style-type\s*:\s*decimal\b/ and $span eq "div";
+ $span="tt" if /\bfont-family\s*:\s*monospace\b/ and $span eq "span";
+ $span="em" if /\bfont-style\s*:\s*italic\b/ and $span eq "span";
+ $span="b" if /\bfont-weight\s*:\s*bold\b/ and $span eq "span";
+ $span="pre" if /\bwhite-space\s*:\s*pre\b/ and $span eq "div";
+ my $xmltag;
+ for $xmltag (grep /^\w/, @{$XMLTAGS{$X}}) {
+ $xmltag =~ s| .*||;
+ if (/\.$xmltag\b/s) {
+ $R{$xmltag} = $span;
+ $R{$xmltag} = "p" if $xmltag eq "para" and $span eq "div";
+ $R{$xmltag} = "a" if $xmltag eq "ulink" and $span eq "span";
+ }
+ }
+ }
+ %{$XMLMAPPING{$X}} = %R;
+}
+
+sub css_scan # $SOURCEFILE
+{
+ css_xmltags ();
+ css_xmlstyles ();
+ css_xmltags_css ();
+ css_xmlmapping ();
+}
+
+sub tags2span_sed # $SOURCEFILE > $++
+{
+ my $X=$SOURCEFILE;
+ my $xmltag;
+ my @R = ();
+ push @R, "s|<[?]xml-stylesheet[^<>]*[?]>||";
+ push @R, "s|<link *rel=['\"]*stylesheet[^<>]*>||";
+ push @R, "s|<section[^<>]*>||g;";
+ push @R, "s|</section[^<>]*>||g;";
+ for $xmltag (grep /^\w/, @{$XMLTAGS{$X}}) {
+ $xmltag =~ s| .*||;
+ if (grep {$_ eq $xmltag} @HTMLTAGS) { next; }
+ if (grep {$_ eq $xmltag} @HTMLTAGS2) { next; }
+ my $span = $XMLMAPPING{$X}{$xmltag};
+ $span = "span" if $span eq "";
+ push @R, "s|<$xmltag([\\n\\t ][^<>]*)url=|<$span class=\"$xmltag\"\$1href=|g;";
+ push @R, "s|<$xmltag([\\n\\t >])|<$span class=\"$xmltag\"\$1|g;";
+ push @R, "s|</$xmltag([\\n\\t >])|</$span\$1|g;";
+ }
+ my $xmlstylesheet;
+ foreach $xmlstylesheet (@{$XMLSTYLESHEETS{$X}}) {
+ my $H="[^<>]*href=[\'\"]${xmlstylesheet}[\'\"][^<>]*";
+ push @R, "s|<[?]xml-stylesheet$H>||;";
+ push @R, "s|<link[^<>]* rel=['\"]*stylesheet['\"]$H>||;";
+ }
+ return @R;
+}
+
+sub tags2meta_sed # $SOURCEFILE > $++
+{
+ my @R = ();
+ push @R, " <style type=\"text/css\"><!--";
+ push @R, map {s/(^|\n)/$1 /g;$_} @{$XMLTAGSCSS{$SOURCEFILE}};
+ push @R, " --></style>";
+ @R = () if $#R < 3;
+ return @R;
+}
+
+# ==========================================================================
+# 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.
+
+sub scan_xml_rootnode
+{
+ my ($INF,$XXX) = @_;
+ $INF = \@{$DATA{$F}} if not $INF;
+ for my $entry (source($SOURCEFILE)) {
+ my $line = $entry; next if $line !~ /<\w/;
+ $line =~ s/<(\w*).*/$1/s;
+ # print ":",$line,$n;
+ push @{$INF}, "<!root $F>$line";
+ return;
+ }
+}
+
+sub get_xml_rootnode
+{
+ my ($INF,$XXX) = @_;
+ $INF = \@{$DATA{$F}} if not $INF;
+ my $_file_ = sed_slash_key($F);
+ foreach my $entry (grep /^<!root $_file_>/, @{$INF}) {
+ my $line=$entry; $line =~ s|.*>||;
+ return $line;
+ }
+}
+
+sub xml_sourcefile
+{
+ my ($X,$XXX) = @_;
+ my $XMLFILE=$X; $XMLFILE =~ s/\.xml$/.dbk/;
+ my $SRCFILE=$X; $SRCFILE =~ s/\.xml$/.htm/;
+ $XMLFILE="///" if $X eq $XMLFILE;
+ $SRCFILE="///" if $X eq $SRCFILE;
+ return $XMLFILE if -f $XMLFILE;
+ return $SRCFILE if -f $SRCFILE;
+ return "$o{src_dir}/$XMLFILE" if -f "$o{src_dir}/$XMLFILE";
+ return "$o{src_dir}/$SRCFILE" if -f "$o{src_dir}/$SRCFILE";
+ return ".//$XMLFILE"; # $++ (not found?)
+}
+
+sub scan_xmlfile
+{
+ $SOURCEFILE= &xml_sourcefile($F);
+ hint "'$SOURCEFILE': scanning xml -> '$F'";
+ scan_xml_rootnode();
+ my $rootnode=&get_xml_rootnode(); $rootnode =~ s|^(h\d.*$)|$1 <?section?>|;
+ hint "'$SOURCEFILE': rootnode ('$rootnode')";
+}
+
+sub make_xmlfile
+{
+ $SOURCEFILE= &xml_sourcefile($F);
+ my $X=$SOURCEFILE;
+ my $article= &get_xml_rootnode();
+ $article="article" if $article eq "";
+ my $text = "";
+ $text .= '<!DOCTYPE '.$article.
+ ' PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"'.$n;
+ $text .= ' "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">'
+ .$n;
+ for my $stylesheet (@{$XMLSTYLESHEETS{$X}}) {
+ $text .= "<?xml-stylesheet type=\"text/css\" href=\"$stylesheet\" ?>"
+ .$n;
+ }
+ for (source($SOURCEFILE)) {
+ s!<>!\ \;!g;
+ s!(&)(&)!${1}amp;${2}amp;!g;
+ s!(<[^<>]*)(width)(=)(\d+\%*)!$1$2$3\"$4\"!g;
+ s!(<[^<>]*)(cellpadding)(=)(\d+\%*)!$1$2$3\"$4\"!g;
+ s!(<[^<>]*)(border)(=)(\d+\%*)!$1$2$3\"$4\"!g;
+ s!<[?]xml-stylesheet[^<>]*>!!;
+ s!<link[^<>]* rel=[\'\"]*stylesheet[^<>]*>!!;
+ s!<[hH]\d!<title!g;
+ s!</[hH]\d!</title!g;
+ s!(</title> *)([^<>]*\w[^<>\r\n]*)$!$1<sub>$2</sub>!;
+ s!(</title>.*)<sub>!$1<subtitle>!g;
+ s!(</title>.*)</sub>!$1</subtitle>!g;
+ s!(<section>[^<>]*)(<date>.*</date>[^<>\n]*)$!$1<sectioninfo>$2</sectioninfo>!gx;
+ s!<em>!<emphasis>!g;
+ s!</em>!</emphasis>!g;
+ s!<i>!<emphasis>!g;
+ s!</i>!</emphasis>!g;
+ s!<b>!<emphasis role=\"bold\">!g;
+ s!</b>!</emphasis>!g;
+ s!<u>!<emphasis role=\"underline\">!g;
+ s!</u>!</emphasis>!g;
+ s!<big>!<emphasis role=\"strong\">!g;
+ s!</big>!</emphasis>!g;
+ s!<(s|strike)>!<emphasis role=\"strikethrough\">!g;
+ s!</(s|strike)>!</emphasis>!g;
+ s!<center>!<blockquote><para>!g;
+ s!</center>!</para></blockquote>!g;
+ s!<p align=(\"\w*\")>!<para role=${1}>!g;
+ s!<[pP]>!<para>!g;
+ s!</[pP]>!</para>!g;
+ s!<(pre|PRE)>!<screen>!g;
+ s!</(pre|PRE)>!</screen>!g;
+ s!<a( [^<>]*)name=([^<>]*)/>!<anchor ${1}id=${2}/>!g;
+ s!<a( [^<>]*)name=([^<>]*)>!<anchor ${1}id=${2}/>!g;
+ s!<a( [^<>]*)href=!<ulink${1}url=!g;
+ s!</a>!</ulink>!g;
+ s! remap=\"url\">[^<>]*</ulink>! />!g;
+ s!<(/?)span(\s[^<>]*)?>!<${1}phrase${2}>!g;
+ s!<small(\s[^<>]*)?>!<phrase role=\"small\"${1}>!g;
+ s!</small(\s[^<>]*)?>!</phrase${1}>!g;
+ s!<(/?)(sup)>!<${1}superscript>!g;
+ s!<(/?)(sub)>!<${1}subscript>!g;
+ s!(<)(li)(><)!${1}listitem${3}!g;
+ s!(></)(li)(>)!${1}listitem${3}!g;
+ s!(<)(li)(>)!${1}listitem${3}<para>!g;
+ s!(</)(li)(>)!</para>${1}listitem${3}!g;
+ s!(</?)(ul)>!${1}itemizedlist>!g;
+ s!(</?)(ol)>!${1}orderedlist>!g;
+ s!(</?)(dl)>!${1}variablelist>!g;
+ s!<(/?)DT>!<${1}dt>!g;
+ s!<(/?)DD>!<${1}dd>!g;
+ s!<(/?)DL>!<${1}dl>!g;
+ s!<BLOCKQUOTE>!<blockquote><para>!g;
+ s!</BLOCKQUOTE>!</para></blockquote>!g;
+ s!<(/?)dl>!<${1}variablelist>!g;
+ s!<dt\b([^<>]*)>!<varlistentry${1}><term>!g;
+ s!</dt\b([^<>]*)>!</term>!g;
+ s!<dd\b([^<>]*)><!<listitem${1}><!g;
+ s!></dd\b([^<>]*)>!></listitem></varlistentry>!g;
+ s!<dd\b([^<>]*)>!<listitem${1}><para>!g;
+ s!</dd\b([^<>]*)>!</para></listitem></varlistentry>!g;
+ s!<table[^<>]*><tr><td>(<table[^<>]*>)!$1!;
+ s!(</table>)</td></tr></table>!$1!;
+ s!<table\b([^<>]*)>!<informaltable${1}><tgroup cols=\"2\"><tbody>!g;
+ s!</table\b([^<>]*)>!</tbody></tgroup></informaltable>!g;
+ s!(</?)tr(\s[^<>]*)?>!${1}row${2}>!g;
+ s!(</?)td(\s[^<>]*)?>!${1}entry${2}>!g;
+ s!(<informaltable[^<>]*\swidth=\"100\%\")!$1 pgwide=\"1\"!g;
+ s!(<tgroup[<>]*\scols=\"2\">)(<tbody>)
+ !$1<colspec colwidth=\"1*\" /><colspec colwidth=\"1*\" />$2!gx;
+ s!(<entry[^<>]*\s)width=(\"\d*\%*\")!${1}remap=${2}!g;
+ s!<nobr>([\'\`]*)<tt>!<cmdsynopsis><command>$1!g;
+ s!</tt>([\'\`]*)</nobr>!$1</command></cmdsynopsis>!g;
+ s!<nobr><(tt|code)>([\`\"\'])!<cmdsynopsis><command>$2!g;
+ s!<(tt|code)><nobr>([\`\"\'])!<cmdsynopsis><command>$2!g;
+ s!([\`\"\'])</(tt|code)></nobr>!$1</command></cmdsynopsis>!g;
+ s!([\`\"\'])</nobr></(tt|code)>!$1</command></cmdsynopsis>!g;
+ s!(</?)tt>!${1}constant>!g;
+ s!(</?)code>!${1}literal>!g;
+ s!<br>!<br />!g;
+ s!<br */>!<screen role=\"linebreak\">\n</screen>!g;
+ $text .= $_;
+ }
+ open F, ">$F" or die "could not write $F: $!"; print F $text; close F;
+ echo "'$SOURCEFILE': ",&ls_s($SOURCEFILE)," >> ",&ls_s($F);
+}
+
+sub make_xmlmaster
+{
+ $SOURCEFILE= &xml_sourcefile($F);
+ my $X=$SOURCEFILE;
+ my $article="section"; # book? chapter?
+ my $text = "";
+ $text .= '<!DOCTYPE '.$article.
+ ' PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"'.$n;
+ $text .= ' "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">'
+ .$n;
+ for my $stylesheet (@{$XMLSTYLESHEETS{$X}}) {
+ $text .= "<?xml-stylesheet type=\"text/css\" href=\"$stylesheet\" ?>"
+ .$n;
+ }
+ # $text .= "<section><sectioninfo><date/><authorblurb/></sectioninfo>...";
+ $text .= "<section><title>Documentation</title>$n";
+ for (make_xmlsitemap()) {
+ $text .= $_;
+ }
+ $text .= "</section>$n";
+ open F, ">$F" or die "could not write $F: $!"; print F $text; close F;
+ echo "'$SOURCEFILE': ",&ls_s($SOURCEFILE)," >*> ",&ls_s($F);
+}
+
# ==========================================================================
#
# During processing we will create a series of intermediate files that
# 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]")
my $S="\\ \\;";
# S="[&]nbsp[;]"
{
my ($U,$V,$W,$X,$Z) = @_;
my @list = (
- "/^$U$V$W*<a href=/ and s/^/$X/;",
- "/^<>$U$V$W*<a href=/ and s/^/$X/;",
- "/^$S$U$V$W*<a href=/ and s/^/$X/;",
- "/^$U<>$V$W*<a href=/ and s/^/$X/;",
- "/^$U$S$V$W*<a href=/ and s/^/$X/;",
- "/^$U$V<>$W*<a href=/ and s/^/$X/;",
- "/^$U$V$S$W*<a href=/ and s/^/$X/;" );
+ "s%^($U$V$W*<a) (href=)%\$1 $X \$2%;",
+ "s%^(<>$U$V$W*<a) (href=)%\$1 $X \$2%;",
+ "s%^($S$U$V$W*<a) (href=)%\$1 $X \$2%;",
+ "s%^($U<>$V$W*<a) (href=)%\$1 $X \$2%;",
+ "s%^($U$S$V$W*<a) (href=)%\$1 $X \$2%;",
+ "s%^($U$V<>$W*<a) (href=)%\$1 $X \$2%;",
+ "s%^($U$V$S$W*<a) (href=)%\$1 $X \$2%;" );
return @list;
}
my ($U,$V,$W,$X,$Z) = @_;
my @list = &echo_HR_EM_PP ("$U", "$V", "$W", "$X");
my @listt = (
- "/^$V$W*<a href=/ and s/^/$X/;",
- "/^<>$V$W*<a href=/ and s/^/$X/;",
- "/^$S$V$W*<a href=/ and s/^/$X/;",
- "/^$V<>$W*<a href=/ and s/^/$X/;",
- "/^$V$S$W*<a href=/ and s/^/$X/;" );
+ "s%^($V$W*<a) (href=)%\$1 $X \$2%;",
+ "s%^(<>$V$W*<a) (href=)%\$1 $X \$2%;",
+ "s%^($S$V$W*<a) (href=)%\$1 $X \$2%;",
+ "s%^($V<>$W*<a) (href=)%\$1 $X \$2%;",
+ "s%^($V$S$W*<a) (href=)%\$1 $X \$2%;",
+ "s%^($V$W*<><a) (href=)%\$1 $X \$2%;",
+ "s%^($V$W*$S<a) (href=)%\$1 $X \$2%;" );
push @list, @listt;
return @list;
}
{
my ($U,$V,$W,$Z) = @_;
my @list = (
- "/^$U$V*<a href=/ and s/^/$W/;",
- "/^<>$U$V*<a href=/ and s/^/$W/;",
- "/^$S$U$V*<a href=/ and s/^/$W/;",
- "/^$U<>$V*<a href=/ and s/^/$W/;",
- "/^$U$S$V*<a href=/ and s/^/$W/;" );
+ "s%^($U<a) (href=)%\$1 $W \$2%;",
+ "s%^($U$V*<a) (href=)%\$1 $W \$2%;",
+ "s%^(<>$U$V*<a) (href=)%\$1 $W \$2%;",
+ "s%^($S$U$V*<a) (href=)%\$1 $W \$2%;",
+ "s%^($U<>$V*<a) (href=)%\$1 $W \$2%;",
+ "s%^($U$S$V*<a) (href=)%\$1 $W \$2%;" );
return @list;
}
sub echo_br_PP
my ($U,$V,$W,$Z) = @_;
my @list = &echo_HR_PP ("$U", "$V", "$W");
my @listt = (
- "/^$V*<a href=/ and s/^/$W/;",
- "/^<>$V*<a href=/ and s/^/$W/;",
- "/^$S$V*<a href=/ and s/^/$W/;" );
+ "s%^($V*<a) (href=)%\$1 $W \$2%;",
+ "s%^(<>$V*<a) (href=)%\$1 $W \$2%;",
+ "s%^($S$V*<a) (href=)%\$1 $W \$2%;" );
push @list, @listt;
return @list;
}
{
my ($U,$V,$Z) = @_;
my @list = (
- "/^<>$U*<a href=/ and s/^/$V/;",
- "/^$S$U*<a href=/ and s/^/$V/;",
- "/^<><>$U*<a href=/ and s/^/$V/;",
- "/^$S$S$U*<a href=/ and s/^/$V/;",
- "/^<>$U<>*<a href=/ and s/^/$V/;",
- "/^$S$U$S*<a href=/ and s/^/$V/;",
- "/^$U<><>*<a href=/ and s/^/$V/;",
- "/^$U$S$S*<a href=/ and s/^/$V/;",
- "/^$U<>*<a href=/ and s/^/$V/;",
- "/^$U$S*<a href=/ and s/^/$V/;" );
+ "s%^(<>$U*<a) (href=)%\$1 $V \$2%;",
+ "s%^($S$U*<a) (href=)%\$1 $V \$2%;",
+ "s%^(<><>$U*<a) (href=)%\$1 $V \$2%;",
+ "s%^($S$S$U*<a) (href=)%\$1 $V \$2%;",
+ "s%^(<>$U<>*<a) (href=)%\$1 $V \$2%;",
+ "s%^($S$U$S*<a) (href=)%\$1 $V \$2%;",
+ "s%^($U<><>*<a) (href=)%\$1 $V \$2%;",
+ "s%^($U$S$S*<a) (href=)%\$1 $V \$2%;",
+ "s%^($U<>*<a) (href=)%\$1 $V \$2%;",
+ "s%^($U$S*<a) (href=)%\$1 $V \$2%;" );
+ return @list;
+}
+sub echo_sp_SP
+{
+ my ($U,$V,$Z) = @_;
+ my @list = (
+ "s%^($U<a) (href=)%\$1 $V \$2%;",
+ "s%^(<>$U<a) (href=)%\$1 $V \$2%;",
+ "s%^($S$U<a) (href=)%\$1 $V \$2%;",
+ "s%^(<><>$U<a) (href=)%\$1 $V \$2%;",
+ "s%^($S$S$U<a) (href=)%\$1 $V \$2%;",
+ "s%^(<>$U<><a) (href=)%\$1 $V \$2%;",
+ "s%^($S$U$S<a) (href=)%\$1 $V \$2%;",
+ "s%^($U<><><a) (href=)%\$1 $V \$2%;",
+ "s%^($U$S$S<a) (href=)%\$1 $V \$2%;",
+ "s%^($U<><a) (href=)%\$1 $V \$2%;",
+ "s%^($U$S<a) (href=)%\$1 $V \$2%;" );
return @list;
}
sub echo_sp_sp
{
my ($U,$V,$Z) = @_;
my @list = (
- "/^$U*<a name=/ and s/^/$V/;",
- "/^<>$U*<a name=/ and s/^/$V/;",
- "/^$S$U*<a name=/ and s/^/$V/;",
- "/^<><>$U*<a name=/ and s/^/$V/;",
- "/^$S$S$U*<a name=/ and s/^/$V/;",
- "/^<>$U<>*<a name=/ and s/^/$V/;",
- "/^$S$U$S*<a name=/ and s/^/$V/;",
- "/^$U<><>*<a name=/ and s/^/$V/;",
- "/^$U$S$S*<a name=/ and s/^/$V/;",
- "/^$U<>*<a name=/ and s/^/$V/;",
- "/^$U$S*<a name=/ and s/^/$V/;" );
+ "s%^($U<a) (name=)%\$1 $V \$2%;",
+ "s%^(<>$U<a) (name=)%\$1 $V \$2%;",
+ "s%^($S$U<a) (name=)%\$1 $V \$2%;",
+ "s%^(<><>$U<a) (name=)%\$1 $V \$2%;",
+ "s%^($S$S$U<a) (name=)%\$1 $V \$2%;",
+ "s%^(<>$U<><a) (name=)%\$1 $V \$2%;",
+ "s%^($S$U$S<a) (name=)%\$1 $V \$2%;",
+ "s%^($U<><><a) (name=)%\$1 $V \$2%;",
+ "s%^($U$S$S<a) (name=)%\$1 $V \$2%;",
+ "s%^($U<><a) (name=)%\$1 $V \$2%;",
+ "s%^($U$S<a) (name=)%\$1 $V \$2%;" );
return @list;
}
my $b3="[\\/:]";
my $q3="[\\/:,[]";
@MK_GETS = ();
- push @MK_GETS, &echo_HR_PP ("<hr>", "$h1", "<!--sect1-->");
- push @MK_GETS, &echo_HR_EM_PP("<hr>","<em>", "$h1", "<!--sect1-->");
- push @MK_GETS, &echo_HR_EM_PP("<hr>","<strong>", "$h1", "<!--sect1-->");
- push @MK_GETS, &echo_HR_PP ("<br>", , "$b1$b1", "<!--sect1-->");
- push @MK_GETS, &echo_HR_PP ("<br>", , "$b2$b2", "<!--sect2-->");
- push @MK_GETS, &echo_HR_PP ("<br>", , "$b3$b3", "<!--sect3-->");
- push @MK_GETS, &echo_br_PP ("<br>", , "$b2$b2", "<!--sect2-->");
- push @MK_GETS, &echo_br_PP ("<br>", , "$b3$b3", "<!--sect3-->");
- push @MK_GETS, &echo_br_EM_PP("<br>","<small>" , "$q3" , "<!--sect3-->");
- push @MK_GETS, &echo_br_EM_PP("<br>","<em>" , "$q3" , "<!--sect3-->");
- push @MK_GETS, &echo_br_EM_PP("<br>","<u>" , "$q3" , "<!--sect3-->");
- push @MK_GETS, &echo_HR_PP ("<br>", , "$q3" , "<!--sect3-->");
- push @MK_GETS, &echo_sp_PP ( "$q3" , "<!--sect3-->");
- push @MK_GETS, &echo_sp_sp ( "$q3" , "<!--sect9-->");
+ push @MK_GETS, &echo_HR_PP ("<hr>", "$h1", "sect=\\\"1\\\"");
+ push @MK_GETS, &echo_HR_EM_PP("<hr>","<em>", "$h1", "sect=\\\"1\\\"");
+ push @MK_GETS, &echo_HR_EM_PP("<hr>","<strong>", "$h1", "sect=\\\"1\\\"");
+ push @MK_GETS, &echo_HR_PP ("<br>", , "$b1$b1", "sect=\\\"1\\\"");
+ push @MK_GETS, &echo_HR_PP ("<br>", , "$b2$b2", "sect=\\\"2\\\"");
+ push @MK_GETS, &echo_HR_PP ("<br>", , "$b3$b3", "sect=\\\"3\\\"");
+ push @MK_GETS, &echo_br_PP ("<br>", , "$b2$b2", "sect=\\\"2\\\"");
+ push @MK_GETS, &echo_br_PP ("<br>", , "$b3$b3", "sect=\\\"3\\\"");
+ push @MK_GETS, &echo_br_EM_PP("<br>","<small>" , "$q3" , "sect=\\\"3\\\"");
+ push @MK_GETS, &echo_br_EM_PP("<br>","<em>" , "$q3" , "sect=\\\"3\\\"");
+ push @MK_GETS, &echo_br_EM_PP("<br>","<u>" , "$q3" , "sect=\\\"3\\\"");
+ push @MK_GETS, &echo_HR_PP ("<br>", , "$q3" , "sect=\\\"3\\\"");
+ push @MK_GETS, &echo_br_PP ("<u>", , "$b2" , "sect=\\\"2\\\"");
+ push @MK_GETS, &echo_sp_PP ( "$q3" , "sect=\\\"3\\\"");
+ push @MK_GETS, &echo_sp_SP ( "" , "sect=\\\"2\\\"");
+ push @MK_GETS, &echo_sp_sp ( "$q3" , "sect=\\\"9\\\"");
+ push @MK_GETS, &echo_sp_sp ("<br>", "sect=\\\"9\\\"");
@MK_PUTS = map { my $x=$_; $x =~ s/(>)(\[)/$1 *$2/; $x } @MK_GETS;
# 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...>"
}
-my $_uses_= sub{"=use$1=$2 $3" }; my $_name_= sub{"=use$1=name:$2 $3" };
-my $_getW_="<!--sect([$NN])-->";
-my $_getX_="<!--sect([$NN])--><[^<>]*>[^<>]*";
-my $_getY_="<!--sect([$NN])--><[^<>]*>[^<>]*<[^<>]*>[^<>]*";
+my $_uses_= sub{"<$Q='use$1'>$2 $3<$QX>" };
+my $_name_= sub{"<$Q='use$1'>name:$2 $3<$QX>" };
sub make_sitemap_list
{
+ my ($V,$Z) = @_; $V = $SITEFILE if not $V;
# scan sitefile for references pages - store as "=use+=href+ anchortext"
- for (source($SITEFILE)) {
-# print join("$n;",@MK_GETS),$n;
- $_ = &eval_MK_LIST($_, @MK_GETS);
- /^<!--sect[$NN]-->/ or next;
- 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;
- /^=....=/ or next;
- push @MK_INFO, $_;
+ for (source($V)) {
+ my $x = $_;
+ local $_ = &eval_MK_LIST("sitemap_list", $x, @MK_GETS);
+ /<a sect=\"[$NN]\"/ or next;
+ chomp;
+ s{.*<a sect=\"([^\"]*)\" href=\"([^\"]*)\"[^<>]*>(.*)</a>.*}{&$_uses_}e;
+ s{.*<a sect=\"([^\"]*)\" name=\"([^\"]*)\"[^<>]*>(.*)</a>.*}{&$_name_}e;
+ s{.*<a sect=\"([^\"]*)\" name=\"([^\"]*)\"[^<>]*>(.*)}{&$_name_}e;
+ /^<$Q=/ or next;
+ /^<!/ and next;
+ push @MK_DATA, $_;
+ }
+}
+
+my $_Uses_= sub{"<$Q='Use$1'>$2 $3<$QX>" };
+my $_Name_= sub{"<$Q='Use$1'>name:$2 $3<$QX>" };
+
+sub make_subsitemap_list # file-to-scan
+{
+ my ($V,$W,$Z) = @_; $V = $SITEFILE if not $V;
+ # scan sitefile for references pages - store as "=use+=href+ anchortext"
+ for (source($V)) {
+ my $x = $_;
+ local $_ = &eval_MK_LIST("subsitemap_list", $x, @MK_GETS);
+ /<a sect=\"[$NN]\"/ or next;
+ chomp;
+ s{.*<a sect=\"([^\"]*)\" href=\"([^\"]*)\"[^<>]*>(.*)</a>.*}{&$_Uses_}e;
+ s{.*<a sect=\"([^\"]*)\" name=\"([^\"]*)\"[^<>]*>(.*)</a>.*}{&$_Name_}e;
+ s{.*<a sect=\"([^\"]*)\" name=\"([^\"]*)\"[^<>]*>(.*)}{&$_Name_}e;
+ /^<$Q=/ or next;
+ /^<!/ and next;
+ s|>([^:./][^:./]*[./])|>$W$1|;
+ push @MK_DATA, $_;
}
}
# (A) each "use1" creates "=sect=href+ href1" for all following non-"use1"
# (B) each "use1" creates "=node=href2 href1" for all following "use2"
my $sect = "";
- for (grep {/=[u]se.=/} @MK_INFO) {
- if (/=[u]se1=([^ ]*) .*/) { $sect = $1; }
- my $x = $_; $x =~ s/=[u]se.=([^ ]*) .*/=sect=$1/; chomp $x;
- push @MK_INFO, "$x $sect";
+ for (grep {/<$Q='[u]se.'>/} @MK_DATA) {
+ if (/<$Q='[u]se1'>([^ ]*) .*/) { $sect = $1; }
+ my $x = $_; # chomp $x;
+ $x =~ s|<$Q='[u]se.'>([^ ]*) .*|<$Q='sect'>$1 $sect<$QX>|;
+ push @MK_DATA, $x;
}
- for (grep {/=[u]se.=/} @MK_INFO) {
- if (/=[u]se1=([^ ]*) .*/) { $sect = $1; }
- /=[u]se[13456789]=/ and next;
- my $x = $_; $x =~ s/=[u]se.=([^ ]*) .*/=node=$1/; chomp $x;
- push @MK_INFO, "$x $sect";
+ for (grep {/<$Q='[u]se.'>/} @MK_DATA) {
+ if (/<$Q='[u]se1'>([^ ]*) .*/) { $sect = $1; }
+ /<$Q='[u]se[13456789]'>/ and next;
+ my $x = $_; # chomp $x;
+ $x =~ s|<$Q='[u]se.'>([^ ]*) .*|<$Q='node'>$1 $sect<$QX>|;
+ push @MK_DATA, $x;
}
}
# 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)
my $sect = "";
- for (grep {/=[u]se.=/} @MK_INFO) {
- if (/=[u]se1=([^ ]*) .*/) { $sect = $1; }
- if (/=[u]se2=([^ ]*) .*/) { $sect = $1; }
- /=[u]se[1]=/ and next;
- my $x = $_; $x =~ s/=[u]se.=([^ ]*) .*/=page=$1/; chomp $x;
- push @MK_INFO, "$x $sect";
- }
- for (grep {/=[u]se.=/} @MK_INFO) {
- if (/=[u]se1=([^ ]*) .*/) { $sect = $1; }
- if (/=[u]se2=([^ ]*) .*/) { $sect = $1; }
- /=[u]se[12456789]=/ and next;
- my $x = $_; $x =~ s/=[u]se.=([^ ]*) .*/=node=$1/; chomp $x;
- push @MK_INFO, "$x $sect"; print "(",$_,")","$x $sect", $n;
+ for (grep {/<$Q='[u]se.'>/} @MK_DATA) {
+ if (/<$Q='[u]se1'>([^ ]*) .*/) { $sect = $1; }
+ if (/<$Q='[u]se2'>([^ ]*) .*/) { $sect = $1; }
+ /<$Q='[u]se[1]'>/ and next;
+ my $x = $_;
+ $x =~ s|<$Q='[u]se.'>([^ ]*) .*|<$Q='page'>$1<$QX>|; chomp $x;
+ push @MK_DATA, "$x $sect";
+ }
+ for (grep {/<$Q='[u]se.'>/} @MK_DATA) {
+ if (/<$Q='[u]se1'>([^ ]*) .*/) { $sect = $1; }
+ if (/<$Q='[u]se2'>([^ ]*) .*/) { $sect = $1; }
+ /<$Q='[u]se[12456789]'>/ and next;
+ my $x = $_;
+ $x =~ s/<$Q='[u]se.'>([^ ]*) .*/<$Q='node'>$1<$QX>/; chomp $x;
+ push @MK_DATA, "$x $sect"; ## print "(",$_,")","$x $sect", $n;
}
# and for the root sections we register ".." as the parenting group
- for (grep {/=[u]se1=/} @MK_INFO) {
- my $x = $_; $x =~ s/=[u]se.=([^ ]*) .*/=node=$1/; chomp $x;
- push @MK_INFO, trimm("$x ..");
+ for (grep {/<$Q='[u]se1'>/} @MK_DATA) {
+ my $x = $_; $x = trimm($x);
+ $x =~ s/<$Q='[u]se.'>([^ ]*) .*/<$Q='node'>$1 ..<$QX>/; chomp $x;
+ push @MK_DATA, $x;
}
}
sub echo_site_filelist
{
my @OUT = ();
- for (grep {/=[u]se.=/} @MK_INFO) {
- my $x = $_; $x =~ s/=[u]se.=//; $x =~ s/ .*[\n]*//;
+ for (grep {/<$Q='[u]se.'>/} @MK_DATA) {
+ my $x = $_; $x =~ s/<$Q='[u]se.'>//; $x =~ s/ .*[\n]*//;
push @OUT, $x;
}
return @OUT;
sub scan_sitefile # $F
{
$SOURCEFILE=&html_sourcefile($F);
+ hint "'$SOURCEFILE': scanning -> sitefile";
if ($SOURCEFILE ne $F) {
dx_init "$F";
dx_text ("today", &timetoday());
if ($printerfriendly) {
DX_text ("printerfriendly", fast_html_printerfile($F)); }
if ($ENV{USER}) { DC_publisher ($ENV{USER}); }
- print "'$SOURCEFILE': $short (sitemap)$n";
+ echo "'$SOURCEFILE': $short (sitemap)";
site_map_list_title ($F, "$short");
site_map_long_title ($F, "generated sitemap index");
site_map_list_date ($F, &timetoday());
{
my ($FF,$Z) = @_;
$SOURCEFILE=&html_sourcefile($F); # SCAN :
- if ($SOURCEFILE ne $F) { # HTML :
+ hint "'$SOURCEFILE': scanning -> $F"; # HTML :
+ if ($SOURCEFILE ne $F) {
if ( -f $SOURCEFILE) {
- @{$FAST{$F}} = &make_fast ($F);
dx_init "$F";
dx_text ("today", &timetoday());
dx_text ("todays", &timetodays());
my $issue=&info_get_entry("issue");
&site_map_list_date ($F, "$edate");
&info_map_list_date ($F, "$edate");
- print "'$SOURCEFILE': '$title' ('$short') @ '$issue' ('$sectn')$n";
+ css_scan();
+ echo "'$SOURCEFILE': '$title' ('$short') @ '$issue' ('$sectn')";
}else {
- print "'$SOURCEFILE': does not exist$n";
+ echo "'$SOURCEFILE': does not exist";
site_map_list_title ($F, "$F");
site_map_long_title ($F, "$F (no source)");
}
} else {
- print "<$F> - skipped - ($SOURCEFILE)$n";
+ echo "<$F> - skipped - ($SOURCEFILE)";
+ }
+}
+
+sub scan_subsitemap_long
+{
+ my ($V,$W,$ZZZ) = @_;
+ for (source($V)) {
+ my $x = $_;
+ if ($x =~ m|<a href="([^\"]*)">.*<small style="date">([^<>]*)</small>|) {
+ &site_map_list_date($W.$1,$2);
+ }
+ if ($x =~ m|<a href="([^\"]*)">.*<!--long-->([^<>]*)<!--/long-->|) {
+ &site_map_long_title($W.$1,$2);
+ }
}
}
site_map_list_title ($F, "$short");
site_map_long_title ($F, "external sitemap index");
site_map_list_date ($F, &timetoday());
- print "'$F' external sitemap index$n";
+ echo "'$F' external sitemap index";
+ }
+ elsif ($F =~ /^name:(.*\.html*)$/) { # assuming it is a subsitefile
+ my $FF=$1;
+ my $FFF=$FF; $FFF =~ s:/[^/]*$:/:; # dirname
+ $FFF="" if $FFF !~ m:/:;
+ make_subsitemap_list($FF, $FFF);
+ scan_subsitemap_long($FF, $FFF);
}
}
sub scan_httpspec
sub head_sed_sitemap # $filename $section
{
my ($U,$V,$Z) = @_;
- my $FF=&sed_slash_key($U);
+ my $FF=&sed_piped_key($U);
my $SECTION=&sed_slash_key($V);
- my $SECTS="<!--sect[$NN$AZ]-->" ;
- my $SECTN="<!--sect[$NN]-->"; # lines with hrefs
+ my $SECTS="sect=\"[$NN$AZ]\"" ;
+ my $SECTN="sect=\"[$NN]\""; # lines with hrefs
my @OUT = ();
- push @OUT, "/^$SECTS.*<a href=\\\"$FF\\\">/ and s|</a>|</a></b>|;";
- push @OUT, "/^$SECTS.*<a href=\\\"$FF\\\">/ and s|<a href=|<b><a href=|;";
+ push @OUT, "s|(<a $SECTS href=\\\"$FF\\\">.*</a>)|<b>\$1</b>|;";
push @OUT, "/ href=\\\"$SECTION\\\"/ "
."and s|^<td class=\\\"[^\\\"]*\\\"|<td |;" if $sectiontab ne "no";
return @OUT;
{
# traditional.... the sitefile is the full navigation bar
my ($U,$V,$Z) = @_;
- my $FF=&sed_slash_key($U);
+ my $FF=&sed_piped_key($U);
my $SECTION=&sed_slash_key($V);
- my $SECTS="<!--sect[$NN$AZ]-->" ;
- my $SECTN="<!--sect[$NN]-->"; # lines with hrefs
+ my $SECTS="sect=\"[$NN$AZ]\"" ;
+ my $SECTN="sect=\"[$NN]\""; # lines with hrefs
my @OUT = ();
- push @OUT, "/^$SECTS.*<a href=\\\"$FF\\\">/ and s|</a>|</a></b>|;";
- push @OUT, "/^$SECTS.*<a href=\\\"$FF\\\">/ and s|<a href=|<b><a href=|;";
+ push @OUT, "s|(<a $SECTS href=\\\"$FF\\\">.*</a>)|<b>\$1</b>|;";
push @OUT, "/ href=\\\"$SECTION\\\"/ "
."and s|^<td class=\\\"[^\\\"]*\\\"|<td |;" if $sectiontab ne "no";
return @OUT;
{
# sitefile navigation bar is split into sections
my ($U,$V,$Z) = @_;
- my $FF=&sed_slash_key($U);
+ my $FF=&sed_piped_key($U);
my $SECTION=&sed_slash_key($V);
- my $SECTS="<!--sect[$NN$AZ]-->" ;
- my $SECTN="<!--sect[$NN]-->"; # lines with hrefs
+ my $SECTS="sect=\"[$NN$AZ]\"" ;
+ my $SECTN="sect=\"[$NN]\""; # lines with hrefs
my @OUT = ();
# grep all pages with a =sect= relation to current $SECTION and
- # build foreach an sed line "s|$SECTS\(<a href=$F>\)|<!--sectX-->\1|"
+ # build foreach an sed line "s|<a $SECTS (href=$F)>|<a sect="X" $1>|"
# after that all the (still) numeric SECTNs are deactivated / killed.
for my $section ($SECTION, $headsection, $tailsection) {
next if $section eq "no";
- for (grep {/^=sect=[^ ]* $section/} @MK_INFO) {
+ for (grep {/^<$Q='sect'>[^ ]* $section/} @MK_DATA) {
+ my $x = $_;
+ $x =~ s|<$Q='sect'>||; $x =~ s| .*||; # $filename
+ $x =~ s/(.*)/s|<a $SECTS \(href=\\\"$1\\\"\)|<a sect=\\\"X\\\" \$1|/;
+ push @OUT, $x.";";
+ }
+ for (grep {/^<$Q='sect'>name:[^ ]* $section/} @MK_DATA) {
my $x = $_;
- $x =~ s, .*,\\\"\)|<!--sectX-->\$1|,;
- $x =~ s,^=sect=,s|^$SECTS\(.*<a href=\\\",;
+ $x =~ s|<$Q='sect'>name:||; $x =~ s| .*||; # $filename
+ $x =~ s/(.*)/s|<a $SECTS \(name=\\\"$1\\\"\)|<a sect=\\\"X\\\" \$1|/;
push @OUT, $x.";";
}
}
- push @OUT, "s|^$SECTN\[^ \]*(<a href=[^<>]*>).*|<!-- \$1 -->|;";
- push @OUT, "/^$SECTS.*<a href=\\\"$FF\\\">/ and s|</a>|</a></b>|;";
- push @OUT, "/^$SECTS.*<a href=\\\"$FF\\\">/ and s|<a href=|<b><a href=|;";
+ push @OUT, "s|.*<a ($SECTN href=[^<>]*)>.*|<!-- \$1 -->|;";
+ push @OUT, "s|.*<a ($SECTN name=[^<>]*)>.*|<!-- \$1 -->|;";
+ push @OUT, "s|(<a $SECTS href=\\\"$FF\\\">.*</a>)|<b>\$1</b>|;";
push @OUT, "/ href=\\\"$SECTION\\\"/ "
."and s|^<td class=\\\"[^\\\"]*\\\"|<td |;" if $sectiontab ne "no";
return @OUT;
# remember that in this case "${SITEFILE}l" = "$F" = "${SOURCEFILE}l"
@MK_VARS = &info2vars_sed(); # have <!--title--> vars substituted
@MK_META = &info2meta_sed(); # add <meta name="DC.title"> values
- if ( $simplevars eq "warn") {
- @MK_TEST = &info2test_sed(); # check <!--title--> vars old-style
-## $SED_LONGSCRIPT ./$MK_TEST $SOURCEFILE | tee -a ./$MK_OLDS ; fi
- }
my @F_HEAD = (); my @F_FOOT = ();
push @F_HEAD, @MK_PUTS;
push @F_HEAD, &head_sed_sitemap ($F, &info_get_entry_section());
}
my $html = ""; #
- $html .= &eval_MK_FILE($SITEFILE, @F_HEAD);
+ $html .= &eval_MK_FILE("SITE", $SITEFILE, @F_HEAD);
$html .= join("", @F_FOOT);
for (source($SITEFILE)) {
/<\/body>/ or next;
- $html .= &eval_MK_LIST($_, @MK_VARS);
+ $html .= &eval_MK_LIST("sitefile", $_, @MK_VARS);
}
open F, ">$F"; print F $html; close F;
- print "'$SOURCEFILE': ",ls_s($SOURCEFILE)," >-> ",ls_s($F),"$n";
+ echo "'$SOURCEFILE': ",ls_s($SOURCEFILE)," >-> ",ls_s($F);
savesource("$F.~head~", \@F_HEAD);
savesource("$F.~foot~", \@F_FOOT);
} else {
- print "'$SOURCEFILE': does not exist$n";
+ echo "'$SOURCEFILE': does not exist";
} }
}
if ("$SOURCEFILE" ne "$F") {
if (-f "$SOURCEFILE") {
if (grep {/<meta name="formatter"/} source($SOURCEFILE)) {
- print "$SOURCEFILE: SKIP, this sourcefile looks like a formatted file$n";
- print "$SOURCEFILE: (may be a sourcefile in place of a targetfile?)$n";
+ echo "'$SOURCEFILE': SKIP, this sourcefile looks like a formatted file";
+ echo "'$SOURCEFILE': (may be a sourcefile in place of a targetfile?)";
return; }
@MK_VARS = &info2vars_sed(); # have <!--title--> vars substituted
@MK_META = &info2meta_sed(); # add <meta name="DC.title"> values
- if ( $simplevars eq "warn") {
- @MK_TEST = &info2test_sed(); # check <!--title--> vars old-style
-## $SED_LONGSCRIPT ./$MK_TEST $SOURCEFILE | tee -a ./$MK_OLDS ; fi
- }
+ @MK_SPAN = &tags2span_sed(); # extern text/css -> intern css classes
+ push @MK_META, &tags2meta_sed(); # extern text/css -> intern css classes
my @F_HEAD = (); my @F_BODY = (); my $F_FOOT = "";
push @F_HEAD, @MK_PUTS;
if ( $sectionlayout eq "multi") {
} else {
push @F_HEAD, &head_sed_listsection ($F, &info_get_entry_section());
}
- push @F_HEAD, @MK_VARS; push @F_HEAD, @MK_TAGS; #tag and vars
+ push @F_HEAD, @MK_VARS; push @F_HEAD, @MK_TAGS; push @F_HEAD, @MK_SPAN;
push @F_HEAD, "/<\\/body>/ and next;"; #cut lastline
push @F_HEAD, "/<head>/ and $sed_add join(\"\\n\",\@MK_META);"; #add metatags
push @F_BODY, "/<title>/ and next;"; #not that line
- push @F_BODY, @MK_VARS; push @F_BODY, @MK_TAGS; #tag and vars
+ push @F_BODY, @MK_VARS; push @F_BODY, @MK_TAGS; push @F_BODY, @MK_SPAN;
push @F_BODY, &bodymaker_for_sectioninfo(); #if sectioninfo
push @F_BODY, &info2body_sed(); #cut early
push @F_HEAD, &info2head_sed();
- push @F_HEAD, @{$FAST{$F}};
+ push @F_HEAD, &make_back_path($F);
if ($emailfooter ne "no") {
$F_FOOT = &body_for_emailfooter();
}
my $html = "";
- $html .= eval_MK_FILE($SITEFILE, @F_HEAD);
- $html .= eval_MK_FILE($SOURCEFILE, @F_BODY);
+ $html .= eval_MK_FILE("head", $SITEFILE, @F_HEAD);
+ $html .= eval_MK_FILE("body", $SOURCEFILE, @F_BODY);
$html .= $F_FOOT;
for (source($SITEFILE)) {
/<\/body>/ or next;
- $_ = &eval_MK_LIST($_, @MK_VARS);
+ $_ = &eval_MK_LIST("htmlfile", $_, @MK_VARS);
$html .= $_;
}
- savelist(\@{$INFO{$F}});
- open F, ">$F" or die "could not write $F: $!"; print F $html; close F;
- print "'$SOURCEFILE': ",&ls_s($SOURCEFILE)," -> ",&ls_s($F),"$n";
+ open F, ">$F" or die "could not write $F: $!"; print F $html; close F;
+ echo "'$SOURCEFILE': ",&ls_s($SOURCEFILE)," -> ",&ls_s($F);
savesource("$F.~head~", \@F_HEAD);
savesource("$F.~body~", \@F_BODY);
} else {
- print "'$SOURCEFILE': does not exist$n";
+ echo "'$SOURCEFILE': does not exist";
}} else {
- print "<$F> - skipped$n";
+ echo "<$F> - skipped";
}
}
sub make_printerfriendly # "$F"
{ # PRINTER
my $printsitefile="0"; # FRIENDLY
- my @F_FAST = (); my $BODY_TXT; my $BODY_SED;
+ my $BODY_TXT; my $BODY_SED;
my $P=&html_printerfile ($F);
my @P_HEAD = (); my @P_BODY = ();
if ("$F" =~ /^(${SITEFILE}|${SITEFILE}l)$/) {
- @F_FAST = &make_fast ("$F");
$printsitefile=">=>" ; $BODY_TXT="$F.~foot~" ;
} elsif ("$F" =~ /^(.*[.]html)$/) {
$printsitefile="=>" ; $BODY_TXT="$SOURCEFILE";
}
if (grep {/<meta name="formatter"/} source($BODY_TXT)) { return; }
- if ($printsitefile ne "0" and -f $SOURCEFILE) {
+ if ($printsitefile ne "0" and -f $SOURCEFILE) { my $x;
@MK_FAST = &make_printerfile_fast (\@FILELIST);
push @P_HEAD, @MK_VARS; push @P_HEAD, @MK_TAGS; push @P_HEAD, @MK_FAST;
- @MK_METT = map { my $x = $_; $x =~
+ @MK_METT = map { $x = $_; $x =~
/DC.relation.isFormatOf/ and $x =~ s|content=\"[^\"]*\"|content=\"$F\"| ;
$x } @MK_META;
push @P_HEAD, "/<head>/ and $sed_add join(\"\\n\", \@MK_METT);";
push @P_HEAD, "/<\\/body>/ and next;";
push @P_HEAD, &select_in_printsitefile ("$F");
my $_ext_=&print_extension($printerfriendly);
- push @P_HEAD, map { my $x=$_; $x =~ s/[.]html\"|/$_ext_$&/g; $x} @F_FAST;
# my $line_=&sed_slash_key($printsitefile_img_2);
push @P_HEAD, "/\\|\\|topics:/"
." and s| href=\\\"\\#\\.\\\"| href=\\\"$F\\\"|;";
push @P_HEAD, "/\\|\\|\\|pages:/"
." and s| href=\\\"\\#\\.\\\"| href=\\\"$F\\\"|;";
- push @P_HEAD, @F_FAST;
+ push @P_HEAD, &make_back_path("$F");
push @P_BODY, @MK_VARS; push @P_BODY, @MK_TAGS; push @P_BODY, @MK_FAST;
- push @P_BODY, map { my $x=$_; $x =~ s/[.]html\"|/$_ext_$&/g; $x} @F_FAST;
- push @P_BODY, @F_FAST;
+ push @P_BODY, &make_back_path("$F");
my $html = "";
- $html .= eval_MK_FILE($PRINTSITEFILE, @P_HEAD);
- $html .= eval_MK_FILE($BODY_TXT, @P_BODY);
+ $html .= eval_MK_FILE("p_head", $PRINTSITEFILE, @P_HEAD);
+ $html .= eval_MK_FILE("p_body", $BODY_TXT, @P_BODY);
for (source($PRINTSITEFILE)) {
/<\/body>/ or next;
- $_ = &eval_MK_LIST($_, @MK_VARS);
+ $_ = &eval_MK_LIST("printerfriendly", $_, @MK_VARS);
$html .= $_;
}
open P, ">$P" or die "could not write $P: $!"; print P $html; close P;
- print "'$SOURCEFILE': ",ls_s($SOURCEFILE)," $printsitefile ",ls_s($P),"$n";
+ echo "'$SOURCEFILE': ",ls_s($SOURCEFILE)," $printsitefile ",ls_s($P);
}
}
# #### 0. INIT
$F=$SITEFILE;
&make_sitemap_init();
-&make_sitemap_list();
+&make_sitemap_list($SITEFILE);
&make_sitemap_sect();
&make_sitemap_page();
-savelist(\@MK_INFO);
+savelist(\@MK_DATA, "DATA");
@FILELIST=&echo_site_filelist();
if ($o{filelist} or $o{list} eq "file" or $o{list} eq "files") {
- for (@FILELIST) { print $_,"$n"; } exit; # --filelist
+ for (@FILELIST) { echo $_; } exit; # --filelist
}
if ($o{files}) { @FILELIST=split(/ /, $o{files}); } # --files
-if ($#FILELIST < 0) { print STDERR "nothing to do$n"; }
+if ($#FILELIST < 0) { warns "nothing to do (no --filelist)"; }
if ($#FILELIST == 0 and
- $FILELIST[0] eq $SITEFILE) { print STDERR "only '$SITEFILE'!?$n"; }
+ $FILELIST[0] eq $SITEFILE) { warns "only '$SITEFILE'?!"; }
for (@FILELIST) { #### 1. PASS
$F = $_;
if (/^(name:.*)$/) {
&scan_namespec ("$F");
- } elsif (/^(http:.*|.*:\/\/.*)$/) {
+ } elsif (/^(http:|https:|ftp:|mailto:|telnet:|news:|gopher:|wais:)/) {
&scan_httpspec ("$F");
} elsif (/^(${SITEFILE}|${SITEFILE}l)$/) {
&scan_sitefile ("$F") ;; # ........... SCAN SITE
+ } elsif (/^(.*\@.*\.de)$/) {
+ echo "!! -> '$F' (skipping malformed mailto:-link)";
} elsif (/^(\.\.\/.*)$/) {
- print "!! -> '$F' (skipping topdir build)$n";
+ echo "!! -> '$F' (skipping topdir build)";
# */*.html)
-# make_fast # try for later subdir build
+# make_back_path # try for later subdir build
# echo "!! -> '$F' (skipping subdir build)"
# ;;
# */*/*/|*/*/|*/|*/index.htm|*/index.html)
# echo "!! -> '$F' (skipping subdir index.html)"
# ;;
} elsif (/^(.*\.html)$/) {
- &scan_htmlfile ("$F") ;; # ........... SCAN HTML
+ &scan_htmlfile ("$F"); # ........... SCAN HTML
+ if ($o{xml}) {
+ $F =~ s/\.html$/.xml/;
+ &scan_xmlfile ("$F");
+ }
+ } elsif (/^(.*\.xml)$/) {
+ &scan_xmlfile ("$F") ;;
} elsif (/^(.*\/)$/) {
- print "'$F' : directory - skipped$n";
+ echo "'$F' : directory - skipped";
&site_map_list_title ("$F", &sed_slash_key($F));
&site_map_long_title ("$F", "(directory)");
} else {
- print "?? -> '$F'$n";
+ echo "?? -> '$F'";
}
}
$PRINTSITEFILE=$SITEFILE; $PRINTSITEFILE =~ s/(\.\w*)$/$_ext_$1/;
$F=$PRINTSITEFILE;
my @TEXT = &make_printsitefile();
- print "NOTE: going to create printer-friendly sitefile '$PRINTSITEFILE'"
- ." $F._$i$n";
- savelist(\@TEXT);
+ echo "NOTE: going to create printer-friendly sitefile '$PRINTSITEFILE'"
+ ." $F._$i";
+ savelist(\@TEXT, "TEXT");
my @LINES = map { chomp; $_."$n" } @TEXT;
savesource($PRINTSITEFILE, \@LINES);
if (1) {
}
}
-if ($simplevars eq " ") {
- @MK_OLDS = ();
-}
-
for (@FILELIST) { #### 2. PASS
$F = $_;
if (/^(name:.*)$/) {
&skip_namespec ("$F") ;;
- } elsif (/^(http:.*|.*:\/\/.*)$/) {
+ } elsif (/^(http:|https:|ftp:|mailto:|telnet:|news:|gopher:|wais:)/) {
&skip_httpspec ("$F") ;;
} elsif (/^(${SITEFILE}|${SITEFILE}l)$/) {
&make_sitefile ("$F") ;; # ........ SITE FILE
&make_printerfriendly ("$F") if ($printerfriendly);
+ if ($o{xml}) {
+ $F =~ s/\.html$/.xml/;
+ &make_xmlmaster ("$F");
+ }
+ } elsif (/^(.*\@.*\.de)$/) {
+ echo "!! -> '$F' (skipping malformed mailto:-link)";
} elsif (/^(\.\.\/.*)$/) {
- print "!! -> '$F' (skipping topdir build)$n";
+ echo "!! -> '$F' (skipping topdir build)";
# */*.html)
# echo "!! -> '$F' (skipping subdir build)"
# ;;
# echo "!! -> '$F' (skipping subdir index.html)"
# ;;
} elsif (/^(.*\.html)$/) {
- &make_htmlfile ("$F") ;; # .................. HTML FILES
+ &make_htmlfile ("$F") ; # .................. HTML FILES
&make_printerfriendly ("$F") if ($printerfriendly);
+ if ($o{xml}) {
+ $F =~ s/\.html$/.xml/;
+ &make_xmlfile ("$F");
+ }
+ } elsif (/^(.*\.xml)$/) {
+ &make_xmlfile ("$F") ;;
} elsif (/^(.*\/)$/) {
- print "'$F' : directory - skipped$n";
+ echo "'$F' : directory - skipped";
} else {
- print "?? -> '$F'$n";
+ echo "?? -> '$F'";
}
+
# .............. debug ....................
-## if test -d DEBUG && test -f "./$F" ; then
-## cp ./$F.$INFO DEBUG/$F.info.TMP
-## for P in tags vars meta page date list html sect info ; do
-## test -f ./$MK.$P.tmp && cp ./$MK.$P.tmp DEBUG/$F.$P.tmp
-## test -f ./$MK.$P.TMP && cp ./$MK.$P.TMP DEBUG/$F.$P.TMP
-## done
-## fi
+ if (-d "DEBUG" and -f $F) {
+ my $INP = \@{$DATA{$F}};
+ my $FFFF = $F; $FFFF =~ s,/,:,g;
+ if (open FFFF, ">DEBUG/$FFFF.data.tmp.ht") {
+ for (@{$INP}) { print FFFF $_,$n; } close FFFF;
+ }
+ if (open FFFF, ">DEBUG/$FFFF.tags.tmp.pl") {
+ print FFFF "# /usr/bin/env perl -p",$n;
+ for (@MK_TAGS) { print FFFF $_,$n; } close FFFF;
+ }
+ if (open FFFF, ">DEBUG/$FFFF.vars.tmp.pl") {
+ print FFFF "# /usr/bin/env perl -p",$n;
+ for (@MK_VARS) { print FFFF $_,$n; } close FFFF;
+ }
+ if (open FFFF, ">DEBUG/$FFFF.span.tmp.pl") {
+ print FFFF "# /usr/bin/env perl -p",$n;
+ for (@MK_SPAN) { print FFFF $_,$n; } close FFFF;
+ }
+ if (open FFFF, ">DEBUG/$FFFF.meta.tmp.ht") {
+ for (@MK_META) { print FFFF $_,$n; } close FFFF;
+ }
+ if (open FFFF, ">DEBUG/$FFFF.gets.tmp.ht") {
+ for (@MK_GETS) { print FFFF $_,$n; } close FFFF;
+ }
+ if (open FFFF, ">DEBUG/$FFFF.puts.tmp.ht") {
+ for (@MK_PUTS) { print FFFF $_,$n; } close FFFF;
+ }
+ if (open FFFF, ">DEBUG/$FFFF.fast.tmp.ht") {
+ for (@MK_FAST) { print FFFF $_,$n; } close FFFF;
+ }
+ }
} # done
-if ( $simplevars eq "warn") {
- my $oldvars = $#MK_OLDS; $oldvars ++;
- if (not $oldvars) {
-print "HINT: you have no simplevars in your htm sources, so you may want to$n";
-print "hint: set the magic <!--mksite:nosimplevars--> in your $SITEFILE$n";
-print "hint: which makes execution _faster_ actually in the 2. pass$n";
-print "note: simplevars expansion was the oldstyle way of variable expansion$n";
-} else {
-print "HINT: there were $oldvars simplevars found in your htm sources.$n";
-print "hint: This style of variable expansion will be disabled in the near$n";
-print "hint: future. If you do not want change then add the $SITEFILE magic$n";
-print "hint: <!--mksite:simplevars--> somewhere to suppress this warning$n";
-print "note: simplevars expansion will be an explicit option in the future.$n";
-print "note: errornous simplevar detection can be suppressed with a magic$n";
-print "note: hint of <!--mksite:nosimplevars--> in the $SITEFILE for now.$n";
-} }
-
-## rm ./$MK.*.tmp
+## rm ./$MK.*.tmp.* if not $o{keeptmpfiles}
exit 0
# 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.
# 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
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
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"
-*=*)
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="" ;;
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"
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
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"
# ========================================================================
# ========================================================================
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"
"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
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
# ==========================================================================
# 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
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"
-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
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="\\\\([^{<>}]*\\\\)"
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:
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"` ;;
dx_line ()
{
- echo "$1$2 "`trimmm "$3"` >> "$tmp/$F.$INFO"
+ echo "<$Q$1>$2 "`trimmm "$3"`"<$QX>" >> "$tmp/$F.$DATA"
}
DX_line ()
dx_text ()
{
- dx_line "=text=" "$1" "$2"
+ dx_line "'text'" "$1" "$2"
}
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
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"
}
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
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"`
{
# 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/[)].*//'`
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 ?)
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 ?)
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
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>|" \
-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
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"
*) 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 ()
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
{
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"
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
# 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[;]"
# 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"
}
# ==========================================================================
scan_sitefile () # $F
{
SOURCEFILE=`html_sourcefile "$F"`
+ $hint "'$SOURCEFILE': scanning -> sitefile"
if test "$SOURCEFILE" != "$F" ; then
dx_init "$F"
dx_text today "`timetoday`"
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`"
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"
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
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 ()
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 |" # $++
}
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 |" # $++
}
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 |" # $++
}
# 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"
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"
{ # 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"
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~
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)"
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)"
;;
# 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'"
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
>> r"\1<link>\2</link>"
& Match(r"(?m)(^|\s)\=\>\'([^\']*)\'")
>> r"\1<link>\2</link>"
- & Match(r"(?m)(^|\s)\=\>\s(\w[\w.]*\w\([^\(\)]*\))")
+ & Match(r"(?m)(^|\s)\=\>\s(\w[\w.]*\w\(\d+\))")
>> r"\1<link>\2</link>"
- & Match(r"(?m)(^|\s)\=\>\s(\w[\w.]*\w)\b")
- >> r"\1<link>\2</link>"
- & Match(r"(?m)(^|\s)\=\>\s([^\s\,\.\!\?\:\;\<\>\&\'\=\-]+)")
+ & Match(r"(?m)(^|\s)\=\>\s([^\s\,\.\!\?]+)")
>> r"\1<link>\2</link>")
class CommentMarkup:
if mode: text += "</"+mode+">"
mode = "ul" ; text += "<"+mode+">"
line = check.group(1)
- text += "<li> "+self.markup_para_line(line)+" </li>\n"
+ text += "<li><p> "+self.markup_para_line(line)+" </p></li>\n"
elif line & check(r"^\s?\s?\s?[*](.*)"):
if mode != "para":
if mode: text += "</"+mode+">"
& Match(r"(<para>)(\s*[R]eturns)") >>r"\1This function\2"
& Match(r"(?s)<para>\s*</para><para>") >> "<para>"
& Match(r"(?s)<screen>\s*</screen>") >> "")
+ return True
def markup_screen_line(self, line):
return self.markup_line(line.replace("&","&")
.replace("<","<")
--- /dev/null
+#! /usr/bin/env python
+# -*- coding: UTF-8 -*-
+from match import Match
+
+class DocbookDocument:
+ """ binds some xml content page with additional markup - in this
+ variant we set the rootnode container to 'reference' and the DTD
+ to the Docbook 4.1.2 version. Modify as you like."""
+ has_title_child = [ "book", "chapter", "section", "reference" ]
+ docbook_dtd = (
+ ' PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"'+"\n"+
+ ' "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"')
+ def __init__(self, o, filename = None):
+ self.o = o
+ self.rootnode = "reference"
+ self.filename = filename
+ self.title = ""
+ self.text = []
+ def add(self, text):
+ """ add some content """
+ self.text += [ text ]
+ return self
+ def get_title(self):
+ if self.title: return title
+ try: return self.text[0].get_title()
+ except Exception, e: pass
+ return self.title
+ def _xml_doctype(self, rootnode):
+ return "<!DOCTYPE "+rootnode+self.docbook_dtd+">"
+ def _xml_text(self, xml):
+ """ accepts adapter objects with .xml_text() """
+ try: return xml.xml_text()
+ except Exception, e: print "DocbookDocument/text", e; pass
+ return str(xml)
+ def _fetch_rootnode(self, text):
+ fetch = Match(r"^[^<>]*<(\w+)\b")
+ if text & fetch: return fetch[1]
+ return self.rootnode
+ def _filename(self, filename):
+ if filename is not None:
+ self.filename = filename
+ filename = self.filename
+ if not filename & Match(r"\.\w+$"):
+ ext = self.o.docbook
+ if not ext: ext = "docbook"
+ filename += "."+ext
+ return filename
+ def save(self, filename = None):
+ filename = self._filename(filename)
+ print "writing '"+filename+"'"
+ if len(self.text) > 1:
+ self.save_all(filename)
+ else:
+ self.save_text(filename, self.text[0])
+ def save_text(self, filename, text):
+ try:
+ fd = open(filename, "w")
+ xml_text = self._xml_text(text)
+ rootnode = self._fetch_rootnode(xml_text)
+ doctype = self._xml_doctype(rootnode)
+ print >>fd, doctype
+ print >>fd, xml_text
+ fd.close()
+ return True
+ except IOError, e:
+ print "could not open '"+filename+"'file", e
+ return False
+ def save_all(self, filename):
+ assert len(self.text) > 1
+ try:
+ fd = open(filename, "w")
+ xml_text = self._xml_text(self.text[0])
+ rootnode = self._fetch_rootnode(xml_text)
+ if rootnode == self.rootnode:
+ rootnode = "book"
+ else:
+ rootnode = self.rootnode
+ doctype = self._xml_doctype(rootnode)
+ print >>fd, doctype
+ title = self.get_title()
+ if title and self.rootnode in self.has_title_child:
+ print >>fd, "<"+self.rootnode+'><title>'+title+'</title>'
+ elif title:
+ print >>fd, "<"+self.rootnode+' id="'+title+'">'
+ else:
+ print >>fd, "<"+self.rootnode+'>'
+ for text in self.text:
+ text = self._xml_text(text)
+ print >>fd, text
+ print >>fd, "</"+self.rootnode+">"
+ fd.close()
+ return True
+ except IOError, e:
+ print "could not open '"+filename+"'file", e
+ return False
self.titleline = line[:x]
for also in line[x+5:].split(","):
self.alsolist += [ also.strip() ]
- print "[[[", self.alsolist, "}}}", self.titleline
self._alsolist = self.alsolist
return True
def get_alsolist(self):
self.anchors = []
self.o = o
if self.o is None: self.o = Options()
+ self.not_found_in_anchors = []
def cut(self):
self.text += ("<dt>"+self._ul_start+self.head+self._ul_end+"</dt>"+
"<dd>"+self._ul_start+self.body+self._ul_end+"</dd>")
name = entry.get_name()
head_text = entry.head_xml_text()
body_text = entry.body_xml_text(name)
- assert head_text
+ if not head_text:
+ print "no head_text for", name
+ return
try:
prespec = entry.head_get_prespec()
namespec = entry.head_get_namespec()
title = entry.get_title()
filename = entry.get_filename().replace("../","")
if title:
- extraline = (self._null_table100+'<td>'+
- ' <em>'+title+'</em>'+
- ' </td><td align="right"> '+
+ subtitle = ' <em>'+title+'</em>'
+ extraline = (self._null_table100+'<td> '+subtitle+' </td>'+
+ '<td align="right"> '+
'<em><small>'+filename+'</small></em>'+
'</td></table>')
body_text = extraline + body_text
self.toc += self._li_start+self.sane(link(head_text))+self._li_end
self.head += self._li_start+self.sane(here(head_text))+self._li_end
self.body += self._li_start+self.sane(body_text)+self._li_end
+ def get_title(self):
+ return self.o.package+" Library Functions"
def xml_text(self):
self.cut()
- title=self.o.package+" Library Functions"
- return ("<html><title>"+title+"</title><body>"
- "<h2>"+title+"</h2>"+
+ return ("<h2>"+self.get_title()+"</h2>"+
self.version_line()+
self.mainheader_line()+
self._ul_start+
self.resolve_links(self.toc)+
self._ul_end+
- "<h3>Documentation</h3><dl>"+self.resolve_links(self.text)+
- "</dl></html>")
+ "<h3>Documentation</h3>"+
+ "<dl>"+
+ self.resolve_links(self.text)+
+ "</dl>")
def version_line(self):
if self.o.version:
return "<p>Version "+self.o.version+"</p>"
>> (lambda x: self.resolve_external(x.group(1), x.group(2))))
text &= (Match("(?s)<link>(\w+)</link>")
>> (lambda x: self.resolve_internal(x.group(1))))
+ if len(self.not_found_in_anchors):
+ print "not found in anchors: ", self.not_found_in_anchors
return (text & Match("(?s)<link>([^<>]*)</link>")
>> "<code>\\1</code>")
def resolve_external(self, func, sect):
def resolve_internal(self, func):
if func in self.anchors:
return '<code><a href="#'+func+'">'+func+"</a></code>"
- print "not in anchors '"+func+"'"
+ if func not in self.not_found_in_anchors:
+ self.not_found_in_anchors += [ func ]
return "<code><u>"+func+"</u></code>"
def sane(self, text):
return (text
+#! /usr/bin/env python
+# -*- coding: UTF-8 -*-
from match import Match
from htm2dbk import *
-def _to_word(text):
- return text & Match("[^\w]+") >> "_"
-
class FunctionListReference:
""" Creating a docbook-style <reference> list of <refentry> parts
that will each be translated into a unix manual page in a second step """
- doctype = (
- '<!DOCTYPE reference PUBLIC "-//OASIS//DTD'+
- ' DocBook XML V4.1.2//EN"'+"\n"+
- ' "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">'+
- "\n")
def __init__(self, o = None):
self.o = o
self.pages = []
self.entry = None
- self.overview = None
def cut(self):
if not self.entry: return
self.pages += [ self.entry ]
self.entry = None
def add(self, entry):
+ name = entry.get_name()
+ description = entry.body_xml_text(name)
+ funcsynopsis = entry.head_xml_text()
+ if not funcsynopsis:
+ print "no funcsynopsis for", name
+ return
if self.entry is None:
self.entry = FunctionListRefEntry(entry, self.o)
self.entry.funcsynopsisinfo = entry.get_mainheader()
self.entry.refpurpose = entry.get_title()
self.entry.refentrytitle = entry.get_name()
# self.entry.refname = entry.get_name()
- name = entry.get_name()
- description = entry.body_xml_text(name)
- funcsynopsis = entry.head_xml_text()
self.entry.funcsynopsis_list += [ funcsynopsis ]
self.entry.description_list += [ description ]
self.entry.refname_list += [ name ]
for item in entry.list_seealso():
if item not in self.entry.seealso_list:
self.entry.seealso_list += [ item ]
- def add_overview(self, entry):
- if self.overview is None:
- title = entry.get_mainheader() & Match(".*<(.*)>.*") >> "\\1"
- self.overview = FunctionListRefEntry(entry, self.o)
- self.overview.funcsynopsisinfo = entry.get_mainheader()
- self.overview.refpurpose = self.o.package.strip()
- self.overview.refentrytitle = title
- self.overview.refname = _to_word(title)
- description = entry.get_title().strip() & Match("^[.]+") >> ""
- funcsynopsis = entry.head_xml_text()
- self.overview.funcsynopsis_list += [ funcsynopsis ]
- if description:
- self.overview.description_list += [
- "<para> - "+ description +"</para>" ]
+ def get_title(self):
+ return self.o.package+" Function List"
def xml_text(self):
- T = self.doctype
- T += "<reference><title>"+self.o.package+" Function List</title>\n"
+ T = "<reference><title>"+self.get_title()+"</title>\n"
for item in self.pages:
- T += self.sane(item.refentry_text())
- T += self.sane(self.overview.refentry_text())
+ text = item.refentry_text()
+ if not text: "OOPS, no text for", item.name ; continue
+ T += self.sane(text)
T += "</reference>\n"
return T
def sane(self, text):
- return (html2docbook(text).replace("->","->")
+ return (html2docbook(text)
.replace("<link>","<function>")
.replace("</link>","</function>")
.replace("<fu:protospec>","<funcprototype>")
.replace("<fu:namespec>","")
.replace("</fu:namespec>","</funcdef>")
.replace("</fu:callspec>","</paramdef>")
- .replace("<fu:callspec>","<paramdef>")) & (
- Match("<listitem>((?:.(?!(<para|</listitem)))*).</listitem>")
- >> "<listitem><para>\\1</para></listitem>")
+ .replace("<fu:callspec>","<paramdef>"))
class FunctionListRefEntry:
self.name = func.get_name()
self.refhint = "\n<!--========= "+self.name+" (3) ============-->\n"
self.refentry = None
- self.refentry_date = o.version.strip() # //refentryinfo/date
- self.refentry_productname = o.package.strip() # //refentryinfo/prod*
- self.refentry_title = None # //refentryinfo/title
- self.refentryinfo = None # override
+ self.refentry_date = o.version.strip() #! //refentryinfo/date
+ self.refentry_productname = o.package.strip() #! //refentryinfo/prod*
+ self.refentry_title = None #! //refentryinfo/title
+ self.refentryinfo = None #! override
self.manvolnum = "3" # //refmeta/manvolnum
self.refentrytitle = None # //refmeta/refentrytitle
self.refmeta = None # override
if not self._assert_parsed(): return None
return self.name
def xml_text(self):
+ if not self.namespec: return self.namespec
return ("<fu:protospec><fu:prespec>"+self.prespec+"</fu:prespec>"+
"<fu:namespec>"+self.namespec+"</fu:namespec>"+
"<fu:callspec>"+self.callspec+"</fu:callspec></fu:protospec>")
m()(r"<link>") >> "<function>",
m()(r"</link>") >> "</function>",
m()(r"(?s)\s*</screen>") >> "</screen>",
- # m()(r"<ul>") >> "</para><itemizedlist>",
- # m()(r"</ul>") >> "</itemizedlist><para>",
- # m()(r"<li>") >> "<listitem><para>",
- # m()(r"</li>") >> "</para></listitem>\n",
- m()(r"<ul>") >> "</para><programlisting>\n",
- m()(r"</ul>") >> "</programlisting><para>",
- m()(r"<li>") >> "",
- m()(r"</li>") >> ""
+ # m()(r"<ul>") >> "</para><programlisting>\n",
+ # m()(r"</ul>") >> "</programlisting><para>",
+ m()(r"<ul>") >> "<itemizedlist>",
+ m()(r"</ul>") >> "</itemizedlist>",
+ # m()(r"<li>") >> "",
+ # m()(r"</li>") >> ""
+ m()(r"<li>") >> "<listitem><para>",
+ m()(r"</li>") >> "</para></listitem>\n",
]
class htm2dbk_conversion(htm2dbk_conversion_base):
def __init__(self):
--- /dev/null
+#! /usr/bin/env python
+# -*- coding: UTF-8 -*-
+from match import Match
+
+class HtmlDocument:
+ """ binds some html content page with additional markup - in this
+ base version it is just the header information while other variants
+ might add navigation items around the content block elements """
+ def __init__(self, o, filename = None):
+ self.o = o
+ self.filename = filename
+ self.title = ""
+ self.meta = []
+ self.style = []
+ self.text = []
+ self.navi = None
+ def meta(self, style):
+ """ add some header meta entry """
+ self.meta += [ meta ]
+ return self
+ def style(self, style):
+ """ add a style block """
+ self.style += [ style ]
+ return self
+ def add(self, text):
+ """ add some content """
+ self.text += [ text ]
+ return self
+ def get_title(self):
+ if self.title: return self.title
+ try: return self.text[0].get_title()
+ except Exception, e: pass
+ return self.title
+ def _html_meta(self, meta):
+ """ accepts adapter objects with .html_meta() """
+ try: return meta.html_meta()
+ except Exception, e: pass
+ return str(meta)
+ def _html_style(self, style):
+ """ accepts adapter objects with .html_style() and .xml_style() """
+ ee = None
+ try: return style.html_style()
+ except Exception, e: ee = e; pass
+ try: return style.xml_style()
+ except Exception, e: print "HtmlDocument/style", ee, e; pass
+ try: return str(style)
+ except Exception, e: print "HtmlDocument/style", e; return ""
+ def _html_text(self, html):
+ """ accepts adapter objects with .html_text() and .xml_text() """
+ ee = None
+ try: return html.html_text()
+ except Exception, e: ee = e; pass
+ try: return html.xml_text()
+ except Exception, e: print "HtmlDocument/text", ee, e; pass
+ try: return str(html)
+ except Exception, e: print "HtmlDocument/text", e; return " "
+ def navigation(self):
+ if self.navi:
+ return self.navi
+ if self.o.body:
+ try:
+ fd = open(self.o.body, "r")
+ self.navi = fd.read()
+ fd.close()
+ return self.navi
+ except Exception, e:
+ pass
+ return None
+ def html_header(self):
+ navi = self.navigation()
+ if not navi:
+ T = "<html><head>"
+ title = self.get_title()
+ if title:
+ T += "<title>"+title+"</title>"
+ T += "\n"
+ for style in self.style:
+ T += self._html_style(style)
+ T += "\n"
+ return T+"</head><body>"
+ else:
+ title = self.get_title()
+ return navi & (
+ Match(r"<!--title-->") >> " - "+title) & (
+ Match(r"<!--VERSION-->") >> self.o.version) & (
+ Match(r"(?m).*</body></html>") >> "")
+ def html_footer(self):
+ navi = self.navigation()
+ if not navi:
+ return "</body></html>"
+ else:
+ return navi & (
+ Match(r"(?m)(.*</body></html>)") >> "%&%&%&%\\1") & (
+ Match(r"(?s).*%&%&%&%") >> "")
+ def _filename(self, filename):
+ if filename is not None:
+ self.filename = filename
+ filename = self.filename
+ if not filename & Match(r"\.\w+$"):
+ ext = self.o.html
+ if not ext: ext = "html"
+ filename += "."+ext
+ return filename
+ def save(self, filename = None):
+ filename = self._filename(filename)
+ print "writing '"+filename+"'"
+ try:
+ fd = open(filename, "w")
+ print >>fd, self.html_header()
+ for text in self.text:
+ print >>fd, self._html_text(text)
+ print >>fd, self.html_footer()
+ fd.close()
+ return True
+ except IOError, e:
+ print "could not open '"+filename+"'file", e
+ return False
--- /dev/null
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
+ "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
+<!-- using <chapter> allows to append a <reference> with manpages -->
+<book><title> ZZIPlib Manual Pages </title>
+
+<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="xml"
+ href="zziplib.xml" />
+<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="xml"
+ href="zzipmmapped.xml" />
+<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="xml"
+ href="zzipfseeko.xml" />
+</book>
* There was a possibility to transfer zziplib-specific openmodes
* through o_flags but you should please not use them anymore and
* look into => zzip_open_ext_io to submit them down. This function
- * is shallow in that it just extracts the zzipflags and calls <ul><li><p>
- * <code>zzip_open_ext_io(filename, o_flags, zzipflags|0664, 0, 0) </code>
- * </p></li></ul> you must stop using this extra functionality (not well
- * known anyway) since zzip_open might be later usable to open files
- * for writing in which case the _EXTRAFLAGS will get in conflict.
+ * is shallow in that it just extracts the zzipflags and calls
+ * * <code>zzip_open_ext_io(filename, o_flags, zzipflags|0664, 0, 0) </code>
+ * you must stop using this extra functionality (not well known anyway)
+ * since zzip_open might be later usable to open files for writing
+ * in which case the _EXTRAFLAGS will get in conflict.
*
* compare with => open(2) and => zzip_fopen
*/
Summary: ZZipLib - libZ-based ZIP-access Library
Name: zziplib
Version: 0.13.48
-Release: 1.suse100
-Serial: 1
-Copyright: LGPL
+Release: 1
+License: LGPL
Group: Development/Libraries
URL: http://zziplib.sf.net
Vendor: Guido Draheim <guidod@gmx.de>
# fixing relink problems during install too
LDFLAGS="-L%buildroot%_libdir" \
CFLAGS="$RPM_OPT_FLAGS" \
-sh configure --prefix=%{_prefix} --enable-sdl --disable-builddir \
- --with-docdir=%{_docdir} --mandir=%{_mandir} TIMEOUT=9
-cp -a zzip zzip64
+sh configure --prefix=%{_prefix} --with-docdir=%{_docdir} --mandir=%{_mandir} \
+ --enable-sdl TIMEOUT=9
+make zzip64-setup
%build
-%define _FILE_OFFSET64 -D_ZZIP_LARGEFILE -D_FILE_OFFSET_BITS=64
-%define _RELEASEINFO64 "RELEASE_INFO=-release 0-64"
-%define _CFLAGS_OFFSET64 "AM_CFLAGS=%_FILE_OFFSET64"
-make
-(cd zzip64 && make %_CFLAGS_OFFSET64 %_RELEASEINFO64)
+make
+make zzip64-build
make doc
%install
rm -rf %{buildroot}
-(cd zzip64 && make install %_RELEASEINFO64 DESTDIR=%{buildroot})
-(cd %buildroot/%_libdir && mv libzzip.so libzzip64.so)
-(cd %buildroot/%_libdir && mv libzzip.a libzzip64.a)
-(cd %buildroot/%_libdir && \
-sed -e 's/zzip.so/zzip64.so/' -e 's/zzip.a/zzip64.a/' libzzip.la >libzzip64.la)
-(cd %buildroot/%_libdir/pkgconfig && \
-sed -e 's/largefile=/largefile= %_FILE_OFFSET64/' \
- -e 's/-lzzip/-lzzip64/' -e 's/zziplib/zziplib64/' zziplib.pc >zziplib64.pc)
-
+make zzip64-install DESTDIR=%{buildroot}
make install DESTDIR=%{buildroot}
-(cd %buildroot/%_libdir && mv libzzip.so libzzip32.so)
-(cd %buildroot/%_libdir && mv libzzip.a libzzip32.a)
-(cd %buildroot/%_libdir && ln -s libzzip32.so libzzip.so)
-(cd %buildroot/%_libdir && ln -s libzzip32.a libzzip.a)
-(cd %buildroot/%_libdir && \
-sed -e 's/zzip.so/zzip32.so/' -e 's/zzip.a/zzip32.a/' libzzip.la >libzzip32.la)
-(cd %buildroot/%_libdir/pkgconfig && \
-sed -e 's/-lzzip/-lzzip32/' -e 's/zziplib/zziplib32/' zziplib.pc >zziplib32.pc)
-
-# the 12.8x and 11.8x and 10.8x packages are all the same actually
-(cd %buildroot/%_libdir && \
-(for i in libzzip*.so.1? ; do : \
-; v10=`echo $i | sed -e "s/.so.../.so.10/"` \
-; v11=`echo $i | sed -e "s/.so.../.so.11/"` \
-; v12=`echo $i | sed -e "s/.so.../.so.12/"` \
-; test ! -e $v10 && test -e $v12 && ln -s $v12 $v10 \
-; test ! -e $v12 && test -e $v10 && ln -s $v10 $v12 \
-; ln -s $v10 $v11 || true; done))
-
+make zzip32-postinstall DESTDIR=%{buildroot}
+make zzip-postinstall
make install-doc DESTDIR=%{buildroot}
-make install-man3 DESTDIR=%{buildroot}
-
-%post -p /sbin/ldconfig
-%postun -p /sbin/ldconfig
+make install-mans DESTDIR=%{buildroot}
%clean
rm -rf %{buildroot}
%defattr(-,root,root)
%{_libdir}/lib*.so.*
+%post %lib
+/sbin/ldconfig || true
+%postun %lib
+/sbin/ldconfig || true
+
%files doc
%defattr(-,root,root)
- %{_datadir}/groups/*
+ %{_datadir}/doc/*
%dir %{_datadir}/omf/%{name}
%{_datadir}/omf/%{name}/*
%post doc