Whamcloud - gitweb
LUDOC-120 webhelp: transform manual to webhelp. 64/18364/7
authorRichard Henwood <richard.henwood@intel.com>
Tue, 9 Feb 2016 16:48:48 +0000 (10:48 -0600)
committerRichard Henwood <richard.henwood@intel.com>
Wed, 23 Mar 2016 18:45:24 +0000 (18:45 +0000)
Webhelp transform included navigation and content indexing. This
change adds support for webhelp including the Lustre Operations
Manual specific decorations for release specific features.

Change-Id: Ic32d8a76a53b3f744df7796288fa898c8c2bbc53
Signed-off-by: Richard Henwood <richard.henwood@intel.com>
Reviewed-on: http://review.whamcloud.com/18364
Tested-by: Jenkins
style/customstyle.xsl
style/customstyle_common.xsl [new file with mode: 0644]
style/customstyle_fo.xsl
style/manual.css
webhelp/webhelp-common.xsl
webhelp/webhelp.xsl

index d54d45f..c8af0c5 100644 (file)
 <xsl:param name="autotoc.label.in.hyperlink" select="1"></xsl:param>
 <xsl:param name="section.label.includes.component.label" select="1"></xsl:param>
 
-<!--  textdecoration_1 applies the style to the text to highlight an region
-               of the documentation refers to a lustre specific version.
 
-               template_{1,2,3} all use the 'condition="{l23,l24}" attributes and add
-               decoration to the rendered version of the manual to show lustre version
-               specific features. -->
+<!-- include our decoration style for Lustre versions. -->
+<xsl:include href='./style/customstyle_common.xsl'/>
 
-<!-- textdecoration_1: a template to apply a div with a class
-               around the relevant sections of text. -->
-<xsl:template name='textdecoration_1'>
-       <xsl:param name='version'/>
-       <xsl:param name='chunkid'/>
-       <div class='versionbox'>
-               <span class='versionlabel'>
-                       <xsl:value-of select='$version'/>
-               </span>
-               <span class='versioncontent'>
-                       <xsl:apply-templates/>
-               </span>
-       </div>
-</xsl:template>
-
-<!-- conditional matching template: this calls text decoration
-     template with the correct variables. -->
 <xsl:template match="*[@condition]">
-       <xsl:variable name="id">
-               <xsl:call-template name="object.id"/>
-       </xsl:variable>
-       <xsl:call-template name='section.titlepage'/>
-       <xsl:choose>
-               <xsl:when test="@condition = 'l21'">
-                       <xsl:call-template name='textdecoration_1'>
-                               <xsl:with-param name='version' select="'Introduced in Lustre 2.1'"/>
-                               <xsl:with-param name='chunkid' select="$id"/>
-                       </xsl:call-template>
-               </xsl:when>
-               <xsl:when test="@condition = 'l22'">
-                       <xsl:call-template name='textdecoration_1'>
-                               <xsl:with-param name='version' select="'Introduced in Lustre 2.2'"/>
-                               <xsl:with-param name='chunkid' select="$id"/>
-                       </xsl:call-template>
-               </xsl:when>
-               <xsl:when test="@condition = 'l23'">
-                       <xsl:call-template name='textdecoration_1'>
-                               <xsl:with-param name='version' select="'Introduced in Lustre 2.3'"/>
-                               <xsl:with-param name='chunkid' select="$id"/>
-                       </xsl:call-template>
-               </xsl:when>
-               <xsl:when test="@condition = 'l24'">
-                       <xsl:call-template name='textdecoration_1'>
-                               <xsl:with-param name='version' select="'Introduced in Lustre 2.4'"/>
-                               <xsl:with-param name='chunkid' select="$id"/>
-                       </xsl:call-template>
-               </xsl:when>
-               <xsl:when test="@condition = 'l25'">
-                       <xsl:call-template name='textdecoration_1'>
-                               <xsl:with-param name='version' select="'Introduced in Lustre 2.5'"/>
-                               <xsl:with-param name='chunkid' select="$id"/>
-                       </xsl:call-template>
-               </xsl:when>
-               <xsl:when test="@condition = 'l26'">
-                       <xsl:call-template name='textdecoration_1'>
-                               <xsl:with-param name='version' select="'Introduced in Lustre 2.6'"/>
-                               <xsl:with-param name='chunkid' select="$id"/>
-                       </xsl:call-template>
-               </xsl:when>
-               <xsl:when test="@condition = 'l27'">
-                       <xsl:call-template name='textdecoration_1'>
-                               <xsl:with-param name='version' select="'Introduced in Lustre 2.7'"/>
-                               <xsl:with-param name='chunkid' select="$id"/>
-                       </xsl:call-template>
-               </xsl:when>
-               <xsl:when test="@condition = 'l28'">
-                       <xsl:call-template name='textdecoration_1'>
-                               <xsl:with-param name='version' select="'Introduced in Lustre 2.8'"/>
-                               <xsl:with-param name='chunkid' select="$id"/>
-                       </xsl:call-template>
-               </xsl:when>
-               <xsl:when test="@condition = 'l29'">
-                       <xsl:call-template name='textdecoration_1'>
-                               <xsl:with-param name='version' select="'Introduced in Lustre 2.9'"/>
-                               <xsl:with-param name='chunkid' select="$id"/>
-                       </xsl:call-template>
-               </xsl:when>
-               <xsl:otherwise>
-                       <xsl:call-template name='textdecoration_1'>
-                               <xsl:with-param name='version' select="'unrecognised Lustre version'"/>
-                               <xsl:with-param name='chunkid' select="$id"/>
-                       </xsl:call-template>
-               </xsl:otherwise>
-       </xsl:choose>
-</xsl:template>
-
-<!-- toc.line template: This template over loads the behavior of creating the table of contents. It
-               adds in a small entry to identify lustre version specific features.
-               for more information, see this page:
-               http://xml.web.cern.ch/XML/www.sagehill.net/xml/docbookxsl/PrintCustomEx.html#PrintTocEntries -->
-<xsl:template name="toc.line">
-       <xsl:param name="toc-context" select="."/>
-       <xsl:param name="depth" select="1"/>
-       <xsl:param name="depth.from.context" select="8"/>
-
-       <span>
-       <xsl:attribute name="class">
-               <xsl:value-of select="local-name(.)"/>
-       </xsl:attribute>
-
-       <!-- * if $autotoc.label.in.hyperlink is zero, then output the label -->
-       <!-- * before the hyperlinked title (as the DSSSL stylesheet does) -->
-       <xsl:if test="$autotoc.label.in.hyperlink = 0">
-               <xsl:variable name="label">
-                       <xsl:apply-templates select="." mode="label.markup"/>
-               </xsl:variable>
-               <xsl:copy-of select="$label"/>
-               <xsl:if test="$label != ''">
-                       <xsl:value-of select="$autotoc.label.separator"/>
-               </xsl:if>
-       </xsl:if>
-
-       <a>
-               <xsl:attribute name="href">
-                       <xsl:call-template name="href.target">
-                               <xsl:with-param name="context" select="$toc-context"/>
-                               <xsl:with-param name="toc-context" select="$toc-context"/>
-                       </xsl:call-template>
-               </xsl:attribute>
+       <xsl:param name="content">
+               <xsl:apply-imports/>
+       </xsl:param>
 
-       <!-- * if $autotoc.label.in.hyperlink is non-zero, then output the label
-                        as part of the hyperlinked title -->
-               <xsl:if test="not($autotoc.label.in.hyperlink = 0)">
-                       <xsl:variable name="label">
-                               <xsl:apply-templates select="." mode="label.markup"/>
-                       </xsl:variable>
-                       <xsl:copy-of select="$label"/>
-                       <xsl:if test="$label != ''">
-                               <xsl:value-of select="$autotoc.label.separator"/>
-                       </xsl:if>
-               </xsl:if>
-               <xsl:apply-templates select="." mode="titleabbrev.markup"/>
-       </a>
-       </span>
-       <!-- add another span to hold the lustre version annotation -->
-       <xsl:if test="@condition='l21'">
-               <span class='floatright'>L 2.1 </span>
-       </xsl:if>
-       <xsl:if test="@condition='l22'">
-               <span class='floatright'>L 2.2 </span>
-       </xsl:if>
-       <xsl:if test="@condition='l23'">
-               <span class='floatright'>L 2.3 </span>
-       </xsl:if>
-       <xsl:if test="@condition='l24'">
-               <span class='floatright'>L 2.4 </span>
-       </xsl:if>
-       <xsl:if test="@condition='l25'">
-               <span class='floatright'>L 2.5 </span>
-       </xsl:if>
-       <xsl:if test="@condition='l26'">
-               <span class='floatright'>L 2.6 </span>
-       </xsl:if>
-       <xsl:if test="@condition='l27'">
-               <span class='floatright'>L 2.7 </span>
-       </xsl:if>
-       <xsl:if test="@condition='l28'">
-               <span class='floatright'>L 2.8 </span>
-       </xsl:if>
-       <xsl:if test="@condition='l29'">
-               <span class='floatright'>L 2.9 </span>
-       </xsl:if>
+       <xsl:call-template name='condition-decorator'>
+               <xsl:with-param name='content' select="$content"/>
+       </xsl:call-template>
 </xsl:template>
 
 </xsl:stylesheet>
diff --git a/style/customstyle_common.xsl b/style/customstyle_common.xsl
new file mode 100644 (file)
index 0000000..6a09b16
--- /dev/null
@@ -0,0 +1,193 @@
+<?xml version='1.0'?>
+<xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
+
+
+<!--  textdecoration-1 applies the style to the text to highlight an region
+               of the documentation refers to a lustre specific version.
+
+               the overall purpose of this custom style is to add 
+               decoration to the rendered version of the manual to show lustre version
+               specific features. This is used in the manual docbook markup by
+               adding a condition='lNM' element to a node. When rendered,
+               the node contents is decorated to indicate it is only available in
+               the N.M version of lustre. -->
+
+<!-- textdecoration-1: a template to apply a div with a class
+               around the relevant sections of text. -->
+<xsl:template name='textdecoration-1'>
+       <xsl:param name='version'/>
+       <xsl:param name='content'/>
+       <div class='versionbox'>
+               <span class='versionlabel'>
+                       <xsl:value-of select='$version'/>
+               </span>
+               <span class='versioncontent'>
+                       <xsl:copy-of select="$content"/>
+               </span>
+       </div>
+</xsl:template>
+
+<!-- conditional matching template: this calls text decoration
+     template with the correct variables. -->
+<xsl:template name="condition-decorator">
+       <xsl:param name='content'/>
+       <xsl:choose>
+               <xsl:when test="@condition = 'l21'">
+                       <xsl:call-template name='textdecoration-1'>
+                               <xsl:with-param name='version' select="'Introduced in Lustre 2.1'"/>
+                               <xsl:with-param name='content' select="$content"/>
+                       </xsl:call-template>
+               </xsl:when>
+               <xsl:when test="@condition = 'l22'">
+                       <xsl:call-template name='textdecoration-1'>
+                               <xsl:with-param name='version' select="'Introduced in Lustre 2.2'"/>
+                               <xsl:with-param name='content' select="$content"/>
+                       </xsl:call-template>
+               </xsl:when>
+               <xsl:when test="@condition = 'l23'">
+                       <xsl:call-template name='textdecoration-1'>
+                               <xsl:with-param name='version' select="'Introduced in Lustre 2.3'"/>
+                               <xsl:with-param name='content' select="$content"/>
+                       </xsl:call-template>
+               </xsl:when>
+               <xsl:when test="@condition = 'l24'">
+                       <xsl:call-template name='textdecoration-1'>
+                               <xsl:with-param name='version' select="'Introduced in Lustre 2.4'"/>
+                               <xsl:with-param name='content' select="$content"/>
+                       </xsl:call-template>
+               </xsl:when>
+               <xsl:when test="@condition = 'l25'">
+                       <xsl:call-template name='textdecoration-1'>
+                               <xsl:with-param name='version' select="'Introduced in Lustre 2.5'"/>
+                               <xsl:with-param name='content' select="$content"/>
+                       </xsl:call-template>
+               </xsl:when>
+               <xsl:when test="@condition = 'l26'">
+                       <xsl:call-template name='textdecoration-1'>
+                               <xsl:with-param name='version' select="'Introduced in Lustre 2.6'"/>
+                               <xsl:with-param name='content' select="$content"/>
+                       </xsl:call-template>
+               </xsl:when>
+               <xsl:when test="@condition = 'l27'">
+                       <xsl:call-template name='textdecoration-1'>
+                               <xsl:with-param name='version' select="'Introduced in Lustre 2.7'"/>
+                               <xsl:with-param name='content' select="$content"/>
+                       </xsl:call-template>
+               </xsl:when>
+               <xsl:when test="@condition = 'l28'">
+                       <xsl:call-template name='textdecoration-1'>
+                               <xsl:with-param name='version' select="'Introduced in Lustre 2.8'"/>
+                               <xsl:with-param name='content' select="$content"/>
+                       </xsl:call-template>
+               </xsl:when>
+               <xsl:when test="@condition = 'l29'">
+                       <xsl:call-template name='textdecoration-1'>
+                               <xsl:with-param name='version' select="'Introduced in Lustre 2.9'"/>
+                               <xsl:with-param name='content' select="$content"/>
+                       </xsl:call-template>
+               </xsl:when>
+               <xsl:when test="@condition != ''">
+                       <xsl:call-template name='textdecoration-1'>
+                               <xsl:with-param name='version' select="'Introduced in Lustre 2.9'"/>
+                               <xsl:with-param name='content' select="$content"/>
+                       </xsl:call-template>
+               </xsl:when>
+               <xsl:otherwise>
+                       <xsl:copy-of select="$content"/>
+               </xsl:otherwise>
+       </xsl:choose>
+</xsl:template>
+
+<!-- toc.line template: This template over loads the behavior of creating the table of contents. It
+               adds in a small entry to identify lustre version specific features.
+               for more information, see this page:
+               http://xml.web.cern.ch/XML/www.sagehill.net/xml/docbookxsl/PrintCustomEx.html#PrintTocEntries -->
+<xsl:template name="toc.line">
+       <xsl:param name="toc-context" select="."/>
+       <xsl:param name="depth" select="1"/>
+       <xsl:param name="depth.from.context" select="8"/>
+
+       <span>
+       <xsl:attribute name="class">
+               <xsl:value-of select="local-name(.)"/>
+       </xsl:attribute>
+
+       <!-- * if $autotoc.label.in.hyperlink is zero, then output the label -->
+       <!-- * before the hyperlinked title (as the DSSSL stylesheet does) -->
+       <xsl:if test="$autotoc.label.in.hyperlink = 0">
+               <xsl:variable name="label">
+                       <xsl:apply-templates select="." mode="label.markup"/>
+               </xsl:variable>
+               <xsl:copy-of select="$label"/>
+               <xsl:if test="$label != ''">
+                       <xsl:value-of select="$autotoc.label.separator"/>
+               </xsl:if>
+       </xsl:if>
+
+       <a>
+               <xsl:attribute name="href">
+                       <xsl:call-template name="href.target">
+                               <xsl:with-param name="context" select="$toc-context"/>
+                               <xsl:with-param name="toc-context" select="$toc-context"/>
+                       </xsl:call-template>
+               </xsl:attribute>
+
+       <!-- * if $autotoc.label.in.hyperlink is non-zero, then output the label
+                        as part of the hyperlinked title -->
+               <xsl:if test="not($autotoc.label.in.hyperlink = 0)">
+                       <xsl:variable name="label">
+                               <xsl:apply-templates select="." mode="label.markup"/>
+                       </xsl:variable>
+                       <xsl:copy-of select="$label"/>
+                       <xsl:if test="$label != ''">
+                               <xsl:value-of select="$autotoc.label.separator"/>
+                       </xsl:if>
+               </xsl:if>
+               <xsl:apply-templates select="." mode="titleabbrev.markup"/>
+       </a>
+       </span>
+       <xsl:call-template name="condition-title">
+               <xsl:with-param name="condition" select="@condition"/>
+       </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="condition-title">
+       <xsl:param name='condition'/>
+       <!-- add another span to hold the lustre version annotation -->
+       <xsl:choose>
+               <xsl:when test="$condition = 'l21'">
+                       <span class='floatright'>L 2.1 </span>
+               </xsl:when>
+               <xsl:when test="$condition = 'l22'">
+                       <span class='floatright'>L 2.2 </span>
+               </xsl:when>
+               <xsl:when test="$condition = 'l23'">
+                       <span class='floatright'>L 2.3 </span>
+               </xsl:when>
+               <xsl:when test="$condition = 'l24'">
+                       <span class='floatright'>L 2.4 </span>
+               </xsl:when>
+               <xsl:when test="$condition = 'l25'">
+                       <span class='floatright'>L 2.5 </span>
+               </xsl:when>
+               <xsl:when test="$condition = 'l26'">
+                       <span class='floatright'>L 2.6 </span>
+               </xsl:when>
+               <xsl:when test="$condition = 'l27'">
+                       <span class='floatright'>L 2.7 </span>
+               </xsl:when>
+               <xsl:when test="$condition = 'l28'">
+                       <span class='floatright'>L 2.8 </span>
+               </xsl:when>
+               <xsl:when test="$condition = 'l29'">
+                       <span class='floatright'>L 2.9 </span>
+               </xsl:when>
+               <xsl:when test="$condition != ''">
+                       <span class='floatright'>L ?.? </span>
+               </xsl:when>
+               <xsl:otherwise>
+               </xsl:otherwise>
+       </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
index 32b5104..87e6d0c 100644 (file)
 <xsl:param name="autotoc.label.in.hyperlink" select="1"></xsl:param>
 <xsl:param name="section.label.includes.component.label" select="1"></xsl:param>
 
+<!-- TODO: ideally generalize customstyle_common.xsl suffeciently
+     so that is can be included in this file. Currently, this file
+        duplicates customerstyle_common.xsl with some minor differences. -->
+
 <!--  textdecoration_1 applies the style to the text to highlight an region
                of the documentation refers to a lustre specific version.
 
index 76501ac..91fdc0c 100644 (file)
@@ -5,6 +5,7 @@ pre.programlisting, pre.screen
 
 div.versionbox {
   border: 1px solid gray;
+  margin-top: 12px;
 }
 
 span.versionlabel {
index cfbda4c..608d24c 100644 (file)
@@ -513,8 +513,10 @@ border: none; background: none; font-weight: none; color: none; }
 
                     <xsl:call-template name="user.header.content"/>
 
-                    <xsl:copy-of select="$content"/>
-
+                                       <xsl:call-template name='condition-decorator'>
+                                               <xsl:with-param name='content' select="$content"/>
+                                       </xsl:call-template>
+                                               
                     <xsl:call-template name="user.footer.content"/>
 
                                        <!-- Redundant since the upper navigation bar always visible -->
@@ -826,6 +828,9 @@ border: none; background: none; font-weight: none; color: none; }
                 <span class="file">
                     <a href="{substring-after($href, $base.dir)}"  tabindex="1">
                         <xsl:value-of select="$title"/>
+                                               <xsl:call-template name="condition-title">
+                               <xsl:with-param name="condition" select="@condition"/>
+                                               </xsl:call-template>
                     </a>
                 </span>
                 <xsl:if test="part|reference|preface|chapter|bibliography|appendix|article|topic|glossary|section|simplesect|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv">
index e075b1b..affc73f 100644 (file)
 <xsl:include href="xhtml/titlepage.templates.xsl"/>
 
 <xsl:param name="webhelp.base.dir">../webhelp-out</xsl:param>
+<xsl:param name="html.stylesheet">../style/manual.css</xsl:param>
+
+<!-- include our decoration style for Lustre versions. -->
+<xsl:include href='../style/customstyle_common.xsl'/>
+
+
+<!-- only match if the node doesn't qualify for chunking, 
+     it does have a 'condition' attribute -->
+<!--xsl:template match='*[not(self::set|self::self::book|self::part|self::preface|self::chapter|self::appendix|self::article|self::topic|self::reference|self::refentry|self::book/glossary|self::article/glossary|self::part/glossary|self::book/bibliography|self::article/bibliography|self::part/bibliography|self::colophon)]@condition]'-->
+<!-- however, I can't get this to work, so instead, I will
+     just select the set that shouldn't find them selves being chunked.
+        This is not the right way to do this, and should be fixed. -->
+
+<xsl:template match="*[self::para|self::glossentry|self::warning|self::note][@condition]">
+    <xsl:param name="content">
+        <xsl:apply-imports/>
+    </xsl:param>
+
+    <xsl:call-template name='condition-decorator'>
+        <xsl:with-param name='content' select="$content"/>
+    </xsl:call-template>
+</xsl:template>
 
 </xsl:stylesheet>