From be345187c1ebcc44c69c1ab3051686e4ff09664e Mon Sep 17 00:00:00 2001
From: Mark Craig <mark.craig@forgerock.com>
Date: Wed, 08 Jun 2011 16:39:12 +0000
Subject: [PATCH] Fix OPENDJ-195: Add chunked HTML (1 page/chapter) as an alternative to 1 page/book

---
 opendj3/src/main/docbkx-stylesheets/html/chunked.xsl |   56 +++++++++++
 opendj3/src/site/xdoc/docs.xml                       |   12 +
 opendj3/pom.xml                                      |  211 ++++++++++++++++++++++++++++-------------
 3 files changed, 207 insertions(+), 72 deletions(-)

diff --git a/opendj3/pom.xml b/opendj3/pom.xml
index 2338925..026f3bd 100644
--- a/opendj3/pom.xml
+++ b/opendj3/pom.xml
@@ -102,7 +102,7 @@
     <dbstyle-dir>${basedir}/src/main/docbkx-stylesheets</dbstyle-dir>
     <docbkx-out>${basedir}/target/docbkx</docbkx-out>
     <site-out>${basedir}/target/site</site-out>
-    <legalnotice>${docbkx-out}/html/legalnotice.html</legalnotice>
+    <legalnotice>${basedir}/target/docbkx/html/legalnotice.html</legalnotice>
   </properties>
   <build>
     <plugins>
@@ -111,72 +111,95 @@
         <artifactId>docbkx-maven-plugin</artifactId>
         <version>2.0.13</version>
         <inherited>false</inherited>
+        <configuration>
+          <sourceDirectory>${basedir}/src/main/docbkx</sourceDirectory>
+          <!-- Comment the draft elements out for final build -->
+          <draftMode>yes</draftMode>
+          <draftWatermarkImage>http://docbook.sourceforge.net/release/images/draft.png</draftWatermarkImage>
+
+          <includes>*/OpenDJ-*.xml</includes>
+          <xincludeSupported>true</xincludeSupported>
+
+          <htmlStylesheet>css/coredoc.css</htmlStylesheet>
+        </configuration>
         <executions>
           <execution>
-            <id>build-doc</id>
+            <id>doc-epub</id>
             <phase>pre-site</phase>
             <goals>
               <goal>generate-epub</goal>
-              <goal>generate-html</goal>
-              <goal>generate-pdf</goal>
-              <goal>generate-rtf</goal>
-              <goal>generate-manpages</goal>
             </goals>
             <configuration>
-              <sourceDirectory>${basedir}/src/main/docbkx</sourceDirectory>
-       <!-- Comment the draft elements out for final build -->
-              <draftMode>yes</draftMode>
-              <draftWatermarkImage>http://docbook.sourceforge.net/release/images/draft.png</draftWatermarkImage>
-
-              <includes>*/OpenDJ-*.xml</includes>
-              <xincludeSupported>true</xincludeSupported>
-
-       <!-- EPUB -->
               <epubCustomization>${dbstyle-dir}/epub/coredoc.xsl</epubCustomization>
-       
-       <!-- HTML -->
-              <chunkedOutput>false</chunkedOutput>
-              <htmlCustomization>${dbstyle-dir}/html/coredoc.xsl</htmlCustomization>
-              <htmlStylesheet>css/coredoc.css</htmlStylesheet>
-       
-       <!-- PDF, RTF -->
-              <foCustomization>${dbstyle-dir}/fo/coredoc.xsl</foCustomization>
-
-       <!-- Resources required but not copied by DocBook.xsl.
-            TODO: Figure out how to say foreach in ant. -->
+              
+              <!-- 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/dev-guide/OpenDJ-Dev-Guide/images'>
+                  <fileset dir='${docbkx-src}/dev-guide/images' />
+                </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/release-notes/OpenDJ-Release-Notes/images'>
+                  <fileset dir='${docbkx-src}/release-notes/images' />
+                </copy>
+              </preProcess>
+            </configuration>
+          </execution>
+          <execution>
+            <id>doc-fo</id>
+            <phase>pre-site</phase>
+            <goals>
+              <goal>generate-pdf</goal>
+              <goal>generate-rtf</goal>
+            </goals>
+            <configuration>
+              <foCustomization>${dbstyle-dir}/fo/coredoc.xsl</foCustomization>
+            </configuration>
+          </execution>
+          <execution>
+            <id>doc-manpages</id>
+            <phase>pre-site</phase>
+            <goals>
+              <goal>generate-manpages</goal>
+            </goals>
+            <configuration><!-- Nothing specific, yet. --></configuration>
+          </execution>
+          <execution>
+            <id>doc-single-html</id>
+            <phase>pre-site</phase>
+            <goals>
+              <goal>generate-html</goal>
+            </goals>
+            <configuration>
+              <chunkedOutput>false</chunkedOutput>
+              <htmlCustomization>${dbstyle-dir}/html/coredoc.xsl</htmlCustomization>
+
+              <!-- Resources required but not copied by DocBook.xsl. -->
+              <preProcess>
                 <copy todir='${docbkx-out}/html/admin-guide/images'>
                   <fileset dir='${docbkx-src}/admin-guide/images' />
                 </copy>
                 <copy todir='${docbkx-out}/html/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}/html/dev-guide/images'>
                   <fileset dir='${docbkx-src}/dev-guide/images' />
                 </copy>
                 <copy todir='${docbkx-out}/html/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}/html/install-guide/images'>
                   <fileset dir='${docbkx-src}/install-guide/images' />
                 </copy>
                 <copy todir='${docbkx-out}/html/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}/html/release-notes/images'>
                   <fileset dir='${docbkx-src}/release-notes/images' />
                 </copy>
@@ -184,6 +207,74 @@
                   <fileset dir='${basedir}/src/main/resources' />
                 </copy>
               </preProcess>
+              
+              <postProcess>
+                <copy file='${legalnotice}' todir='${docbkx-out}/html/admin-guide' />
+                <copy file='${legalnotice}' todir='${docbkx-out}/html/dev-guide' />
+                <copy file='${legalnotice}' todir='${docbkx-out}/html/install-guide' />
+                <copy file='${legalnotice}' todir='${docbkx-out}/html/release-notes' />
+                <replace
+                  dir="${basedir}/target/docbkx/html/"
+                  token="target/docbkx/html/legalnotice.html"
+                  value="legalnotice.html">
+                  <include name="**/**/*.html" />
+                </replace>              
+              </postProcess>
+            </configuration>
+          </execution>
+          <execution>
+            <id>chunked-html</id>
+            <phase>pre-site</phase>
+            <goals>
+              <goal>generate-html</goal>
+            </goals>
+            <configuration>
+              <chunkedOutput>true</chunkedOutput>
+              <htmlCustomization>${dbstyle-dir}/html/chunked.xsl</htmlCustomization>
+              
+              <preProcess>
+                <copy todir='${docbkx-out}/html/admin-guide/OpenDJ-Admin-Guide/images'>
+                  <fileset dir='${docbkx-src}/admin-guide/images' />
+                </copy>
+                <copy todir='${docbkx-out}/html/admin-guide/OpenDJ-Admin-Guide'>
+                  <fileset dir='${basedir}/src/main/resources' />
+                </copy>
+                <copy todir='${docbkx-out}/html/dev-guide/OpenDJ-Dev-Guide/images'>
+                  <fileset dir='${docbkx-src}/dev-guide/images' />
+                </copy>
+                <copy todir='${docbkx-out}/html/dev-guide/OpenDJ-Dev-Guide'>
+                  <fileset dir='${basedir}/src/main/resources' />
+                </copy>
+                <copy todir='${docbkx-out}/html/install-guide/OpenDJ-Install-Guide/images'>
+                  <fileset dir='${docbkx-src}/install-guide/images' />
+                </copy>
+                <copy todir='${docbkx-out}/html/install-guide/OpenDJ-Install-Guide'>
+                  <fileset dir='${basedir}/src/main/resources' />
+                </copy>
+                <copy todir='${docbkx-out}/html/release-notes/OpenDJ-Release-Notes/images'>
+                  <fileset dir='${docbkx-src}/release-notes/images' />
+                </copy>
+                <copy todir='${docbkx-out}/html/release-notes/OpenDJ-Release-Notes'>
+                  <fileset dir='${basedir}/src/main/resources' />
+                </copy>
+              </preProcess>
+
+              <postProcess>
+                <copy file='${legalnotice}'
+                  todir='${docbkx-out}/html/admin-guide/OpenDJ-Admin-Guide' />
+                <copy file='${legalnotice}'
+                  todir='${docbkx-out}/html/dev-guide/OpenDJ-Dev-Guide' />
+                <copy file='${legalnotice}'
+                  todir='${docbkx-out}/html/install-guide/OpenDJ-Install-Guide' />
+                <copy file='${legalnotice}'
+                  todir='${docbkx-out}/html/release-notes/OpenDJ-Release-Notes' />
+                <replace
+                  dir="${basedir}/target/docbkx/html/"
+                  token="target/docbkx/html/legalnotice.html"
+                  value="legalnotice.html">
+                  <include name="**/**/**/*.html" />
+                </replace>
+              </postProcess>
             </configuration>
           </execution>
         </executions>
@@ -205,37 +296,6 @@
         </dependencies>
       </plugin>
       <plugin>
-        <artifactId>maven-antrun-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>fix-legalnotice</id>
-            <phase>site</phase>
-            <inherited>false</inherited>
-            <goals>
-              <goal>run</goal>
-            </goals>
-            <configuration>
-              <detail>true</detail>
-              <target>
-        <!-- TODO: Figure out how to say foreach in ant. -->
-                <copy file='${legalnotice}' todir='${basedir}/target/docbkx/html/admin-guide' />
-                <copy file='${legalnotice}' todir='${basedir}/target/docbkx/html/dev-guide' />
-                <copy file='${legalnotice}' todir='${basedir}/target/docbkx/html/install-guide' />
-                <copy file='${legalnotice}' todir='${basedir}/target/docbkx/html/release-notes' />
-              </target>
-              <target>
-                <replace
-                  dir="${basedir}/target/docbkx/html/"
-                  token="target/docbkx/html/legalnotice.html"
-                  value="legalnotice.html">
-                  <include name="**/**/*.html" />
-                </replace>
-              </target>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-resources-plugin</artifactId>
         <inherited>false</inherited>
@@ -250,8 +310,23 @@
               <resources>
                 <resource>
                   <directory>${docbkx-out}/epub/admin-guide</directory>
+                  <includes>
+                    <include>**/*.epub</include>
+                  </includes>
+                </resource>
+                <resource>
                   <directory>${docbkx-out}/epub/dev-guide</directory>
+                  <includes>
+                    <include>**/*.epub</include>
+                  </includes>
+                </resource>
+                <resource>
                   <directory>${docbkx-out}/epub/install-guide</directory>
+                  <includes>
+                    <include>**/*.epub</include>
+                  </includes>
+                </resource>
+                <resource>
                   <directory>${docbkx-out}/epub/release-notes</directory>
                   <includes>
                     <include>**/*.epub</include>
diff --git a/opendj3/src/main/docbkx-stylesheets/html/chunked.xsl b/opendj3/src/main/docbkx-stylesheets/html/chunked.xsl
new file mode 100644
index 0000000..97da16f
--- /dev/null
+++ b/opendj3/src/main/docbkx-stylesheets/html/chunked.xsl
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ! 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
+  !    
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0">
+ <xsl:import href="urn:docbkx:stylesheet" />
+
+ <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>
+ <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" />
+ <xsl:param name="generate.toc">
+  appendix  nop
+  article/appendix  nop
+  article   nop
+  book      toc,title,figure,table,example,equation
+  chapter   nop
+  part      toc,title
+  preface   nop
+  qandadiv  nop
+  qandaset  nop
+  reference nop
+  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/site/xdoc/docs.xml b/opendj3/src/site/xdoc/docs.xml
index fc12db7..150b2a1 100644
--- a/opendj3/src/site/xdoc/docs.xml
+++ b/opendj3/src/site/xdoc/docs.xml
@@ -37,25 +37,29 @@
    <dl>
     <dt>Release Notes</dt>
     <dd><a href="./doc/OpenDJ-Release-Notes.epub">EPUB</a>,
-    <a href="./doc/release-notes/OpenDJ-Release-Notes.html">HTML</a>,
+    <a href="./doc/release-notes/OpenDJ-Release-Notes.html">HTML (single page)</a>,
+    <a href="./doc/release-notes/OpenDJ-Release-Notes/OpenDJ-Release-Notes.html">HTML (1 page/chapter)</a>,
     <a href="./doc/OpenDJ-Release-Notes.pdf">PDF</a>,
     <a href="./doc/OpenDJ-Release-Notes.rtf">RTF</a></dd>
 
     <dt>Installation Guide</dt>
     <dd><a href="./doc/OpenDJ-Install-Guide.epub">EPUB</a>,
-    <a href="./doc/install-guide/OpenDJ-Install-Guide.html">HTML</a>,
+    <a href="./doc/install-guide/OpenDJ-Install-Guide.html">HTML (single page)</a>,
+    <a href="./doc/install-guide/OpenDJ-Install-Guide/OpenDJ-Install-Guide.html">HTML (1 page/chapter)</a>,
     <a href="./doc/OpenDJ-Install-Guide.pdf">PDF</a>,
     <a href="./doc/OpenDJ-Install-Guide.rtf">RTF</a></dd>
 
     <dt>Administration Guide</dt>
     <dd><a href="./doc/OpenDJ-Admin-Guide.epub">EPUB</a>,
-    <a href="./doc/admin-guide/OpenDJ-Admin-Guide.html">HTML</a>,
+    <a href="./doc/admin-guide/OpenDJ-Admin-Guide.html">HTML (single page)</a>,
+    <a href="./doc/admin-guide/OpenDJ-Admin-Guide/OpenDJ-Admin-Guide.html">HTML (1 page/chapter)</a>,
     <a href="./doc/OpenDJ-Admin-Guide.pdf">PDF</a>,
     <a href="./doc/OpenDJ-Admin-Guide.rtf">RTF</a></dd>
 
     <dt>Developer Guide</dt>
     <dd><a href="./doc/OpenDJ-Dev-Guide.epub">EPUB</a>,
-    <a href="./doc/dev-guide/OpenDJ-Dev-Guide.html">HTML</a>,
+    <a href="./doc/dev-guide/OpenDJ-Dev-Guide.html">HTML (single page)</a>,
+    <a href="./doc/dev-guide/OpenDJ-Dev-Guide/OpenDJ-Dev-Guide.html">HTML (1 page/chapter)</a>,
     <a href="./doc/OpenDJ-Dev-Guide.pdf">PDF</a>,
     <a href="./doc/OpenDJ-Dev-Guide.rtf">RTF</a></dd>
 

--
Gitblit v1.10.0