summaryrefslogtreecommitdiffstats
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
parent3bebac3d0e8f24065ecda4abb2a2dad7b1d57164 (diff)
downloadSCons-ef9d8a0031b3ca6faabb0746eeb2a7da519fb805.zip
SCons-ef9d8a0031b3ca6faabb0746eeb2a7da519fb805.tar.gz
SCons-ef9d8a0031b3ca6faabb0746eeb2a7da519fb805.tar.bz2
- added EPUB as output format for documentation ("user" and "man" targets)
-rw-r--r--doc/SConscript30
-rw-r--r--doc/man/MANIFEST3
-rw-r--r--doc/man/SConstruct22
-rw-r--r--doc/man/cover.jpgbin0 -> 306 bytes
-rw-r--r--doc/man/epub.css33
-rw-r--r--doc/man/epub.xsl35
-rw-r--r--doc/man/html.xsl4
-rw-r--r--doc/man/pdf.xsl5
-rw-r--r--doc/man/scons.xml3
-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
18 files changed, 234 insertions, 7 deletions
diff --git a/doc/SConscript b/doc/SConscript
index 8dcf697..c731dab 100644
--- a/doc/SConscript
+++ b/doc/SConscript
@@ -41,6 +41,7 @@ build = os.path.join(build_dir, 'doc')
fop = whereis('fop')
xep = whereis('xep')
epydoc_cli = whereis('epydoc')
+gs = whereis('gs')
#
#
@@ -158,6 +159,8 @@ else:
env.Execute(Mkdir(os.path.join(build_dir, *(dbpath + ['html']))))
env.Execute(Mkdir(os.path.join(build_dir, *(dbpath + ['fo']))))
env.Execute(Mkdir(os.path.join(build_dir, *(dbpath + ['manpages']))))
+ env.Execute(Mkdir(os.path.join(build_dir, *(dbpath + ['epub']))))
+ env.Execute(Mkdir(os.path.join(build_dir, *(dbpath + ['xhtml-1_1']))))
env.Execute(Copy(os.path.join(build_dir, *dbpath),
os.path.join('..', *(dbpath + ['VERSION']))))
for g in glob.glob(os.path.join('..', *(dbpath + ['common', '*.*']))):
@@ -170,6 +173,20 @@ else:
env.Execute(Copy(os.path.join(build_dir, *(dbpath + ['fo'])), g))
for g in glob.glob(os.path.join('..', *(dbpath + ['manpages', '*.*']))):
env.Execute(Copy(os.path.join(build_dir, *(dbpath + ['manpages'])), g))
+ for g in glob.glob(os.path.join('..', *(dbpath + ['epub', '*.xsl']))):
+ env.Execute(Copy(os.path.join(build_dir, *(dbpath + ['epub'])), g))
+ for g in glob.glob(os.path.join('..', *(dbpath + ['xhtml-1_1', '*.*']))):
+ env.Execute(Copy(os.path.join(build_dir, *(dbpath + ['xhtml-1_1'])), g))
+
+ #
+ # Copy additional Tools (gs, zip)
+ #
+ toolpath = ['src', 'engine', 'SCons', 'Tool']
+ env.Execute(Copy(os.path.join(build_dir, *toolpath),
+ os.path.join('..', *(toolpath + ['gs.py']))))
+ env.Execute(Copy(os.path.join(build_dir, *toolpath),
+ os.path.join('..', *(toolpath + ['zip.py']))))
+
#
# Each document will live in its own subdirectory. List them here
@@ -182,8 +199,8 @@ else:
#'python10' : ['chtml','html','pdf'],
'reference' : ['chtml','html','pdf'],
#'developer' : ['chtml','html','pdf'],
- 'user' : ['chtml','html','pdf'],
- 'man' : ['man']
+ 'user' : ['chtml','html','pdf','epub'],
+ 'man' : ['man','epub']
}
# The names of the target files for the MAN pages
man_page_list = ['scons.1','scons-time.1','sconsign.1']
@@ -247,6 +264,7 @@ else:
htmlindex = os.path.join(htmldir, 'index.html')
html = os.path.join(build, 'HTML', 'scons-%s.html' % doc)
pdf = os.path.join(build, 'PDF', 'scons-%s.pdf' % doc)
+ epub = os.path.join(build, 'EPUB', 'scons-%s.epub' % doc)
if 'chtml' in docs[doc]:
env.Install(htmldir, Glob(os.path.join(build, doc,'scons-%s' % doc, '*.html')))
tar_deps.extend([htmlindex])
@@ -268,6 +286,14 @@ else:
tar_deps.append(pdf)
tar_list.append(pdf)
+
+ if 'epub' in docs[doc] and gs:
+ env.InstallAs(epub, os.path.join(build, doc,'scons-%s.epub' % doc))
+ Local(epub)
+ env.Ignore(epub, version_xml)
+
+ tar_deps.append(epub)
+ tar_list.append(epub)
if 'man' in docs[doc]:
#
diff --git a/doc/man/MANIFEST b/doc/man/MANIFEST
index 7f0ad45..4b3ce9f 100644
--- a/doc/man/MANIFEST
+++ b/doc/man/MANIFEST
@@ -5,8 +5,9 @@ scons.xml
sconsign.xml
scons-time.xml
*.xsl
-scons.css
+*.css
SConstruct
+cover.jpg
titlepage/bricks.jpg
titlepage/mapnik_final_colors.svg
titlepage/SCons_path.svg
diff --git a/doc/man/SConstruct b/doc/man/SConstruct
index cd94021..cfdbb2d 100644
--- a/doc/man/SConstruct
+++ b/doc/man/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_PDF='pdf.xsl')
@@ -53,3 +53,23 @@ def createManPages(env, target):
createManPages(env, "scons")
createManPages(env, "sconsign")
createManPages(env, "scons-time")
+
+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-scons.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-man.epub', 'OEBPS', ZIPFLAGS='-Xr9D')
+ env.Clean(oebps, Glob('OEBPS/*.*'))
+ env.Clean(oebps, Glob('META-INF/*.*'))
diff --git a/doc/man/cover.jpg b/doc/man/cover.jpg
new file mode 100644
index 0000000..e2c2cb3
--- /dev/null
+++ b/doc/man/cover.jpg
Binary files differ
diff --git a/doc/man/epub.css b/doc/man/epub.css
new file mode 100644
index 0000000..31cebe5
--- /dev/null
+++ b/doc/man/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/man/epub.xsl b/doc/man/epub.xsl
new file mode 100644
index 0000000..bc1d4b3
--- /dev/null
+++ b/doc/man/epub.xsl
@@ -0,0 +1,35 @@
+<?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/man/html.xsl b/doc/man/html.xsl
index 71a847a..864af88 100644
--- a/doc/man/html.xsl
+++ b/doc/man/html.xsl
@@ -51,5 +51,9 @@ reference 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/man/pdf.xsl b/doc/man/pdf.xsl
index 652975f..f314103 100644
--- a/doc/man/pdf.xsl
+++ b/doc/man/pdf.xsl
@@ -67,5 +67,8 @@ set toc,title
<xsl:apply-templates select="." mode="vl.as.blocks"/>
</xsl:template>
-</xsl:stylesheet>
+<!-- Prevent our EPUB cover image from getting printed to the PDF -->
+<xsl:template match="mediaobject[@role = 'cover']">
+</xsl:template>
+</xsl:stylesheet>
diff --git a/doc/man/scons.xml b/doc/man/scons.xml
index 3f47b47..82c782d 100644
--- a/doc/man/scons.xml
+++ b/doc/man/scons.xml
@@ -60,6 +60,9 @@
</copyright>
<releaseinfo>version &buildversion;</releaseinfo>
+
+ <mediaobject role="cover"><imageobject><imagedata fileref="cover.jpg" format="JPG"/></imageobject></mediaobject>
+
</referenceinfo>
<title>SCons &buildversion;</title>
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>