Daniel Leidert <[EMAIL PROTECTED]> wrote: <snip/> > @Andreas: I spoke with the new author and support for dblatex can be > added upstream. The author just delayed it until 0.0.20 has been > released (which I currently package). For the case you want to help to > create a patch: The support for dblatex should be an option, not a > replacement for docbook-xsl/passivetex nor docbook-xsl/fop. > > Please don't hesitate to contact me, if you have questions, suggestions > or patches :) <snip/>
Attached is a patch based on the 0.0.20 upstream release that adds the dblatex backend for pdf, ps and dvi output. I have implemented it analogous to the fop backend, thus it should do no harm to xmlto's architecture. Some remarks: - The dblatex section in the pdf, ps and dvi format files is identical, one could refactor it into a common location. - The used dblatex options "-P doc.collab.show=0 -P latex.output.revhistory=0" prevent insertion of a page with empty collaboration and revision history tables, which IMHO is a reasonable default. If one provides the needed data for filling these tables in the source document (e.g. compare the sources of the dblatex user manual), one would override the internal xmlto options by passing the argument string "-p '-P doc.collab.show=1 -P latex.output.revhistory=1'" to xmlto. - An idea (not implemented) I would like to discuss: Most users won't have installed all backends, I'd even guess that the majority will have installed only one backend. In these cases it's a lack of comfort needing to choose the backend explicitly. And xmlto is a comfort frontend for the underlying tools, isn't it? Thus I could imagine a mechanism that in absence of an explicit backend argument: - Determines for the specified input/output pair what backends are able to produce it (e.g. dblatex does not support XSL-FO as input format). - From these backends determines the installed ones. - From these backends chooses the first regarding to a hierarchy, e.g.: 1) passivetex 2) fop 3) dblatex What do you think? It should be quite easy to implement this.
diff -u -r xmlto-0.0.20/format/docbook/dvi dblatex_support/format/docbook/dvi --- xmlto-0.0.20/format/docbook/dvi 2002-08-02 15:35:26.000000000 +0200 +++ dblatex_support/format/docbook/dvi 2008-01-19 17:20:06.000000000 +0100 @@ -1,13 +1,38 @@ -case "$1" in -stylesheet) - if [ "$VERBOSE" -ge 1 ] - then - echo >&2 "Convert to XSL-FO" - fi - echo "http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl" +case "$USE_BACKEND" in +DEFAULT) + case "$1" in + stylesheet) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to XSL-FO" + fi + echo "http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl" + ;; + post-process) + # Get the FO format script to do the rest + sh "$(dirname "$0")/../fo/$(basename "$0")" "$1" + ;; + esac ;; -post-process) - # Get the FO format script to do the rest - sh "$(dirname "$0")/../fo/$(basename "$0")" "$1" +DBLATEX) + if [ ! -x "$DBLATEX_PATH" ]; then + echo >&2 "Installed DBLATEX is needed for this format. Executable dblatex was not found" + echo >&2 "on expected location ${DBLATEX_PATH}." + echo >&2 "Please install dblatex package or change default DBLATEX_PATH in xmlto script." + exit 1 + fi + EXT=$(basename $0) + case "$1" in + stylesheet) + ;; + post-process) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to ${EXT}" + POSTARGS="${POSTARGS} --verbose" + fi + "$DBLATEX_PATH" ${POSTARGS} -P doc.collab.show=0 -P latex.output.revhistory=0 "${XSLT_PROCESSED}" --"${EXT}" --output="$OUTPUT_DIR/$(basename ${XSLT_PROCESSED%.*}).${EXT}" + ;; + esac ;; esac diff -u -r xmlto-0.0.20/format/docbook/pdf dblatex_support/format/docbook/pdf --- xmlto-0.0.20/format/docbook/pdf 2007-11-05 16:21:45.000000000 +0100 +++ dblatex_support/format/docbook/pdf 2008-01-19 17:18:34.000000000 +0100 @@ -1,18 +1,43 @@ -case "$1" in -stylesheet) - if [ "$VERBOSE" -ge 1 ] - then - echo >&2 "Convert to XSL-FO" - fi - echo "http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl" +case "$USE_BACKEND" in +DEFAULT) + case "$1" in + stylesheet) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to XSL-FO" + fi + echo "http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl" + ;; + post-process) + EXT=$(basename $0) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to ${EXT}" + fi + # Get the FO format script to do the rest + sh "$(dirname "$0")/../fo/${EXT}" "$1" + ;; + esac ;; -post-process) - EXT=$(basename $0) - if [ "$VERBOSE" -ge 1 ] - then - echo >&2 "Convert to ${EXT}" +DBLATEX) + if [ ! -x "$DBLATEX_PATH" ]; then + echo >&2 "Installed DBLATEX is needed for this format. Executable dblatex was not found" + echo >&2 "on expected location ${DBLATEX_PATH}." + echo >&2 "Please install dblatex package or change default DBLATEX_PATH in xmlto script." + exit 1 fi - # Get the FO format script to do the rest - sh "$(dirname "$0")/../fo/${EXT}" "$1" + EXT=$(basename $0) + case "$1" in + stylesheet) + ;; + post-process) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to ${EXT}" + POSTARGS="${POSTARGS} --verbose" + fi + "$DBLATEX_PATH" ${POSTARGS} -P doc.collab.show=0 -P latex.output.revhistory=0 "${XSLT_PROCESSED}" --"${EXT}" --output="$OUTPUT_DIR/$(basename ${XSLT_PROCESSED%.*}).${EXT}" + ;; + esac ;; esac diff -u -r xmlto-0.0.20/format/docbook/ps dblatex_support/format/docbook/ps --- xmlto-0.0.20/format/docbook/ps 2007-11-05 16:21:58.000000000 +0100 +++ dblatex_support/format/docbook/ps 2008-01-19 17:19:48.000000000 +0100 @@ -1,18 +1,43 @@ -case "$1" in -stylesheet) - if [ "$VERBOSE" -ge 1 ] - then - echo >&2 "Convert to XSL-FO" - fi - echo "http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl" +case "$USE_BACKEND" in +DEFAULT) + case "$1" in + stylesheet) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to XSL-FO" + fi + echo "http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl" + ;; + post-process) + EXT=$(basename $0) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to ${EXT}" + fi + # Get the FO format script to do the rest + sh "$(dirname "$0")/../fo/${EXT}" "$1" + ;; + esac ;; -post-process) - EXT=$(basename $0) - if [ "$VERBOSE" -ge 1 ] - then - echo >&2 "Convert to ${EXT}" +DBLATEX) + if [ ! -x "$DBLATEX_PATH" ]; then + echo >&2 "Installed DBLATEX is needed for this format. Executable dblatex was not found" + echo >&2 "on expected location ${DBLATEX_PATH}." + echo >&2 "Please install dblatex package or change default DBLATEX_PATH in xmlto script." + exit 1 fi - # Get the FO format script to do the rest - sh "$(dirname "$0")/../fo/${EXT}" "$1" + EXT=$(basename $0) + case "$1" in + stylesheet) + ;; + post-process) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to ${EXT}" + POSTARGS="${POSTARGS} --verbose" + fi + "$DBLATEX_PATH" ${POSTARGS} -P doc.collab.show=0 -P latex.output.revhistory=0 "${XSLT_PROCESSED}" --"${EXT}" --output="$OUTPUT_DIR/$(basename ${XSLT_PROCESSED%.*}).${EXT}" + ;; + esac ;; esac diff -u -r xmlto-0.0.20/xmlto.in dblatex_support/xmlto.in --- xmlto-0.0.20/xmlto.in 2008-01-17 10:39:02.000000000 +0100 +++ dblatex_support/xmlto.in 2008-01-19 17:14:22.000000000 +0100 @@ -47,6 +47,8 @@ --noclean temp files are not deleted(good for diagnostics) --with-fop use fop for formatting(default is passivetex, installation doesn't check for fop availability!) + --with-dblatex use dblatex for formatting(default is passivetex, + installation doesn't check for dblatex availability!) Available FORMATs depend on the type of the XML file (which is determined automatically). @@ -160,15 +162,18 @@ SKIP_VALIDATION=0 EXTENSIONS=0 -#actual possibilities DEFAULT(XSL-FO/passivetex) and FOP +#actual possibilities: DEFAULT(XSL-FO/passivetex), FOP and dblatex USE_BACKEND="DEFAULT" #modify FOP_PATH manually if you have fop in different location FOP_PATH="/usr/bin/fop" +#modify DBLATEX_PATH manually if you have dblatex in different location +DBLATEX_PATH="/usr/bin/dblatex" + # Process any options ARGS=$(${GETOPT} \ - --longoptions=help,version,extensions,searchpath:,skip-validation,stringparam:,noclean,with-fop \ + --longoptions=help,version,extensions,searchpath:,skip-validation,stringparam:,noclean,with-fop,with-dblatex \ -n xmlto -- x:m:o:p:v "$@") [ $? != 0 ] && { usage; exit 1; } eval set -- "$ARGS" @@ -254,6 +259,11 @@ USE_BACKEND="FOP" shift ;; + --with-dblatex) + ##use dblatex instead of passivetex where possible + USE_BACKEND="DBLATEX" + shift + ;; --) shift break @@ -268,6 +278,8 @@ FOP) #maybe fop1.extensions for latest fop, but keeping this one XSLTOPTS="$XSLTOPTS --param fop.extensions '1'" ;; + DBLATEX) + ;; DEFAULT) XSLTOPTS="$XSLTOPTS --param passivetex.extensions '1'" ;; esac @@ -443,6 +455,7 @@ export INPUT_FILE export SEARCHPATH export FOP_PATH +export DBLATEX_PATH export USE_BACKEND if [ "$VERBOSE" -gt 2 ] then
Regards, Andreas -- Andreas Hoenen <[EMAIL PROTECTED]> GPG: 1024D/B888D2CE A4A6 E8B5 593A E89B 496B 82F0 728D 8B7E B888 D2CE
pgpCa3ndMfKQ9.pgp
Description: PGP signature