Skip to content

Commit

Permalink
[HHFG/epub] Build is now working.
Browse files Browse the repository at this point in the history
  • Loading branch information
shlomif committed Apr 10, 2013
1 parent 242f4ba commit 337ad33
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 39 deletions.
5 changes: 4 additions & 1 deletion HHFG/text/Makefile
Expand Up @@ -106,7 +106,7 @@ EPUB_SCRIPT = $(XSL_SNAPSHOT_HOME)/epub/bin/dbtoepub

$(ENG_EPUB) : $(ENG_DB_PROCESSED) $(ENG_EPUB_XSLT)
$(JING) $<
ruby -s $(EPUB_SCRIPT) -s $(ENG_EPUB_XSLT) -o $@ $(ENG_DB_PROCESSED)
ruby $(EPUB_SCRIPT) -s $(ENG_EPUB_XSLT) -o $@ $(ENG_DB_PROCESSED)

$(DOCS_FICTION_HTML_FOR_OOO): %.for-openoffice.html: %.xhtml
cat $< | perl -lne 's{(</title>)}{$${1}<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />}; print unless m{\A<\?xml}' > $@
Expand Down Expand Up @@ -147,3 +147,6 @@ $(EPUB_GEN_BUG_ARC): $(EPUB_GEN_BUG_FILES)
cp $(EPUB_GEN_BUG_FILES) $(EP)/
zip -r $(EPUB_GEN_BUG_ARC) $(EP)
rm -fr ./$(EP)

epub_gen_bug_upload: epub_gen_bug
rsync -v --progress -a $(EPUB_GEN_BUG_ARC) $${__HOMEPAGE_REMOTE_PATH}/temp-db5-epub/
39 changes: 2 additions & 37 deletions HHFG/text/docbook-epub-preproc.xslt
Expand Up @@ -6,44 +6,9 @@
xmlns:xlink="http://www.w3.org/1999/xlink"
>

<xsl:import href="epub/docbook.xsl" />
<xsl:import href="http://docbook.sourceforge.net/release/xsl-ns/current/epub/docbook.xsl" />

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"
/>

<xsl:template match="*">
<xsl:choose>
<xsl:when test="local-name() = 'legalnotice'">
<legalnotice>
<xsl:copy-of select="@*"/>
<xsl:call-template name="nc_legal_notice" />
</legalnotice>
</xsl:when>
<xsl:otherwise>
<xsl:element name="{local-name()}">
<xsl:copy-of select="@*" />
<xsl:apply-templates />
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template name="nc_legal_notice">
<para>
This document is copyrighted by Shlomi Fish
under the
<link xlink:href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative
Commons Attribution
Noncommercial Share-Alike (Unported) License (CC-by-nc-sa) version
3.0</link>
(or at your option, any greater version).
</para>
<para>
Note that the original text of the story and its DocBook source is
under "CC-by-sa", but the author relicensed the final EPUB to
"CC-by-nc-sa" upon publishing.
</para>
</xsl:template>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no" />

<!-- Get rid of the revhistory element -->
<xsl:template match="d:revhistory" mode="titlepage.mode" />
Expand Down
51 changes: 51 additions & 0 deletions HHFG/text/docbook-to-docbook.xslt
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns="http://docbook.org/ns/docbook"
xmlns:d="http://docbook.org/ns/docbook"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xlink="http://www.w3.org/1999/xlink"
>

<xsl:import href="epub/docbook.xsl" />

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"
/>

<xsl:template match="*">
<xsl:choose>
<xsl:when test="local-name() = 'legalnotice'">
<legalnotice>
<xsl:copy-of select="@*"/>
<xsl:call-template name="nc_legal_notice" />
</legalnotice>
</xsl:when>
<xsl:otherwise>
<xsl:element name="{local-name()}">
<xsl:copy-of select="@*" />
<xsl:apply-templates />
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template name="nc_legal_notice">
<para>
This document is copyrighted by Shlomi Fish
under the
<link xlink:href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative
Commons Attribution
Noncommercial Share-Alike (Unported) License (CC-by-nc-sa) version
3.0</link>
(or at your option, any greater version).
</para>
<para>
Note that the original text of the story and its DocBook source is
under "CC-by-sa", but the author relicensed the final EPUB to
"CC-by-nc-sa" upon publishing.
</para>
</xsl:template>

<!-- Get rid of the revhistory element -->
<xsl:template match="d:revhistory" mode="titlepage.mode" />

</xsl:stylesheet>
2 changes: 1 addition & 1 deletion HHFG/text/epub-build.bash
@@ -1,2 +1,2 @@
#!/bin/bash
ruby -s /home/shlomif/Download/unpack/file/docbook/docbook-xsl-ns-snapshot/epub/bin/dbtoepub -s docbook-epub-preproc.xslt -o human-hacking-field-guide--english.epub human-hacking-field-guide--english.db5.xml
ruby /home/shlomif/Download/unpack/file/docbook/docbook-xsl-ns-snapshot/epub/bin/dbtoepub -s "$(pwd)/docbook-epub-preproc.xslt" -o human-hacking-field-guide--english.epub human-hacking-field-guide--english.db5.xml

0 comments on commit 337ad33

Please sign in to comment.