svn commit: r42541 - in projects/db5/share: mk xml xsl

Gabor Kovesdan gabor at FreeBSD.org
Wed Aug 14 22:29:08 UTC 2013


Author: gabor
Date: Wed Aug 14 22:29:07 2013
New Revision: 42541
URL: http://svnweb.freebsd.org/changeset/doc/42541

Log:
  - Improve generated epub file
    * Generate EPUB3
    * Wrap programlistings if necessary
    * Use grey background and smaller fonts for programlistings
    * Justify main text
    * Do not break after table caption

Added:
  projects/db5/share/xml/docbook-epub.css.xml   (contents, props changed)
Modified:
  projects/db5/share/mk/doc.docbook.mk
  projects/db5/share/xsl/freebsd-epub.xsl

Modified: projects/db5/share/mk/doc.docbook.mk
==============================================================================
--- projects/db5/share/mk/doc.docbook.mk	Wed Aug 14 22:21:15 2013	(r42540)
+++ projects/db5/share/mk/doc.docbook.mk	Wed Aug 14 22:29:07 2013	(r42541)
@@ -299,13 +299,12 @@ ${DOC}.html.tar: ${DOC}.html ${LOCAL_IMA
 ${DOC}.epub: ${DOC}.parsed.xml ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG} \
 	${CSS_SHEET}
 	${XSLTPROC} ${XSLTPROCOPTS} ${XSLEPUB} ${DOC}.parsed.xml
-	${ECHO} "application/epub+zip" > mimetype
-	${CP} ${CSS_SHEET} OEBPS/
 .if defined(LOCAL_IMAGES_LIB) || defined(LOCAL_IMAGES_PNG)
-	${CP} ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG} OEBPS/
+.for f in ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG}
+	${CP} ${f} OEBPS/
+.endfor
 .endif
-	${ZIP} ${ZIPOPTS} ${DOC}.epub mimetype
-	${ZIP} ${ZIPOPTS} -Dr ${DOC}.epub OEBPS META-INF
+	${ZIP} ${ZIPOPTS} -r -X ${DOC}.epub mimetype OEBPS META-INF
 
 # TXT --------------------------------------------------------------------
 

Added: projects/db5/share/xml/docbook-epub.css.xml
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/db5/share/xml/docbook-epub.css.xml	Wed Aug 14 22:29:07 2013	(r42541)
@@ -0,0 +1,196 @@
+<?xml version="1.0"?>
+<style>
+
+/********************************/
+/* start of styles in block.xsl */
+
+p {
+  text-align: justify;
+}
+
+.formalpara-title {
+  font-weight: bold;
+}
+
+div.blockquote-title {
+  font-weight: bold;
+  margin-top: 1em;
+  margin-bottom: 1em;
+}
+
+span.msgmain-title {
+  font-weight: bold;
+}
+
+span.msgsub-title {
+  font-weight: bold;
+}
+
+span.msgrel-title {
+  font-weight: bold;
+}
+
+div.msglevel, div.msgorig, div.msgaud {
+  margin-top: 1em;
+  margin-bottom: 1em;
+}
+
+span.msglevel-title, span.msgorig-title, span.msgaud-title {
+  font-weight: bold;
+}
+
+div.msgexplan {
+  margin-top: 1em;
+  margin-bottom: 1em;
+}
+
+span.msgexplan-title {
+  font-weight: bold;
+}
+
+div.sidebar {
+  border: 0.5pt solid black;
+  margin-top: 1em;
+  margin-bottom: 1em;
+  padding: 8px;
+}
+
+/* end of styles in block.xsl */
+/********************************/
+
+/********************************/
+/* start of styles in autotoc.xsl */
+
+/* top level entries */
+nav>ol>li>a {
+  margin-top: 1em;
+  margin-bottom: 1em;
+}
+
+
+/* end of styles in autotoc.xsl */
+/********************************/
+
+/********************************/
+/* start of styles in formal.xsl */
+
+div.figure-title {
+  font-weight: bold;
+}
+
+div.example-title {
+  font-weight: bold;
+}
+
+div.equation-title {
+  font-weight: bold;
+}
+
+div.table-title {
+  font-weight: bold;
+}
+
+div.sidebar-title {
+  font-weight: bold;
+}
+
+
+/* end of styles in formal.xsl */
+/********************************/
+
+/********************************/
+/* start of styles in verbatim.xsl */
+
+.programlisting {
+  white-space: pre-wrap;
+  font-family: monospace;
+  background-color: #d5d2d2;
+  font-size: 85%;
+}
+
+.screen {
+  white-space: pre-wrap;
+  font-family: monospace;
+  background-color: #d5d2d2;
+  font-size: 85%;
+}
+
+.synopsis {
+  white-space: pre-wrap;
+  font-family: monospace;
+  background-color: #d5d2d2;
+}
+
+/* end of styles in verbatim.xsl */
+/********************************/
+
+/********************************/
+/* NAVIGATION */
+
+nav ol {
+  list-style-type: none;
+  margin: 0 0 0 2em;
+  padding: 0 0 0 0;
+}
+
+nav ol li {
+  margin: 0 0 0 0;
+  padding: 0 0 0 0;
+}
+
+nav ol li a {
+  text-decoration: none;
+  color: black;
+  font-family: sans-serif;
+}
+
+#guide {
+  display: none;
+}
+
+div.table {
+  page-break-inside: avoid;
+}
+
+.table-contents {
+  margin: 0px;
+  padding: 0px;
+}
+
+.table-contents table {
+  margin: 0px;
+  padding: 0px;
+  box-shadow: 10px 10px 5px #888888;
+}
+
+.table-contents thead tr td {
+  background-color: #cccccc;
+  border: 1px solid #000000;
+  border-width: 1px 0px 1px 0px;
+  text-align: center;
+  font-size: 90%;
+  font-family: Arial;
+  font-weight: bold;
+  color: #000000;
+}
+
+.table-contents table td {
+  vertical-align: middle;
+  border: 1px solid #000000;
+  border-width: 0px 0px 1px 0px;
+  text-align: left;
+  padding: 7px;
+  font-size: 80%;
+  font-family: Arial;
+  font-weight: normal;
+  color: #000000;
+}
+
+.table-contents table tr.odd {
+  background-color:#e5e5e5;
+}
+
+.table-contents table tr.even {
+  background-color:#ffffff;
+}
+</style>

Modified: projects/db5/share/xsl/freebsd-epub.xsl
==============================================================================
--- projects/db5/share/xsl/freebsd-epub.xsl	Wed Aug 14 22:21:15 2013	(r42540)
+++ projects/db5/share/xsl/freebsd-epub.xsl	Wed Aug 14 22:29:07 2013	(r42541)
@@ -3,14 +3,61 @@
 <!-- $FreeBSD$ -->
 
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		xmlns:str="http://exslt.org/strings"
+		xmlns="http://www.w3.org/1999/xhtml"
+		exclude-result-prefixes="db str"
+		extension-element-prefixes="str"
                 version='1.0'>
 
   <!-- Pull in the base stylesheets -->
-  <xsl:import href="/usr/local/share/xsl/docbook-ns/epub/docbook.xsl"/>
+  <xsl:import href="/usr/local/share/xsl/docbook-ns/epub3/chunk.xsl"/>
 
   <!-- Pull in common XHTML customizations -->
-  <xsl:include href="freebsd-xhtml-common.xsl"/>
+  <xsl:import href="freebsd-xhtml-common.xsl"/>
 
   <xsl:param name="generate.legalnotice.link" select="'1'"/>
+
+  <xsl:param name="docbook.css.source">../xml/docbook-epub.css.xml</xsl:param>
+  <xsl:param name="formal.title.placement">
+figure after
+example before
+equation after
+table before
+procedure before
+  </xsl:param>
+  <xsl:param name="variablelist.term.break.after" select="1"/>
+  <xsl:param name="variablelist.term.separator"/>
+
+  <!--
+	XXX: $docbook.css.source source is interpreted as a relative path
+	when referenced from a template and it should be relative to
+	this stylesheets and not the stock one, so xopy this file here.
+  -->
+  <xsl:template name="generate.default.css.file">
+    <xsl:if test="$make.clean.html != 0 and 
+                  $generate.css.header = 0 and
+                  $docbook.css.source != ''">
+      <!-- Select default file relative to stylesheet -->
+      <xsl:variable name="css.node" select="document($docbook.css.source)/*[1]"/>
+      <xsl:variable name="fname" select="str:tokenize($docbook.css.source, '/')[last()]"/>
+
+      <xsl:call-template name="generate.css.file">
+        <xsl:with-param name="src" select="$fname"/>
+        <xsl:with-param name="css.node" select="$css.node"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="make.css.link">
+    <xsl:param name="css.filename" select="''"/>
+
+    <xsl:variable name="href" select="substring-before(str:tokenize($docbook.css.source, '/')[last()], '.xml')"/>
+
+    <xsl:if test="string-length($css.filename) != 0">
+      <link rel="stylesheet" type="text/css" href="{$href}"/>
+    </xsl:if>
+  </xsl:template>
+
+<xsl:template name="user.footer.navigation"/>
 </xsl:stylesheet>
 


More information about the svn-doc-projects mailing list