]> granicus.if.org Git - docbook-dsssl/commitdiff
Added support for writing man files into a specific output
authorMichael Smith <xmldoc@users.sourceforge.net>
Fri, 14 Apr 2006 04:58:31 +0000 (04:58 +0000)
committerMichael Smith <xmldoc@users.sourceforge.net>
Fri, 14 Apr 2006 04:58:31 +0000 (04:58 +0000)
directory and into appropriate subdirectories within that output
directory. Controlled through the man.base.dir parameter (similar
to the base.dir support in the HTML stylesheet) and the
man.subdirs.enabled parameter, which automatically determines the
name of an appropriate subdir (for example, man/man7, man/man1,
etc.) based on the section number/manvolnum of the source Refentry.

Closes #1255036 and #1170317. Thanks to Denis Bradford for the
original feature request, and to Costin Stroie for submitting a
patch that was very helpful in implementing the support.

xsl/manpages/docbook.xsl
xsl/manpages/utility.xsl

index 755e8f01d62a051c41acc18f02f697e58e37afe1..9c4b42e98b9c6433d379dfd7194b943c2b4d775d 100644 (file)
@@ -37,7 +37,7 @@
   <xsl:include href="links.xsl"/>
   <xsl:include href="table.xsl"/>
 
-  <xsl:param name="generate.manifest">0</xsl:param>
+  <xsl:param name="man.manifest.enabled">0</xsl:param>
   <xsl:param name="man.manifest.filename">MAN.MANIFEST</xsl:param>
   <xsl:param name="man.segtitle.suppress">0</xsl:param>
   <xsl:param name="man.indentation.default.adjust">0</xsl:param>
@@ -47,6 +47,8 @@
   <xsl:param name="man.table.headings.font">B</xsl:param>
   <xsl:param name="man.table.title.font">B</xsl:param>
   <xsl:param name="man.table.footnotes.separator.line">----</xsl:param>
+  <xsl:param name="man.base.dir">man/</xsl:param>
+  <xsl:param name="man.subdirs.enabled" select="1"/>
 
   <!-- ==================================================================== -->
 
@@ -72,8 +74,8 @@
             <!-- * Check to see if we have any refentry children in this -->
             <!-- * document; if so, process them. -->
             <xsl:apply-templates select="//refentry"/>
-            <!-- * if $generate.manifest is non-zero, generate a manifest file -->
-            <xsl:if test="not($generate.manifest = 0)">
+            <!-- * if $man.manifest.enabled is non-zero, generate a manifest file -->
+            <xsl:if test="not($man.manifest.enabled = 0)">
               <xsl:call-template name="generate.manifest">
                 <xsl:with-param name="filename">
                   <xsl:choose>
@@ -86,7 +88,7 @@
                       <!-- * Otherwise, if user has unset -->
                       <!-- * $man.manifest.filename, default to using -->
                       <!-- * "MAN.MANIFEST" as the filename. Because -->
-                      <!-- * $generate.manifest is non-zero and so we -->
+                      <!-- * $man.manifest.enabled is non-zero and so we -->
                       <!-- * must have a filename in order to generate -->
                       <!-- * the manifest. -->
                       <xsl:text>MAN.MANIFEST</xsl:text>
index 28643f455aebfcda722c687333833d3ad8df8f10..20814d925cd03bd1fb9dc3fe7585a38d7caa8187 100644 (file)
 
   <!-- ================================================================== -->
 
-  <!-- * Replace any spaces in $name with underscores & then append -->
-  <!-- * .$section to create a man filename -->
-
   <xsl:template name="make.adjusted.man.filename">
     <xsl:param name="name"/>
     <xsl:param name="section"/>
+    <xsl:param name="dirname">
+      <xsl:choose>
+        <xsl:when test="not($man.subdirs.enabled = 0)">
+          <xsl:value-of
+              select="concat($man.base.dir, 'man', normalize-space($section), '/')"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$man.base.dir"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:param>
     <xsl:call-template name="string.subst">
+      <!-- * Replace any spaces in filename with underscores & then append -->
+      <!-- * a dot plus a section number to create the man filename -->
       <xsl:with-param name="string"
-                      select="concat(normalize-space($name), '.', normalize-space($section))"/>
+                      select="concat($dirname,
+                              normalize-space($name),
+                              '.', normalize-space($section))"/>
       <xsl:with-param name="target" select="' '"/>
       <xsl:with-param name="replacement" select="'_'"/>
     </xsl:call-template>