diff options
author | Gary Oberbrunner <garyo@oberbrunner.com> | 2013-11-10 19:55:24 (GMT) |
---|---|---|
committer | Gary Oberbrunner <garyo@oberbrunner.com> | 2013-11-10 19:55:24 (GMT) |
commit | 40b0c82446f7acba626424abcd55ecf157d2bdc7 (patch) | |
tree | b13805434b8db4150b113b93921066dc402a63aa | |
parent | a8261e0d41be63ca45462fb0f40e8ed1339cc22e (diff) | |
parent | ef9d8a0031b3ca6faabb0746eeb2a7da519fb805 (diff) | |
download | SCons-40b0c82446f7acba626424abcd55ecf157d2bdc7.zip SCons-40b0c82446f7acba626424abcd55ecf157d2bdc7.tar.gz SCons-40b0c82446f7acba626424abcd55ecf157d2bdc7.tar.bz2 |
Merged in dirkbaechle/scons (pull request #91)
Adding EPUB as output format for documentation
29 files changed, 332 insertions, 43 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/editor_configs/serna/scons/xsd/dbpoolx.xsd b/doc/editor_configs/serna/scons/xsd/dbpoolx.xsd index f0a3f1c..0ce5cb7 100644 --- a/doc/editor_configs/serna/scons/xsd/dbpoolx.xsd +++ b/doc/editor_configs/serna/scons/xsd/dbpoolx.xsd @@ -2589,7 +2589,6 @@ </xs:documentation> </xs:annotation> <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="para.char.mix"/> <xs:group ref="para.mix"/> <xs:group ref="tool.mix"/> </xs:choice> @@ -2616,7 +2615,6 @@ </xs:documentation> </xs:annotation> <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="para.char.mix"/> <xs:group ref="para.mix"/> <xs:group ref="tool.mix"/> </xs:choice> @@ -2644,7 +2642,6 @@ </xs:documentation> </xs:annotation> <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="para.char.mix"/> <xs:group ref="para.mix"/> <xs:element ref="summary"/> </xs:choice> diff --git a/doc/editor_configs/xmlmind/addon/config/scons/scons_xsd/dbpoolx.xsd b/doc/editor_configs/xmlmind/addon/config/scons/scons_xsd/dbpoolx.xsd index f0a3f1c..0ce5cb7 100644 --- a/doc/editor_configs/xmlmind/addon/config/scons/scons_xsd/dbpoolx.xsd +++ b/doc/editor_configs/xmlmind/addon/config/scons/scons_xsd/dbpoolx.xsd @@ -2589,7 +2589,6 @@ </xs:documentation> </xs:annotation> <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="para.char.mix"/> <xs:group ref="para.mix"/> <xs:group ref="tool.mix"/> </xs:choice> @@ -2616,7 +2615,6 @@ </xs:documentation> </xs:annotation> <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="para.char.mix"/> <xs:group ref="para.mix"/> <xs:group ref="tool.mix"/> </xs:choice> @@ -2644,7 +2642,6 @@ </xs:documentation> </xs:annotation> <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="para.char.mix"/> <xs:group ref="para.mix"/> <xs:element ref="summary"/> </xs:choice> diff --git a/doc/generated/builders.gen b/doc/generated/builders.gen index 3fdafb6..5cd92f2 100644 --- a/doc/generated/builders.gen +++ b/doc/generated/builders.gen @@ -397,6 +397,27 @@ env.DVI(target = 'ccc.dvi', source = 'ccc.latex') </example_commands> </listitem> </varlistentry> + <varlistentry id="b-Gs"> + <term> + <function>Gs()</function> + </term> + <term> + <function>env.Gs()</function> + </term> + <listitem> +<para xmlns="http://www.scons.org/dbxsd/v1.0"> +A Builder for explicitly calling the <literal>gs</literal> executable. +Depending on the underlying OS, the different names <literal>gs</literal>, +<literal>gsos2</literal> and <literal>gswin32c</literal> +are tried. +</para> +<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['gs']) +env.Gs('cover.jpg','scons-scons.pdf', + GSFLAGS='-dNOPAUSE -dBATCH -sDEVICE=jpeg -dFirstPage=1 -dLastPage=1 -q') + ) +</example_commands> +</listitem> + </varlistentry> <varlistentry id="b-Install"> <term> <function>Install()</function> diff --git a/doc/generated/builders.mod b/doc/generated/builders.mod index 59900cc..b8c7d80 100644 --- a/doc/generated/builders.mod +++ b/doc/generated/builders.mod @@ -21,6 +21,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. <!ENTITY b-DocbookXInclude "<function xmlns='http://www.scons.org/dbxsd/v1.0'>DocbookXInclude</function>"> <!ENTITY b-DocbookXslt "<function xmlns='http://www.scons.org/dbxsd/v1.0'>DocbookXslt</function>"> <!ENTITY b-DVI "<function xmlns='http://www.scons.org/dbxsd/v1.0'>DVI</function>"> +<!ENTITY b-Gs "<function xmlns='http://www.scons.org/dbxsd/v1.0'>Gs</function>"> <!ENTITY b-Install "<function xmlns='http://www.scons.org/dbxsd/v1.0'>Install</function>"> <!ENTITY b-InstallAs "<function xmlns='http://www.scons.org/dbxsd/v1.0'>InstallAs</function>"> <!ENTITY b-InstallVersionedLib "<function xmlns='http://www.scons.org/dbxsd/v1.0'>InstallVersionedLib</function>"> @@ -74,6 +75,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. <!ENTITY b-env-DocbookXInclude "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.DocbookXInclude</function>"> <!ENTITY b-env-DocbookXslt "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.DocbookXslt</function>"> <!ENTITY b-env-DVI "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.DVI</function>"> +<!ENTITY b-env-Gs "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.Gs</function>"> <!ENTITY b-env-Install "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.Install</function>"> <!ENTITY b-env-InstallAs "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.InstallAs</function>"> <!ENTITY b-env-InstallVersionedLib "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.InstallVersionedLib</function>"> @@ -137,6 +139,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. <!ENTITY b-link-DocbookXInclude "<link linkend='b-DocbookXInclude' xmlns='http://www.scons.org/dbxsd/v1.0'><function>DocbookXInclude</function></link>"> <!ENTITY b-link-DocbookXslt "<link linkend='b-DocbookXslt' xmlns='http://www.scons.org/dbxsd/v1.0'><function>DocbookXslt</function></link>"> <!ENTITY b-link-DVI "<link linkend='b-DVI' xmlns='http://www.scons.org/dbxsd/v1.0'><function>DVI</function></link>"> +<!ENTITY b-link-Gs "<link linkend='b-Gs' xmlns='http://www.scons.org/dbxsd/v1.0'><function>Gs</function></link>"> <!ENTITY b-link-Install "<link linkend='b-Install' xmlns='http://www.scons.org/dbxsd/v1.0'><function>Install</function></link>"> <!ENTITY b-link-InstallAs "<link linkend='b-InstallAs' xmlns='http://www.scons.org/dbxsd/v1.0'><function>InstallAs</function></link>"> <!ENTITY b-link-InstallVersionedLib "<link linkend='b-InstallVersionedLib' xmlns='http://www.scons.org/dbxsd/v1.0'><function>InstallVersionedLib</function></link>"> @@ -190,6 +193,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. <!ENTITY b-link-env-DocbookXInclude "<link linkend='b-DocbookXInclude' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.DocbookXInclude</function></link>"> <!ENTITY b-link-env-DocbookXslt "<link linkend='b-DocbookXslt' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.DocbookXslt</function></link>"> <!ENTITY b-link-env-DVI "<link linkend='b-DVI' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.DVI</function></link>"> +<!ENTITY b-link-env-Gs "<link linkend='b-Gs' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.Gs</function></link>"> <!ENTITY b-link-env-Install "<link linkend='b-Install' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.Install</function></link>"> <!ENTITY b-link-env-InstallAs "<link linkend='b-InstallAs' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.InstallAs</function></link>"> <!ENTITY b-link-env-InstallVersionedLib "<link linkend='b-InstallVersionedLib' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.InstallVersionedLib</function></link>"> diff --git a/doc/generated/tools.gen b/doc/generated/tools.gen index 57bb0a2..7d75638 100644 --- a/doc/generated/tools.gen +++ b/doc/generated/tools.gen @@ -444,7 +444,12 @@ Set construction variables for GNU linker/loader. <term>gs</term> <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0"> -Set construction variables for Ghostscript. +This Tool sets the required construction variables for working with +the Ghostscript command. It also registers an appropriate Action +with the PDF Builder (<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-PDF"><function>PDF</function></link>), such that the conversion from +PS/EPS to PDF happens automatically for the TeX/LaTeX toolchain. +Finally, it adds an explicit Ghostscript Builder (<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-Gs"><function>Gs</function></link>) to the +environment. </para> <para>Sets: &cv-link-GS;, &cv-link-GSCOM;, &cv-link-GSFLAGS;.</para><para>Uses: &cv-link-GSCOMSTR;.</para></listitem> </varlistentry> diff --git a/doc/generated/variables.gen b/doc/generated/variables.gen index 784cd28..ee5a0dd 100644 --- a/doc/generated/variables.gen +++ b/doc/generated/variables.gen @@ -2324,7 +2324,7 @@ described above.) <term>GS</term> <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0"> -The Ghostscript program used to convert PostScript to PDF files. +The Ghostscript program used, e.g. to convert PostScript to PDF files. </para> </listitem> </varlistentry> @@ -2332,7 +2332,8 @@ The Ghostscript program used to convert PostScript to PDF files. <term>GSCOM</term> <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0"> -The Ghostscript command line used to convert PostScript to PDF files. +The full Ghostscript command line used for the conversion process. Its default +value is <quote><literal>$GS $GSFLAGS -sOutputFile=$TARGET $SOURCES</literal></quote>. </para> </listitem> </varlistentry> @@ -2341,9 +2342,8 @@ The Ghostscript command line used to convert PostScript to PDF files. <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0"> The string displayed when -Ghostscript is used to convert -a PostScript file to a PDF file. -If this is not set, then <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-GSCOM"><envar>$GSCOM</envar></link> (the command line) is displayed. +Ghostscript is called for the conversion process. +If this is not set (the default), then <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-GSCOM"><envar>$GSCOM</envar></link> (the command line) is displayed. </para> </listitem> </varlistentry> @@ -2351,8 +2351,9 @@ If this is not set, then <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend=" <term>GSFLAGS</term> <listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0"> -General options passed to the Ghostscript program -when converting PostScript to PDF files. +General options passed to the Ghostscript program, +when converting PostScript to PDF files for example. Its default value +is <quote><literal>-dNOPAUSE -dBATCH -sDEVICE=pdfwrite</literal></quote> </para> </listitem> </varlistentry> @@ -3548,6 +3549,9 @@ See <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="t-msginit"><literal>m Internal ``macro''. Computes locale (language) name based on target filename (default: <literal>'${TARGET.filebase}' </literal>). </para> +<para xmlns="http://www.scons.org/dbxsd/v1.0"> +See <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="t-msginit"><literal>msginit</literal></link> tool and <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-POInit"><function>POInit</function></link> builder. +</para> </listitem> </varlistentry> <varlistentry id="cv-MSGMERGE"> 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 Binary files differnew file mode 100644 index 0000000..e2c2cb3 --- /dev/null +++ b/doc/man/cover.jpg 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 ab5d35f..5560847 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 Binary files differnew file mode 100644 index 0000000..e2c2cb3 --- /dev/null +++ b/doc/user/cover.jpg 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>
diff --git a/doc/xsd/dbpoolx.xsd b/doc/xsd/dbpoolx.xsd index f0a3f1c..0ce5cb7 100644 --- a/doc/xsd/dbpoolx.xsd +++ b/doc/xsd/dbpoolx.xsd @@ -2589,7 +2589,6 @@ </xs:documentation> </xs:annotation> <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="para.char.mix"/> <xs:group ref="para.mix"/> <xs:group ref="tool.mix"/> </xs:choice> @@ -2616,7 +2615,6 @@ </xs:documentation> </xs:annotation> <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="para.char.mix"/> <xs:group ref="para.mix"/> <xs:group ref="tool.mix"/> </xs:choice> @@ -2644,7 +2642,6 @@ </xs:documentation> </xs:annotation> <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="para.char.mix"/> <xs:group ref="para.mix"/> <xs:element ref="summary"/> </xs:choice> diff --git a/src/engine/SCons/Tool/gs.py b/src/engine/SCons/Tool/gs.py index ada169a..a8fddde 100644 --- a/src/engine/SCons/Tool/gs.py +++ b/src/engine/SCons/Tool/gs.py @@ -34,6 +34,7 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Action +import SCons.Builder import SCons.Platform import SCons.Util @@ -52,17 +53,27 @@ GhostscriptAction = None def generate(env): """Add Builders and construction variables for Ghostscript to an Environment.""" - global GhostscriptAction - if GhostscriptAction is None: - GhostscriptAction = SCons.Action.Action('$GSCOM', '$GSCOMSTR') - - import pdf - pdf.generate(env) - - bld = env['BUILDERS']['PDF'] - bld.add_action('.ps', GhostscriptAction) - + # The following try-except block enables us to use the Tool + # in standalone mode (without the accompanying pdf.py), + # whenever we need an explicit call of gs via the Gs() + # Builder ... + try: + if GhostscriptAction is None: + GhostscriptAction = SCons.Action.Action('$GSCOM', '$GSCOMSTR') + + import pdf + pdf.generate(env) + + bld = env['BUILDERS']['PDF'] + bld.add_action('.ps', GhostscriptAction) + except ImportError, e: + pass + + gsbuilder = SCons.Builder.Builder(action = SCons.Action.Action('$GSCOM', '$GSCOMSTR'), + env = env) + env['BUILDERS']['Gs'] = gsbuilder + env['GS'] = gs env['GSFLAGS'] = SCons.Util.CLVar('-dNOPAUSE -dBATCH -sDEVICE=pdfwrite') env['GSCOM'] = '$GS $GSFLAGS -sOutputFile=$TARGET $SOURCES' diff --git a/src/engine/SCons/Tool/gs.xml b/src/engine/SCons/Tool/gs.xml index c34f004..3fe5165 100644 --- a/src/engine/SCons/Tool/gs.xml +++ b/src/engine/SCons/Tool/gs.xml @@ -26,7 +26,12 @@ See its __doc__ string for a discussion of the format. <tool name="gs"> <summary> <para> -Set construction variables for Ghostscript. +This Tool sets the required construction variables for working with +the Ghostscript command. It also registers an appropriate Action +with the PDF Builder (&b-link-PDF;), such that the conversion from +PS/EPS to PDF happens automatically for the TeX/LaTeX toolchain. +Finally, it adds an explicit Ghostscript Builder (&b-link-Gs;) to the +environment. </para> </summary> <sets> @@ -42,7 +47,7 @@ Set construction variables for Ghostscript. <cvar name="GS"> <summary> <para> -The Ghostscript program used to convert PostScript to PDF files. +The Ghostscript program used, e.g. to convert PostScript to PDF files. </para> </summary> </cvar> @@ -50,7 +55,8 @@ The Ghostscript program used to convert PostScript to PDF files. <cvar name="GSCOM"> <summary> <para> -The Ghostscript command line used to convert PostScript to PDF files. +The full Ghostscript command line used for the conversion process. Its default +value is <quote><literal>$GS $GSFLAGS -sOutputFile=$TARGET $SOURCES</literal></quote>. </para> </summary> </cvar> @@ -59,9 +65,8 @@ The Ghostscript command line used to convert PostScript to PDF files. <summary> <para> The string displayed when -Ghostscript is used to convert -a PostScript file to a PDF file. -If this is not set, then &cv-link-GSCOM; (the command line) is displayed. +Ghostscript is called for the conversion process. +If this is not set (the default), then &cv-link-GSCOM; (the command line) is displayed. </para> </summary> </cvar> @@ -69,10 +74,27 @@ If this is not set, then &cv-link-GSCOM; (the command line) is displayed. <cvar name="GSFLAGS"> <summary> <para> -General options passed to the Ghostscript program -when converting PostScript to PDF files. +General options passed to the Ghostscript program, +when converting PostScript to PDF files for example. Its default value +is <quote><literal>-dNOPAUSE -dBATCH -sDEVICE=pdfwrite</literal></quote> </para> </summary> </cvar> +<builder name="Gs"> +<summary> +<para> +A Builder for explicitly calling the <literal>gs</literal> executable. +Depending on the underlying OS, the different names <literal>gs</literal>, +<literal>gsos2</literal> and <literal>gswin32c</literal> +are tried. +</para> +<example_commands>env = Environment(tools=['gs']) +env.Gs('cover.jpg','scons-scons.pdf', + GSFLAGS='-dNOPAUSE -dBATCH -sDEVICE=jpeg -dFirstPage=1 -dLastPage=1 -q') + ) +</example_commands> +</summary> +</builder> + </sconsdoc>
\ No newline at end of file diff --git a/src/engine/SCons/Tool/msginit.xml b/src/engine/SCons/Tool/msginit.xml index 0f89020..7ce785c 100644 --- a/src/engine/SCons/Tool/msginit.xml +++ b/src/engine/SCons/Tool/msginit.xml @@ -216,8 +216,10 @@ See &t-link-msginit; tool and &b-link-POInit; builder. Internal ``macro''. Computes locale (language) name based on target filename (default: <literal>'${TARGET.filebase}' </literal>). </para> -</summary> +<para> See &t-link-msginit; tool and &b-link-POInit; builder. +</para> +</summary> </cvar> </sconsdoc>
\ No newline at end of file diff --git a/test/Ghostscript/GS.py b/test/Ghostscript/GS.py index 2cae8b8..daeea09 100644 --- a/test/Ghostscript/GS.py +++ b/test/Ghostscript/GS.py @@ -51,6 +51,7 @@ env = Environment(GS = r'%(_python_)s mygs.py', GSCOM = r'$GS $TARGET $SOURCE', tools=['gs']) env.PDF(target = 'test1.pdf', source = 'test1.ps') +env.Gs(target = 'test2.pdf', source = 'test1.ps') """ % locals()) test.write('test1.ps', r"""This is a .ps test. @@ -60,6 +61,7 @@ test.write('test1.ps', r"""This is a .ps test. test.run(arguments = '.', stderr = None) test.fail_test(test.read('test1.pdf') != "This is a .ps test.\n") +test.fail_test(test.read('test2.pdf') != "This is a .ps test.\n") |