summaryrefslogtreecommitdiffstats
path: root/doc/user
diff options
context:
space:
mode:
authorDirk Baechle <dl9obn@darc.de>2013-10-08 13:45:37 (GMT)
committerDirk Baechle <dl9obn@darc.de>2013-10-08 13:45:37 (GMT)
commitef9d8a0031b3ca6faabb0746eeb2a7da519fb805 (patch)
treef2822fcfebe6b8257b5d1fe2e74af24b5885e82d /doc/user
parent3bebac3d0e8f24065ecda4abb2a2dad7b1d57164 (diff)
downloadSCons-ef9d8a0031b3ca6faabb0746eeb2a7da519fb805.zip
SCons-ef9d8a0031b3ca6faabb0746eeb2a7da519fb805.tar.gz
SCons-ef9d8a0031b3ca6faabb0746eeb2a7da519fb805.tar.bz2
- added EPUB as output format for documentation ("user" and "man" targets)
Diffstat (limited to 'doc/user')
-rw-r--r--doc/user/MANIFEST2
-rw-r--r--doc/user/SConstruct22
-rw-r--r--doc/user/chtml.xsl4
-rw-r--r--doc/user/cover.jpgbin0 -> 306 bytes
-rw-r--r--doc/user/epub.css33
-rw-r--r--doc/user/epub.xsl36
-rw-r--r--doc/user/html.xsl4
-rw-r--r--doc/user/main.xml1
-rw-r--r--doc/user/pdf.xsl4
9 files changed, 104 insertions, 2 deletions
diff --git a/doc/user/MANIFEST b/doc/user/MANIFEST
index e5f8988..62da288 100644
--- a/doc/user/MANIFEST
+++ b/doc/user/MANIFEST
@@ -51,7 +51,7 @@ variants.xml
variables.xml
*.jpg
*.xsl
-scons.css
+*.css
SConstruct
titlepage/bricks.jpg
titlepage/mapnik_final_colors.svg
diff --git a/doc/user/SConstruct b/doc/user/SConstruct
index 002aea4..5d36a5e 100644
--- a/doc/user/SConstruct
+++ b/doc/user/SConstruct
@@ -27,7 +27,7 @@
import os
env = Environment(ENV={'PATH' : os.environ['PATH']},
- tools=['docbook'],
+ tools=['docbook','gs','zip'],
toolpath=['../../src/engine/SCons/Tool'],
DOCBOOK_DEFAULT_XSL_HTML='html.xsl',
DOCBOOK_DEFAULT_XSL_HTMLCHUNKED='chtml.xsl',
@@ -51,3 +51,23 @@ env.DocbookHtml('index.html','scons_db.xml')
env.DocbookHtmlChunked('index.html', 'scons_db.xml', base_dir='scons-user/')
if has_pdf:
env.DocbookPdf('scons-user.pdf','scons_db.xml')
+
+has_gs = False
+if env.WhereIs('gs'):
+ has_gs = True
+
+#
+# Create the EPUB format
+#
+if has_gs and has_pdf:
+ metainf = env.Command('META-INF','',[Mkdir('META-INF'), Mkdir('OEBPS')])
+ css = env.Command('OEBPS/epub.css','epub.css',[Copy('OEBPS/epub.css','epub.css')])
+ env.Depends(css, metainf)
+ jpg = env.Gs('OEBPS/cover.jpg','scons-user.pdf',
+ GSFLAGS='-dNOPAUSE -dBATCH -sDEVICE=jpeg -dFirstPage=1 -dLastPage=1 -dJPEGQ=100 -r72x72 -q')
+ env.Depends(jpg, metainf)
+ oebps = env.DocbookXslt('OEBPS/toc.ncx', 'scons_db.xml', xsl='epub.xsl')
+ env.Depends(oebps, jpg)
+ env.Zip('scons-user.epub', 'OEBPS', ZIPFLAGS='-Xr9D')
+ env.Clean(oebps, Glob('OEBPS/*.*'))
+ env.Clean(oebps, Glob('META-INF/*.*'))
diff --git a/doc/user/chtml.xsl b/doc/user/chtml.xsl
index fa01b46..e292c88 100644
--- a/doc/user/chtml.xsl
+++ b/doc/user/chtml.xsl
@@ -52,5 +52,9 @@ reference toc,title
set toc,title
</xsl:param>
+<!-- Prevent our EPUB cover image from getting included -->
+<xsl:template match="mediaobject[@role = 'cover']">
+</xsl:template>
+
</xsl:stylesheet>
diff --git a/doc/user/cover.jpg b/doc/user/cover.jpg
new file mode 100644
index 0000000..e2c2cb3
--- /dev/null
+++ b/doc/user/cover.jpg
Binary files differ
diff --git a/doc/user/epub.css b/doc/user/epub.css
new file mode 100644
index 0000000..31cebe5
--- /dev/null
+++ b/doc/user/epub.css
@@ -0,0 +1,33 @@
+/* This defines styles and classes used in the book */
+body { }
+code { font-family: monospace; }
+h1, h2, h3, h4, h5, h6 { text-align: center; margin-bottom:2em;}
+h1.title { }
+h2.author { }
+p{
+ padding:0;
+ margin:0;
+ text-indent:2em;
+}
+blockquote{
+ margin-left:3em;
+ margin-right:3em;
+}
+.caption{
+ text-align:center;
+ font-style:italic;
+ margin-bottom:1em;
+ margin-top:.2em;
+ font-size:.8em;
+}
+blockquote > p{
+ text-indent:0;
+ margin-bottom:1em;
+}
+img{
+ display:block;
+ margin-left: auto;
+ margin-right: auto;
+ text-align:center;
+ margin-top:1em;
+}
diff --git a/doc/user/epub.xsl b/doc/user/epub.xsl
new file mode 100644
index 0000000..6ff435c
--- /dev/null
+++ b/doc/user/epub.xsl
@@ -0,0 +1,36 @@
+<?xml version='1.0'?>
+<!--
+
+ __COPYRIGHT__
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+-->
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ version="1.0">
+
+ <xsl:import href="../../src/engine/SCons/Tool/docbook/docbook-xsl-1.76.1/epub/docbook.xsl"/>
+
+<xsl:param name="html.stylesheet" select="'epub.css'"/>
+
+</xsl:stylesheet>
+
diff --git a/doc/user/html.xsl b/doc/user/html.xsl
index 74ea529..c275c3d 100644
--- a/doc/user/html.xsl
+++ b/doc/user/html.xsl
@@ -51,5 +51,9 @@ reference toc,title
set toc,title
</xsl:param>
+<!-- Prevent our EPUB cover image from getting included -->
+<xsl:template match="mediaobject[@role = 'cover']">
+</xsl:template>
+
</xsl:stylesheet>
diff --git a/doc/user/main.xml b/doc/user/main.xml
index cb516e1..60dd8c9 100644
--- a/doc/user/main.xml
+++ b/doc/user/main.xml
@@ -85,6 +85,7 @@
<releaseinfo>version &buildversion;</releaseinfo>
+ <mediaobject role="cover"><imageobject><imagedata fileref="cover.jpg" format="JPG"/></imageobject></mediaobject>
</bookinfo>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="preface.xml"/>
diff --git a/doc/user/pdf.xsl b/doc/user/pdf.xsl
index 652975f..9c54592 100644
--- a/doc/user/pdf.xsl
+++ b/doc/user/pdf.xsl
@@ -67,5 +67,9 @@ set toc,title
<xsl:apply-templates select="." mode="vl.as.blocks"/>
</xsl:template>
+<!-- Prevent our EPUB cover image from getting printed to the PDF -->
+<xsl:template match="mediaobject[@role = 'cover']">
+</xsl:template>
+
</xsl:stylesheet>