doc: epub and mobi support
authorchas williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Wed, 8 Jun 2011 14:44:21 +0000 (10:44 -0400)
committerDerrick Brashear <shadow@dementia.org>
Fri, 1 Jul 2011 13:46:30 +0000 (06:46 -0700)
.epub is generated using dbtoepub which is still considered alpha
software apparently and installed in a non-standard place.  for now,
use the docbook stylesheet location to find it.  .mobi is generated
using kindlegen from the .epub in order to have a real toc.

there is some preprocessing with a custom stylesheet to make
things "look right".  see mobi-fixup.xsl.in

Change-Id: Ice92e701e2f921e70c0f98683b5e9ab44a347e3b
Reviewed-on: http://gerrit.openafs.org/4887
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

configure.ac
doc/xml/AdminGuide/Makefile.in
doc/xml/AdminGuide/auagd000.png [new file with mode: 0644]
doc/xml/AdminGuide/auagd000.xml
doc/xml/QuickStartUnix/Makefile.in
doc/xml/QuickStartUnix/auqbg000.png [new file with mode: 0644]
doc/xml/QuickStartUnix/auqbg000.xml
doc/xml/UserGuide/Makefile.in
doc/xml/UserGuide/auusg000.png [new file with mode: 0644]
doc/xml/UserGuide/auusg000.xml
doc/xml/mobi-fixup.xsl.in [new file with mode: 0644]

index 0aa3dba..764165e 100644 (file)
@@ -105,6 +105,11 @@ if test -f 'doc/xml/UserGuide/Makefile.in' ; then
 else
    USERGUIDE_MAKEFILE=
 fi
+if test -f 'doc/xml/mobi-fixup.xsl.in' ; then
+   MOBI_FIXUP_XSL="doc/xml/mobi-fixup.xsl"
+else
+   MOBI_FIXUP_XSL=
+fi
 
 AC_OUTPUT(             \
 Makefile               \
@@ -112,6 +117,7 @@ ${MAN_MAKEFILE} \
 ${ADMINGUIDE_MAKEFILE} \
 ${QSUNIX_MAKEFILE} \
 ${USERGUIDE_MAKEFILE} \
+${MOBI_FIXUP_XSL} \
 src/afs/Makefile \
 src/afsd/Makefile \
 src/afsmonitor/Makefile \
index cbbba59..33d0dc8 100644 (file)
@@ -15,7 +15,7 @@
 
 BOOK = auagd000
 
-all: $(BOOK).pdf index.html
+all: $(BOOK).pdf index.html $(BOOK).epub $(BOOK).mobi
 
 include @TOP_OBJDIR@/src/config/Makefile.config
 VERSION=version
@@ -30,6 +30,7 @@ HTML_XSL = @HTML_XSL@
 DOCBOOK_STYLESHEETS = @DOCBOOK_STYLESHEETS@
 XSLTPROC = @XSLTPROC@
 DOCBOOK2PDF = @DOCBOOK2PDF@
+DBTOEPUB = $(DOCBOOK_STYLESHEETS)/epub/bin/dbtoepub
 
 index.html: $(SRCS)
        $(XSLTPROC) --param navig.graphics 1 \
@@ -43,6 +44,14 @@ $(BOOK).pdf: $(SRCS)
                $(DOCBOOK2PDF) $(BOOK).xml; \
        fi
 
+$(BOOK).epub: $(SRCS)
+       if test -x "$(DBTOEPUB)" ; then \
+               $(DBTOEPUB) -s $(TOP_SRCDIR)/../doc/xml/mobi-fixup.xsl $(BOOK).xml; \
+       fi
+
+$(BOOK).mobi: $(BOOK).epub
+       kindlegen $(BOOK).epub -o $(BOOK).mobi
+
 check:
        xmllint --noout --valid $(BOOK).xml
 
diff --git a/doc/xml/AdminGuide/auagd000.png b/doc/xml/AdminGuide/auagd000.png
new file mode 100644 (file)
index 0000000..344ab25
Binary files /dev/null and b/doc/xml/AdminGuide/auagd000.png differ
index 92c1441..5946bb0 100644 (file)
   <bookinfo>
     <title>OpenAFS Administration Guide</title>
 
+    <mediaobject role="cover">
+      <imageobject>
+        <imagedata fileref="auagd000.png" />
+      </imageobject>
+    </mediaobject>
+
     <copyright>
       <year>2000</year>
 
index 229e264..7351645 100644 (file)
@@ -15,7 +15,7 @@
 
 BOOK = auqbg000
 
-all: $(BOOK).pdf index.html
+all: $(BOOK).pdf index.html $(BOOK).epub $(BOOK).mobi
 
 include @TOP_OBJDIR@/src/config/Makefile.config
 VERSION=version
@@ -28,6 +28,7 @@ HTML_XSL = @HTML_XSL@
 DOCBOOK_STYLESHEETS = @DOCBOOK_STYLESHEETS@
 XSLTPROC = @XSLTPROC@
 DOCBOOK2PDF = @DOCBOOK2PDF@
+DBTOEPUB = $(DOCBOOK_STYLESHEETS)/epub/bin/dbtoepub
 
 index.html: $(SRCS)
        $(XSLTPROC) --param navig.graphics 1 \
@@ -41,6 +42,14 @@ $(BOOK).pdf: $(SRCS)
                $(DOCBOOK2PDF) $(BOOK).xml; \
        fi
 
+$(BOOK).epub: $(SRCS)
+       if test -x "$(DBTOEPUB)" ; then \
+               $(DBTOEPUB) -s $(TOP_SRCDIR)/../doc/xml/mobi-fixup.xsl $(BOOK).xml; \
+       fi
+
+$(BOOK).mobi: $(BOOK).epub
+       kindlegen $(BOOK).epub -o $(BOOK).mobi
+
 check:
        xmllint --noout --valid $(BOOK).xml
 
diff --git a/doc/xml/QuickStartUnix/auqbg000.png b/doc/xml/QuickStartUnix/auqbg000.png
new file mode 100644 (file)
index 0000000..941cd3e
Binary files /dev/null and b/doc/xml/QuickStartUnix/auqbg000.png differ
index a7993c2..13b376e 100644 (file)
   <bookinfo>
     <title>OpenAFS Quick Start Guide for UNIX</title>
 
+    <mediaobject role="cover">
+      <imageobject>
+        <imagedata fileref="auqbg000.png" />
+      </imageobject>
+    </mediaobject>
+
     <copyright>
       <year>2000-2009</year>
       <holder>IBM Corporation and other contributors. All Rights Reserved</holder>
index 725959c..4757ccd 100644 (file)
@@ -15,7 +15,7 @@
 
 BOOK = auusg000
 
-all: $(BOOK).pdf index.html
+all: $(BOOK).pdf index.html $(BOOK).epub $(BOOK).mobi
 
 include @TOP_OBJDIR@/src/config/Makefile.config
 VERSION=version
@@ -41,6 +41,14 @@ $(BOOK).pdf: $(SRCS)
                $(DOCBOOK2PDF) $(BOOK).xml; \
        fi
 
+$(BOOK).epub: $(SRCS)
+       if test -x "$(DBTOEPUB)" ; then \
+               $(DBTOEPUB) -s $(TOP_SRCDIR)/../doc/xml/mobi-fixup.xsl $(BOOK).xml; \
+       fi
+
+$(BOOK).mobi: $(BOOK).epub
+       kindlegen $(BOOK).epub -o $(BOOK).mobi
+
 check:
        xmllint --noout --valid $(BOOK).xml
 
diff --git a/doc/xml/UserGuide/auusg000.png b/doc/xml/UserGuide/auusg000.png
new file mode 100644 (file)
index 0000000..c9b17cc
Binary files /dev/null and b/doc/xml/UserGuide/auusg000.png differ
index cbd0fd8..ffb9650 100644 (file)
   <bookinfo>
     <title>OpenAFS User Guide</title>
 
+    <mediaobject role="cover">
+      <imageobject>
+        <imagedata fileref="auusg000.png" />
+      </imageobject>
+    </mediaobject>
+
     <copyright>
       <year>2000</year>
 
diff --git a/doc/xml/mobi-fixup.xsl.in b/doc/xml/mobi-fixup.xsl.in
new file mode 100644 (file)
index 0000000..8e33521
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+
+<!--
+     The kindle seems to render certain lists with an extra line break.
+     To work around this for now, we remove the first <para> for itemized
+     and ordered lists.
+-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+    <xsl:import href="@DOCBOOK_STYLESHEETS@/epub/docbook.xsl"/>
+
+    <xsl:template match="/">
+       <xsl:copy>
+           <xsl:apply-imports/>
+       </xsl:copy>
+    </xsl:template>
+
+
+    <xsl:template match="itemizedlist/listitem/para[position() = 1]">
+        <!-- still process any anchors embedded in the <listitem> -->
+        <xsl:call-template name="anchor">
+            <xsl:with-param name="node" select="parent::listitem"/>
+        </xsl:call-template>
+       <xsl:apply-templates/>
+    </xsl:template>
+
+    <xsl:template match="orderedlist/listitem/para[position() = 1]">
+        <!-- still process any anchors embedded in the <listitem> -->
+        <xsl:call-template name="anchor">
+            <xsl:with-param name="node" select="parent::listitem"/>
+        </xsl:call-template>
+       <xsl:apply-templates/>
+    </xsl:template>
+
+</xsl:stylesheet>