diff options
Diffstat (limited to 'format')
34 files changed, 886 insertions, 0 deletions
diff --git a/format/docbook/awt b/format/docbook/awt new file mode 100755 index 0000000..bb54946 --- /dev/null +++ b/format/docbook/awt @@ -0,0 +1,18 @@ +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 diff --git a/format/docbook/dvi b/format/docbook/dvi new file mode 100755 index 0000000..a48be6b --- /dev/null +++ b/format/docbook/dvi @@ -0,0 +1,32 @@ +case "$USE_BACKEND" in +DEFAULT|FOP) + 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 + ;; +DBLATEX) + 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 --git a/format/docbook/epub b/format/docbook/epub new file mode 100755 index 0000000..1c854fa --- /dev/null +++ b/format/docbook/epub @@ -0,0 +1,28 @@ +if [ -z "`type -t $ZIP_PATH`" ] +then + echo >&2 "Missing zip utility at $ZIP_PATH, conversion to epub not possible." + echo >&2 "Exiting !" + exit 3 +fi + +case "$1" in + stylesheet) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Converting Docbook to epub" + fi + echo "http://docbook.sourceforge.net/release/xsl/current/epub/docbook.xsl" + ;; + post-process) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Creating epub file" + fi + echo "application/epub+zip" > mimetype + EPUB_NAME=$(basename "${XSLT_PROCESSED%.*}").epub + [ -e "$XSLT_PROCESSED" ] && rm "$XSLT_PROCESSED" + ${ZIP_PATH} -0Xq $EPUB_NAME mimetype + ${ZIP_PATH} -Xr9D $EPUB_NAME * + ${GCP_PATH:-cp} -R -P -p -- $EPUB_NAME "$OUTPUT_DIR" 2>/dev/null + ;; +esac diff --git a/format/docbook/fo b/format/docbook/fo new file mode 100755 index 0000000..8b4f200 --- /dev/null +++ b/format/docbook/fo @@ -0,0 +1,12 @@ +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) + ${GCP_PATH:-cp} -R -P -p -- "$XSLT_PROCESSED" "$OUTPUT_DIR/$(basename "${XSLT_PROCESSED%.*}").fo" + ;; +esac diff --git a/format/docbook/html b/format/docbook/html new file mode 100755 index 0000000..3b2cd71 --- /dev/null +++ b/format/docbook/html @@ -0,0 +1,12 @@ +case "$1" in +stylesheet) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to HTML (with chunks)" + fi + echo "http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl" + ;; +post-process) + ${GCP_PATH:-cp} -R -P -p -- * "$OUTPUT_DIR" + ;; +esac diff --git a/format/docbook/html-nochunks b/format/docbook/html-nochunks new file mode 100755 index 0000000..82b635b --- /dev/null +++ b/format/docbook/html-nochunks @@ -0,0 +1,12 @@ +case "$1" in +stylesheet) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to HTML (no chunks)" + fi + echo "http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl" + ;; +post-process) + ${GCP_PATH:-cp} -R -P -p -- "$XSLT_PROCESSED" "$OUTPUT_DIR/$(basename "${XSLT_PROCESSED%.*}").html" + ;; +esac diff --git a/format/docbook/htmlhelp b/format/docbook/htmlhelp new file mode 100755 index 0000000..01553df --- /dev/null +++ b/format/docbook/htmlhelp @@ -0,0 +1,12 @@ +case "$1" in +stylesheet) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to htmlhelp" + fi + echo "http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl" + ;; +post-process) + ${GCP_PATH:-cp} -R -P -p -- * "$OUTPUT_DIR" + ;; +esac diff --git a/format/docbook/javahelp b/format/docbook/javahelp new file mode 100755 index 0000000..57710f0 --- /dev/null +++ b/format/docbook/javahelp @@ -0,0 +1,12 @@ +case "$1" in +stylesheet) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to javahelp" + fi + echo "http://docbook.sourceforge.net/release/xsl/current/javahelp/javahelp.xsl" + ;; +post-process) + ${GCP_PATH:-cp} -R -P -p -- *.htm* *.hs *.xml *.jhm "$OUTPUT_DIR" + ;; +esac diff --git a/format/docbook/man b/format/docbook/man new file mode 100755 index 0000000..525b03b --- /dev/null +++ b/format/docbook/man @@ -0,0 +1,13 @@ +case "$1" in +stylesheet) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to troff" + fi + echo "http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl" + ;; +post-process) + [ -e "$XSLT_PROCESSED" ] && rm "$XSLT_PROCESSED" + ${GCP_PATH:-cp} -R -P -p -- * "$OUTPUT_DIR" 2>/dev/null + ;; +esac diff --git a/format/docbook/mif b/format/docbook/mif new file mode 100755 index 0000000..bb54946 --- /dev/null +++ b/format/docbook/mif @@ -0,0 +1,18 @@ +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 diff --git a/format/docbook/pcl b/format/docbook/pcl new file mode 100755 index 0000000..a7889b1 --- /dev/null +++ b/format/docbook/pcl @@ -0,0 +1,18 @@ +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 diff --git a/format/docbook/pdf b/format/docbook/pdf new file mode 100755 index 0000000..86fc423 --- /dev/null +++ b/format/docbook/pdf @@ -0,0 +1,37 @@ +case "$USE_BACKEND" in +DEFAULT|FOP) + 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 + ;; +DBLATEX) + 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 --git a/format/docbook/ps b/format/docbook/ps new file mode 100755 index 0000000..86fc423 --- /dev/null +++ b/format/docbook/ps @@ -0,0 +1,37 @@ +case "$USE_BACKEND" in +DEFAULT|FOP) + 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 + ;; +DBLATEX) + 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 --git a/format/docbook/svg b/format/docbook/svg new file mode 100755 index 0000000..a7889b1 --- /dev/null +++ b/format/docbook/svg @@ -0,0 +1,18 @@ +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 diff --git a/format/docbook/txt b/format/docbook/txt new file mode 100755 index 0000000..fe42a1f --- /dev/null +++ b/format/docbook/txt @@ -0,0 +1,61 @@ +case "$USE_BACKEND" in +DEFAULT|DBLATEX) + if [ -n "`type -t $W3M_PATH`" ] + then + CONVERT="$W3M_PATH" + ARGS="-T text/html -dump" + elif [ -n "`type -t $LYNX_PATH`" ] + then + CONVERT="$LYNX_PATH" + ARGS="-force_html -dump -nolist -width=72" + elif [ -n "`type -t $LINKS_PATH`" ] + then + CONVERT="$LINKS_PATH" + ARGS="-dump" + else + echo >&2 "No way to convert HTML to text found." + echo >&2 "Try either installing text web browser(lynx/w3m/links) or use option --with-fop" + exit 3 + fi + + case "$1" in + stylesheet) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to HTML (no chunks)" + fi + echo "http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl" + ;; + post-process) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert HTML to ASCII" + BASENAMEFILE="`basename ${XSLT_PROCESSED%.}`" + echo >&2 "Using : \"${CONVERT} ${ARGS} ${POSTARGS} ${XSLT_PROCESSED} > $OUTPUT_DIR/${BASENAMEFILE}.txt\"" + fi + ${CONVERT} ${ARGS} ${POSTARGS} "${XSLT_PROCESSED}" > \ + "$OUTPUT_DIR/$(basename "${XSLT_PROCESSED%.*}").txt" + ;; + esac +;; +FOP) + 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 +;; +esac diff --git a/format/docbook/xhtml b/format/docbook/xhtml new file mode 100755 index 0000000..8204549 --- /dev/null +++ b/format/docbook/xhtml @@ -0,0 +1,12 @@ +case "$1" in +stylesheet) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to XHTML (with chunks)" + fi + echo "http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl" + ;; +post-process) + ${GCP_PATH:-cp} -R -P -p -- *.*htm* "$OUTPUT_DIR" + ;; +esac diff --git a/format/docbook/xhtml-nochunks b/format/docbook/xhtml-nochunks new file mode 100755 index 0000000..82b555d --- /dev/null +++ b/format/docbook/xhtml-nochunks @@ -0,0 +1,12 @@ +case "$1" in +stylesheet) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to XHTML (no chunks)" + fi + echo "http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl" + ;; +post-process) + ${GCP_PATH:-cp} -R -P -p -- "$XSLT_PROCESSED" "$OUTPUT_DIR/$(basename ${XSLT_PROCESSED%.*}).html" + ;; +esac diff --git a/format/fo/awt b/format/fo/awt new file mode 100755 index 0000000..4c7f1d3 --- /dev/null +++ b/format/fo/awt @@ -0,0 +1,23 @@ +case "$USE_BACKEND" in +DEFAULT|DBLATEX) + echo "Sorry, no way to convert to awt, use --with-fop option for that." + echo "You need to install fop package for using that option." + exit 3 + ;; +FOP) + EXT=$(basename "$0") + case "$1" in + stylesheet) + ;; + post-process) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Rendering XSL-FO to screen" + fi + #we need to change dir to handle external data objects correctly + cd "${OUTPUT_DIR}" + "$FOP_PATH" ${POSTARGS} -fo "${XSLT_PROCESSED}" -"${EXT}" + cd - + esac + ;; +esac diff --git a/format/fo/dvi b/format/fo/dvi new file mode 100755 index 0000000..f294153 --- /dev/null +++ b/format/fo/dvi @@ -0,0 +1,42 @@ +case "$1" in +stylesheet) + ;; +post-process) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Post-process XSL-FO to DVI" + fi + if [ -z "`type -t $XMLTEX_PATH`" ] + then + echo >&2 "Can't process, xmltex tool not found at $XMLTEX_PATH." + exit 3 + fi + # Work around stupid tetex bug with '_' in filenames + # Also work around stupid tetex limitation with long lines (rhbz #101055) + # and workaround passivetex limitation for chapter titles starting with L + # (rhbz #526273) + sed -e "s,/>,/>\n,g" \ + -e "s,block>,&\n,g" "$XSLT_PROCESSED" >tmp.fo + OUT=output + TEXINPUTS="$(dirname "$INPUT_FILE")::$SEARCHPATH" + export TEXINPUTS + "$XMLTEX_PATH" ${POSTARGS} tmp.fo >$OUT </dev/null || { cat $OUT; exit 1; } + [ "$VERBOSE" -ge 2 ] && echo >&2 "First pass complete" + # If there were undefined references we need to re-run xmltex. + if egrep '^LaTeX Warning: There were undefined references.$' $OUT \ + >/dev/null 2>&1 \ + || egrep '^LaTeX Warning: Label.s. may have changed\.' $OUT \ + >/dev/null 2>&1 + then + "$XMLTEX_PATH" ${POSTARGS} tmp.fo >$OUT </dev/null + [ "$VERBOSE" -ge 2 ] && echo >&2 "Second pass complete" + "$XMLTEX_PATH" ${POSTARGS} tmp.fo >$OUT </dev/null + if [ "$VERBOSE" -ge 2 ] + then + echo >&2 "Third pass complete" + [ "$VERBOSE" -ge 3 ] && cat $OUT + fi + fi + ${GCP_PATH:-cp} -R -P -p -- *.dvi "$OUTPUT_DIR/$(basename "${XSLT_PROCESSED%.*}").dvi" + ;; +esac diff --git a/format/fo/mif b/format/fo/mif new file mode 100755 index 0000000..296a86b --- /dev/null +++ b/format/fo/mif @@ -0,0 +1,24 @@ +case "$USE_BACKEND" in +DEFAULT|DBLATEX) + echo "Sorry, no way to convert to mif, use --with-fop option for that" + echo "You need to install fop package for using that option." + exit 3 + ;; +FOP) + EXT=$(basename "$0") + case "$1" in + stylesheet) + ;; + post-process) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Post-process XSL-FO to MIF" + fi + #we need to change dir to handle external data objects correctly + cd "${OUTPUT_DIR}" + "$FOP_PATH" ${POSTARGS} -fo "${XSLT_PROCESSED}" -"${EXT}" "$OUTPUT_DIR/$(basename ${XSLT_PROCESSED%.*}).${EXT}" + cd - + ;; + esac + ;; +esac diff --git a/format/fo/pcl b/format/fo/pcl new file mode 100755 index 0000000..196413f --- /dev/null +++ b/format/fo/pcl @@ -0,0 +1,24 @@ +case "$USE_BACKEND" in +DEFAULT|DBLATEX) + echo "Sorry, no way to convert to pcl, use --with-fop option for that." + echo "You need to install fop package for using that option." + exit 3 + ;; +FOP) + EXT=$(basename "$0") + case "$1" in + stylesheet) + ;; + post-process) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Post-process XSL-FO to PCL" + fi + #we need to change dir to handle external data objects correctly + cd "${OUTPUT_DIR}" + "$FOP_PATH" ${POSTARGS} -fo "${XSLT_PROCESSED}" -"${EXT}" "$OUTPUT_DIR/$(basename ${XSLT_PROCESSED%.*}).${EXT}" + cd - + ;; + esac + ;; +esac diff --git a/format/fo/pdf b/format/fo/pdf new file mode 100755 index 0000000..6e2b37e --- /dev/null +++ b/format/fo/pdf @@ -0,0 +1,64 @@ +case "$USE_BACKEND" in +DEFAULT|DBLATEX) + case "$1" in + stylesheet) + ;; + post-process) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Post-process XSL-FO to PDF" + fi + if [ -z "`type -t $PDFXMLTEX_PATH`" ] + then + echo >&2 "Can't process, pdfxmltex tool not found at $PDFXMLTEX_PATH." + exit 3 + fi + # Work around stupid tetex bug with '_' in filenames + # Also work around stupid tetex limitation with long lines + # (rhbz #101055) and workaround passivetex limitation for chapter + # titles starting with L (rhbz #526273) + sed -e "s,/>,/>\n,g" \ + -e "s,block>,&\n,g" "$XSLT_PROCESSED" >tmp.fo + OUT=output + TEXINPUTS="$(dirname "$INPUT_FILE")::$SEARCHPATH" + export TEXINPUTS + "$PDFXMLTEX_PATH" ${POSTARGS} tmp.fo >$OUT </dev/null || \ + { cat $OUT; exit 1; } + [ "$VERBOSE" -ge 2 ] && echo >&2 "First pass complete" + # If there were undefined references we need to re-run pdfxmltex. + if egrep '^LaTeX Warning: There were undefined references.$' $OUT \ + >/dev/null 2>&1 \ + || egrep '^LaTeX Warning: Label.s. may have changed\.' $OUT \ + >/dev/null 2>&1 + then + "$PDFXMLTEX_PATH" ${POSTARGS} tmp.fo >$OUT </dev/null + [ "$VERBOSE" -ge 2 ] && echo >&2 "Second pass complete" + "$PDFXMLTEX_PATH" ${POSTARGS} tmp.fo >$OUT </dev/null + if [ "$VERBOSE" -ge 2 ] + then + echo >&2 "Third pass complete" + [ "$VERBOSE" -ge 3 ] && cat $OUT + fi + fi + ${GCP_PATH:-cp} -R -P -p -- *.pdf "$OUTPUT_DIR/$(basename "${XSLT_PROCESSED%.*}").pdf" + ;; + esac + ;; +FOP) + EXT=$(basename "$0") + case "$1" in + stylesheet) + ;; + post-process) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Post-process XSL-FO to PDF" + fi + #we need to change dir to handle external data objects correctly + cd "$OUTPUT_DIR" + "$FOP_PATH" ${POSTARGS} -fo "${XSLT_PROCESSED}" -"${EXT}" "$OUTPUT_DIR/$(basename ${XSLT_PROCESSED%.*}).${EXT}" + cd - + ;; + esac + ;; +esac diff --git a/format/fo/ps b/format/fo/ps new file mode 100755 index 0000000..dc7ce66 --- /dev/null +++ b/format/fo/ps @@ -0,0 +1,63 @@ +case "$USE_BACKEND" in +DEFAULT|DBLATEX) + case "$1" in + stylesheet) + ;; + post-process) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Post-process XSL-FO to DVI" + fi + # Work around stupid tetex bug with '_' in filenames + # Also work around stupid tetex limitation with long lines + # (rhbz #101055) and workaround passivetex limitation for chapter + # titles starting with L (rhbz #526273) + sed -e "s,/>,/>\n,g" \ + -e "s,block>,&\n,g" "$XSLT_PROCESSED" >tmp.fo + + OUT=output + TEXINPUTS="$(dirname "$INPUT_FILE")::$SEARCHPATH" + export TEXINPUTS + "$XMLTEX_PATH" ${POSTARGS} tmp.fo >$OUT </dev/null || { cat $OUT; exit 1; } + [ "$VERBOSE" -ge 2 ] && echo >&2 "First pass complete" + # If there were undefined references we need to re-run xmltex. + if egrep '^LaTeX Warning: There were undefined references.$' $OUT \ + >/dev/null 2>&1 \ + || egrep '^LaTeX Warning: Label.s. may have changed\.' $OUT \ + >/dev/null 2>&1 + then + "$XMLTEX_PATH" ${POSTARGS} tmp.fo >$OUT </dev/null + [ "$VERBOSE" -ge 2 ] && echo >&2 "Second pass complete" + "$XMLTEX_PATH" ${POSTARGS} tmp.fo >$OUT </dev/null + if [ "$VERBOSE" -ge 2 ] + then + echo >&2 "Third pass complete" + [ "$VERBOSE" -ge 3 ] && cat $OUT + fi + fi + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Post-process DVI to PS" + fi + dvips -R -q ${POSTPOSTARGS} -o "$OUTPUT_DIR/$(basename "${XSLT_PROCESSED%.*}").ps" *.dvi + ;; + esac + ;; +FOP) + EXT=$(basename "$0") + case "$1" in + stylesheet) + ;; + post-process) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Post-process XSL-FO to PS" + fi + #we need to change dir to handle external data objects correctly + cd "${OUTPUT_DIR}" + "$FOP_PATH" ${POSTARGS} -fo "${XSLT_PROCESSED}" -"${EXT}" "$OUTPUT_DIR/$(basename ${XSLT_PROCESSED%.*}).${EXT}" + cd - + ;; + esac + ;; +esac diff --git a/format/fo/svg b/format/fo/svg new file mode 100755 index 0000000..ae21a0b --- /dev/null +++ b/format/fo/svg @@ -0,0 +1,24 @@ +case "$USE_BACKEND" in +DEFAULT|DBLATEX) + echo "Sorry, no way to convert to svg, use --with-fop option for that." + echo "You need to install fop package for using that option." + exit 3 + ;; +FOP) + EXT=$(basename "$0") + case "$1" in + stylesheet) + ;; + post-process) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Post-process XSL-FO to SVG" + fi + #we need to change dir to handle external data objects correctly + cd "${OUTPUT_DIR}" + "$FOP_PATH" ${POSTARGS} -fo "${XSLT_PROCESSED}" -"${EXT}" "$OUTPUT_DIR/$(basename ${XSLT_PROCESSED%.*}).${EXT}" + cd - + ;; + esac + ;; +esac diff --git a/format/fo/txt b/format/fo/txt new file mode 100755 index 0000000..2f98e42 --- /dev/null +++ b/format/fo/txt @@ -0,0 +1,24 @@ +case "$USE_BACKEND" in +DEFAULT | DBLATEX) + echo "Sorry, no way to convert to txt , use --with-fop option for that." + echo "You need to install fop package for using that option." + exit 3 + ;; +FOP) + EXT=$(basename $0) + case "$1" in + stylesheet) + ;; + post-process) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Post-process XSL-FO to TXT" + fi + #we need to change dir to handle external data objects correctly + cd "${OUTPUT_DIR}" + "$FOP_PATH" ${POSTARGS} -fo "${XSLT_PROCESSED}" -"${EXT}" "$OUTPUT_DIR/$(basename ${XSLT_PROCESSED%.*}).${EXT}" + cd - + ;; + esac + ;; +esac diff --git a/format/xhtml1/awt b/format/xhtml1/awt new file mode 100755 index 0000000..5c243a0 --- /dev/null +++ b/format/xhtml1/awt @@ -0,0 +1,18 @@ +case "$1" in +stylesheet) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to XSL-FO" + fi + echo "http://www.antennahouse.com/XSLsample/sample-xsl-xhtml2fo/xhtml2fo.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 diff --git a/format/xhtml1/dvi b/format/xhtml1/dvi new file mode 100755 index 0000000..c95a11c --- /dev/null +++ b/format/xhtml1/dvi @@ -0,0 +1,32 @@ +case "$USE_BACKEND" in +DEFAULT|FOP) + case "$1" in + stylesheet) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to XSL-FO" + fi + echo "http://www.antennahouse.com/XSLsample/sample-xsl-xhtml2fo/xhtml2fo.xsl" + ;; + post-process) + # Get the FO format script to do the rest + sh "$(dirname "$0")/../fo/$(basename "$0")" "$1" + ;; + esac + ;; +DBLATEX) + 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 --git a/format/xhtml1/fo b/format/xhtml1/fo new file mode 100755 index 0000000..a445ea0 --- /dev/null +++ b/format/xhtml1/fo @@ -0,0 +1,12 @@ +case "$1" in +stylesheet) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to XSL-FO" + fi + echo "http://www.antennahouse.com/XSLsample/sample-xsl-xhtml2fo/xhtml2fo.xsl" + ;; +post-process) + ${GCP_PATH:-cp} -R -P -p -- "$XSLT_PROCESSED" "$OUTPUT_DIR/$(basename "${XSLT_PROCESSED%.*}").fo" + ;; +esac diff --git a/format/xhtml1/mif b/format/xhtml1/mif new file mode 100755 index 0000000..5c243a0 --- /dev/null +++ b/format/xhtml1/mif @@ -0,0 +1,18 @@ +case "$1" in +stylesheet) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to XSL-FO" + fi + echo "http://www.antennahouse.com/XSLsample/sample-xsl-xhtml2fo/xhtml2fo.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 diff --git a/format/xhtml1/pcl b/format/xhtml1/pcl new file mode 100755 index 0000000..24374e6 --- /dev/null +++ b/format/xhtml1/pcl @@ -0,0 +1,18 @@ +case "$1" in +stylesheet) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to XSL-FO" + fi + echo "http://www.antennahouse.com/XSLsample/sample-xsl-xhtml2fo/xhtml2fo.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 diff --git a/format/xhtml1/pdf b/format/xhtml1/pdf new file mode 100755 index 0000000..c95a11c --- /dev/null +++ b/format/xhtml1/pdf @@ -0,0 +1,32 @@ +case "$USE_BACKEND" in +DEFAULT|FOP) + case "$1" in + stylesheet) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to XSL-FO" + fi + echo "http://www.antennahouse.com/XSLsample/sample-xsl-xhtml2fo/xhtml2fo.xsl" + ;; + post-process) + # Get the FO format script to do the rest + sh "$(dirname "$0")/../fo/$(basename "$0")" "$1" + ;; + esac + ;; +DBLATEX) + 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 --git a/format/xhtml1/ps b/format/xhtml1/ps new file mode 100755 index 0000000..c95a11c --- /dev/null +++ b/format/xhtml1/ps @@ -0,0 +1,32 @@ +case "$USE_BACKEND" in +DEFAULT|FOP) + case "$1" in + stylesheet) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to XSL-FO" + fi + echo "http://www.antennahouse.com/XSLsample/sample-xsl-xhtml2fo/xhtml2fo.xsl" + ;; + post-process) + # Get the FO format script to do the rest + sh "$(dirname "$0")/../fo/$(basename "$0")" "$1" + ;; + esac + ;; +DBLATEX) + 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 --git a/format/xhtml1/svg b/format/xhtml1/svg new file mode 100755 index 0000000..24374e6 --- /dev/null +++ b/format/xhtml1/svg @@ -0,0 +1,18 @@ +case "$1" in +stylesheet) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to XSL-FO" + fi + echo "http://www.antennahouse.com/XSLsample/sample-xsl-xhtml2fo/xhtml2fo.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 diff --git a/format/xhtml1/txt b/format/xhtml1/txt new file mode 100755 index 0000000..eb1c07a --- /dev/null +++ b/format/xhtml1/txt @@ -0,0 +1,54 @@ +case "$USE_BACKEND" in +DEFAULT|DBLATEX) + if [ -n "`type -t $W3M_PATH`" ] + then + CONVERT="$W3M_PATH" + ARGS="-T text/html -dump" + elif [ -n "`type -t $LYNX_PATH`" ] + then + CONVERT="$LYNX_PATH" + ARGS="-force_html -dump -nolist -width=72" + elif [ -n "`type -t $LINKS_PATH`" ] + then + CONVERT="$LINKS_PATH" + ARGS="-dump" + else + echo >&2 "No way to convert HTML to text found." + echo >&2 "Try either installing text webbrowser(lynx/w3m/links) or use option --with-fop" + exit 3 + fi + + case "$1" in + post-process) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert HTML to ASCII" + BASENAMEFILE="`basename ${XSLT_PROCESSED%.}`" + echo >&2 "Using : \"${CONVERT} ${ARGS} ${POSTARGS} ${XSLT_PROCESSED} > $OUTPUT_DIR/${BASENAMEFILE}.txt\"" + fi + ${CONVERT} ${ARGS} ${POSTARGS} ${XSLT_PROCESSED} > \ + "$OUTPUT_DIR/$(basename ${XSLT_PROCESSED%.*}).txt" + ;; + esac +;; +FOP) + case "$1" in + stylesheet) + if [ "$VERBOSE" -ge 1 ] + then + echo >&2 "Convert to XSL-FO" + fi + echo "http://www.antennahouse.com/XSLsample/sample-xsl-xhtml2fo/xhtml2fo.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 +;; +esac |