From 0bdc9f6ae604758a6cf2ed0e635a99b6cca81ebc Mon Sep 17 00:00:00 2001
From: Mark Craig <mark.craig@forgerock.com>
Date: Tue, 19 Jul 2011 15:38:57 +0000
Subject: [PATCH] Attempt to render EPUB less ugly

---
 opendj3/src/main/docbkx-stylesheets/html/chunked.xsl |    1 
 opendj3/src/main/docbkx-stylesheets/html/coredoc.xsl |    2 
 opendj3/src/main/docbkx-stylesheets/epub/coredoc.xsl |   26 ++++++
 opendj3/src/main/resources/css/epub.css              |  152 ++++++++++++++++++++++++++++++++++++++
 opendj3/pom.xml                                      |   19 ++++
 5 files changed, 197 insertions(+), 3 deletions(-)

diff --git a/opendj3/pom.xml b/opendj3/pom.xml
index 7365b52..e1b3d88 100644
--- a/opendj3/pom.xml
+++ b/opendj3/pom.xml
@@ -227,7 +227,6 @@
            </font>
           </fonts>
 
-          <htmlStylesheet>css/coredoc.css</htmlStylesheet>
           <sectionAutolabel>true</sectionAutolabel>
           <sectionLabelIncludesComponentLabel>true</sectionLabelIncludesComponentLabel>
         </configuration>
@@ -240,23 +239,39 @@
             </goals>
             <configuration>
               <epubCustomization>${dbstyle-dir}/epub/coredoc.xsl</epubCustomization>
-              
+              <!-- docbkx-tools does not seem to support multiple embedded
+                   fonts for epub format, missing exslt. -->
+              <epubEmbeddedFonts>DejaVuSans</epubEmbeddedFonts>
               <!-- Resources required but not copied by DocBook.xsl. -->
               <preProcess>
                 <copy todir='${docbkx-out}/epub/admin-guide/OpenDJ-Admin-Guide/images'>
                   <fileset dir='${docbkx-src}/admin-guide/images' />
                 </copy>
+                <copy todir='${docbkx-out}/epub/admin-guide/OpenDJ-Admin-Guide'>
+                  <fileset dir='${basedir}/src/main/resources' />
+                </copy>
                 <copy todir='${docbkx-out}/epub/dev-guide/OpenDJ-Dev-Guide/images'>
                   <fileset dir='${docbkx-src}/dev-guide/images' />
                 </copy>
+                <copy todir='${docbkx-out}/epub/dev-guide/OpenDJ-Dev-Guide'>
+                  <fileset dir='${basedir}/src/main/resources' />
+                </copy>
                 <copy
                   todir='${docbkx-out}/epub/install-guide/OpenDJ-Install-Guide/images'>
                   <fileset dir='${docbkx-src}/install-guide/images' />
                 </copy>
                 <copy
+                  todir='${docbkx-out}/epub/install-guide/OpenDJ-Install-Guide'>
+                  <fileset dir='${basedir}/src/main/resources' />
+                </copy>
+                <copy
                   todir='${docbkx-out}/epub/release-notes/OpenDJ-Release-Notes/images'>
                   <fileset dir='${docbkx-src}/release-notes/images' />
                 </copy>
+                <copy
+                  todir='${docbkx-out}/epub/release-notes/OpenDJ-Release-Notes'>
+                  <fileset dir='${basedir}/src/main/resources' />
+                </copy>
               </preProcess>
             </configuration>
           </execution>
diff --git a/opendj3/src/main/docbkx-stylesheets/epub/coredoc.xsl b/opendj3/src/main/docbkx-stylesheets/epub/coredoc.xsl
index b7afc49..e56756b 100644
--- a/opendj3/src/main/docbkx-stylesheets/epub/coredoc.xsl
+++ b/opendj3/src/main/docbkx-stylesheets/epub/coredoc.xsl
@@ -27,5 +27,29 @@
  version="1.0">
  <xsl:import href="urn:docbkx:stylesheet" />
 
-<!--  <xsl:param name="epub.embedded.fonts">TODO... DejaVuSerif.otf,DejaVuSerif-Italic.otf, etc.</xsl:param> -->
+ <xsl:param name="html.longdesc" select="0" />
+ <xsl:param name="html.stylesheet">css/epub.css</xsl:param>
+ 
+ <xsl:param name="variablelist.term.separator"></xsl:param>
+ <xsl:param name="variablelist.term.break.after">1</xsl:param>
+ <xsl:param name="generate.toc">
+  appendix  nop
+  article/appendix  nop
+  article   nop
+  book      toc,title
+  chapter   nop
+  part      toc,title
+  preface   nop
+  qandadiv  nop
+  qandaset  nop
+  reference toc,title
+  sect1     nop
+  sect2     nop
+  sect3     nop
+  sect4     nop
+  sect5     nop
+  section   nop
+  set       toc,title
+ </xsl:param>
+ <xsl:param name="toc.section.depth" select="0" />
 </xsl:stylesheet>
\ No newline at end of file
diff --git a/opendj3/src/main/docbkx-stylesheets/html/chunked.xsl b/opendj3/src/main/docbkx-stylesheets/html/chunked.xsl
index fe5d166..1eaaeed 100644
--- a/opendj3/src/main/docbkx-stylesheets/html/chunked.xsl
+++ b/opendj3/src/main/docbkx-stylesheets/html/chunked.xsl
@@ -27,6 +27,7 @@
  version="1.0">
  <xsl:import href="urn:docbkx:stylesheet" />
 
+ <xsl:param name="html.stylesheet">css/coredoc.css</xsl:param>
  <xsl:param name="chunk.section.depth" select="0" />
  <xsl:param name="chunker.output.encoding">UTF-8</xsl:param>
  <xsl:param name="chunker.output.indent">yes</xsl:param>
diff --git a/opendj3/src/main/docbkx-stylesheets/html/coredoc.xsl b/opendj3/src/main/docbkx-stylesheets/html/coredoc.xsl
index 4563cab..cba17bc 100644
--- a/opendj3/src/main/docbkx-stylesheets/html/coredoc.xsl
+++ b/opendj3/src/main/docbkx-stylesheets/html/coredoc.xsl
@@ -26,6 +26,8 @@
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0">
  <xsl:import href="urn:docbkx:stylesheet" />
+
+ <xsl:param name="html.stylesheet">css/coredoc.css</xsl:param>
  <xsl:param name="generate.legalnotice.link" select="1" />
  <xsl:param name="root.filename">index</xsl:param>
  <xsl:param name="use.id.as.filename" select="1" />
diff --git a/opendj3/src/main/resources/css/epub.css b/opendj3/src/main/resources/css/epub.css
new file mode 100644
index 0000000..21f0d3a
--- /dev/null
+++ b/opendj3/src/main/resources/css/epub.css
@@ -0,0 +1,152 @@
+/*
+ * CCPL HEADER START
+ *
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-NoDerivs 3.0 Unported License.
+ * To view a copy of this license, visit
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/
+ * or send a letter to Creative Commons, 444 Castro Street,
+ * Suite 900, Mountain View, California, 94041, USA.
+ * 
+ * You can also obtain a copy of the license at
+ * trunk/opendj3/legal-notices/CC-BY-NC-ND.txt.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * If applicable, add the following below this CCPL HEADER, with the fields
+ * enclosed by brackets "[]" replaced with your own identifying information:
+ *     Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CCPL HEADER END
+ *
+ *     Copyright 2011 ForgeRock AS
+ *    
+ */
+
+/*
+ * ForgeRock core documentation styles to be used with EPUB
+ * generated from DocBook 5 XML source.
+ */
+ 
+/*
+ * Basic content and text styles
+ */
+body
+{
+  font-family: DejaVuSans;
+  font-size: small;
+  margin-left: auto;
+  margin-right: auto;
+  color: #333;
+}
+
+a
+{
+  text-decoration: none; /* Do not underline links. */
+}
+
+a:link {
+  color:#47a;
+}
+
+a:visited {
+  color:#68a;
+}
+
+a:active, a:hover {
+  color:#990000;
+}
+
+code,.command>strong,div.literallayout,.filename
+{
+  font-family: monospace;
+}
+
+code,.command,.copyright,div.index,div.literallayout>p,.filename,h3.author,.term,.step
+{
+  font-weight: normal;
+}
+
+h1
+{
+  color: #626D75; /* ForgeRock gray */
+  font-size: x-large;
+}
+
+h2,h3,h4,h5,h6
+{
+  color: #333;
+}
+
+h2
+{
+  font-size: large;
+}
+
+h3
+{
+  font-size: medium;
+}
+
+h4
+{
+  font-size: medium;
+}
+
+h5
+{
+  font-size: medium;
+}
+
+ul
+{
+  list-style-image: url("../images/bulletpoint.png");
+}
+
+/*
+ * Block elements
+ */
+pre.programlisting,pre.screen
+{
+  font-size: xx-small;
+  white-space: pre;
+  background-color: #fafafa;
+  border: thin dashed #ccc;
+  padding: 3px;
+}
+
+div.abstract,div.important,div.caution,div.note,div.tip,div.warning,div.example,div.toc
+{
+  border: thin dotted #ccc;
+  padding: 3px;
+}
+
+div.chapter,div.preface
+{
+  border-bottom: thin solid #ccc; 
+}
+
+.important,.caution,.note,.tip,.warning
+{
+  font-style: italic;
+}
+
+.abstract,.example,.toc
+{
+  margin: 3px;
+}
+
+img
+{
+  max-width: 100%;
+  height: auto;
+  max-height: 100%;
+}
+
+/*
+ * Man pages
+ */
+.refnamediv>h2,.refsect1>h2,.refsynopsisdiv>h2
+{
+  font-size: medium;
+}

--
Gitblit v1.10.0