summaryrefslogtreecommitdiff
path: root/format/docbook/epub
diff options
context:
space:
mode:
Diffstat (limited to 'format/docbook/epub')
-rwxr-xr-xformat/docbook/epub28
1 files changed, 28 insertions, 0 deletions
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