From 1bd5274a2783d061f281f75b985701920129d741 Mon Sep 17 00:00:00 2001 From: Ondrej Vasik Date: Dec 20 2012 14:01:37 +0000 Subject: handle used css lists in epub (by Kacper Perschke git-svn-id: https://svn.fedorahosted.org/svn/xmlto@73 eb1b79c1-ba03-4820-82f3-b60cf523859b --- diff --git a/THANKS b/THANKS index 9c1f1be..83bdc56 100644 --- a/THANKS +++ b/THANKS @@ -20,3 +20,4 @@ Christopher Yeleighton Mike Frysinger Cyril Brulebois Matthias Andree +Kacper Perschke diff --git a/configure.in b/configure.in index 79e7ef0..5ba6fe5 100644 --- a/configure.in +++ b/configure.in @@ -112,6 +112,9 @@ AC_PATH_PROG([TAIL], [tail], [tail]) AC_ARG_VAR([GREP], [Name and path of a GNU grep binary.]) AC_PATH_PROG([GREP], [grep], [grep]) +AC_ARG_VAR([SED], [Name and path of a GNU sed binary.]) +AC_PATH_PROG([SED], [sed], [sed]) + AC_ARG_VAR([GCP], [Name and path of a GNU cp binary (need at least -P)]) AC_PATH_PROG([GCP], [cp], [cp]) diff --git a/format/docbook/epub b/format/docbook/epub index 1c854fa..6b8849b 100755 --- a/format/docbook/epub +++ b/format/docbook/epub @@ -18,6 +18,13 @@ case "$1" in then echo >&2 "Creating epub file" fi + INPUT_DIR=`dirname $INPUT_FILE` + CSS_DEST_DIR=$PWD/OEBPS + USED_CSS_LIST=`${GREP_PATH} 'link rel="stylesheet"' $CSS_DEST_DIR/*.html | ${SED_PATH} -e's/.*.*/\1/' | uniq` + for CSS_SOURCE in $USED_CSS_LIST + do + ${GCP_PATH:-cp} -R -P -p -- $INPUT_DIR/$CSS_SOURCE $CSS_DEST_DIR/ + done echo "application/epub+zip" > mimetype EPUB_NAME=$(basename "${XSLT_PROCESSED%.*}").epub [ -e "$XSLT_PROCESSED" ] && rm "$XSLT_PROCESSED" diff --git a/format/fo/dvi b/format/fo/dvi index f294153..6615048 100755 --- a/format/fo/dvi +++ b/format/fo/dvi @@ -15,7 +15,7 @@ post-process) # 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" \ + ${SED_PATH} -e "s,/>,/>\n,g" \ -e "s,block>,&\n,g" "$XSLT_PROCESSED" >tmp.fo OUT=output TEXINPUTS="$(dirname "$INPUT_FILE")::$SEARCHPATH" diff --git a/format/fo/pdf b/format/fo/pdf index 6e2b37e..9e586b3 100755 --- a/format/fo/pdf +++ b/format/fo/pdf @@ -17,7 +17,7 @@ DEFAULT|DBLATEX) # 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" \ + ${SED_PATH} -e "s,/>,/>\n,g" \ -e "s,block>,&\n,g" "$XSLT_PROCESSED" >tmp.fo OUT=output TEXINPUTS="$(dirname "$INPUT_FILE")::$SEARCHPATH" diff --git a/format/fo/ps b/format/fo/ps index dc7ce66..27673cf 100755 --- a/format/fo/ps +++ b/format/fo/ps @@ -12,7 +12,7 @@ DEFAULT|DBLATEX) # 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" \ + ${SED_PATH} -e "s,/>,/>\n,g" \ -e "s,block>,&\n,g" "$XSLT_PROCESSED" >tmp.fo OUT=output diff --git a/xmlto.in b/xmlto.in index 21db05b..4489698 100755 --- a/xmlto.in +++ b/xmlto.in @@ -23,6 +23,7 @@ BASH=@BASH@ # GNU bash, for running the format scripts GETOPT=@GETOPT@ # a getopt that supports --longoptions TAIL=@TAIL@ # a tail that supports -n (posix) GREP=@GREP@ # GNU grep, for searching patterns +SED=@SED@ # GNU sed, for modification of patterns version () { echo "@PACKAGE@ version @VERSION@" @@ -276,6 +277,8 @@ LINKS_PATH=@LINKS@ W3M_PATH=@W3M@ LYNX_PATH=@LYNX@ GCP_PATH=@GCP@ +SED_PATH=@SED@ +GREP_PATH=@GREP@ ZIP_PATH=@ZIP@ # Process any options @@ -481,6 +484,8 @@ export GCP_PATH export LINKS_PATH export LYNX_PATH export FOP_PATH +export SED_PATH +export GREP_PATH export DBLATEX_PATH export XMLTEX_PATH export PDFXMLTEX_PATH