]> granicus.if.org Git - docbook-dsssl/commitdiff
Added support for man.justify, man.hyphenate,
authorMichael Smith <xmldoc@users.sourceforge.net>
Wed, 29 Jun 2005 05:55:34 +0000 (05:55 +0000)
committerMichael Smith <xmldoc@users.sourceforge.net>
Wed, 29 Jun 2005 05:55:34 +0000 (05:55 +0000)
man.break.after.slash, and an.th.title.max.length parameters.
Also switch to using locale-safe "string-upper" function to
uppercase the TH title. So manpages output is now
internationalized/localizable in all respects where is can be made
so at this point.

xsl/manpages/docbook.xsl
xsl/manpages/other.xsl
xsl/manpages/param.ent
xsl/manpages/param.xweb

index f9e71f60084fa2ecc93ef8eff1eb004ed76ea502..b1e86d003dd83de51b0d78c76c066ded69a9f19d 100644 (file)
         <xsl:with-param name="extra3"  select="$metadata/othermetadata"/>
       </xsl:call-template>
       <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
-      <!-- * Now deal with setting default hyphenation and justification -->
+      <!-- * Set default hyphenation, justification, and line-breaking -->
       <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
-      <!-- * -->
-      <!-- * If the value of man.hypenate is zero (the default), then -->
-      <!-- * disable hyphenation (".nh" means "no hyphenation", I guess) -->
-      <xsl:if test="$man.hyphenate = 0">
-        <xsl:text>.nh&#10;</xsl:text>
-      </xsl:if>
-      <!-- * If the value of man.justify is zero (the default), then -->
-      <!-- * disable justification (".ad l" means "adjust to left only" -->
-      <xsl:if test="$man.justify = 0">
-        <xsl:text>.ad l&#10;</xsl:text>
-      </xsl:if>
+      <xsl:call-template name="set.default.formatting"/>
       <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
       <!-- * Main body of man page -->
       <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
index 54f733bb32efc5b98b4e49c94de37ec551fbc491..2988ae35012233cb138631255a8e217867279ce7 100644 (file)
 
      ******************************************************************** -->
 
-<!-- * This file contains named templates for generating content other than -->
-<!-- * what appears in the main text flow of each man page. This "other" -->
-<!-- * stuff currently amounts to: -->
+<!-- * This file contains named templates that are related to things -->
+<!-- * other than just generating the actual text of the main text flow -->
+<!-- * of each man page. This "other" stuff currently amounts to: -->
 <!-- * -->
-<!-- *  - a commented-out section in top part of roff source of each page -->
-<!-- *  - the .TH title line for controlling the page header/footer -->
-<!-- *  - any related "stub" pages (which end up getting read by soelim(1) -->
+<!-- *  - adding a comment to top part of roff source of each page -->
+<!-- *  - making a .TH title line (for controlling page header/footer) -->
+<!-- *  - setting hyphenation, alignment, & line-breaking defaults -->
+<!-- *  - writing any related "stub" pages -->
 
 <!-- ==================================================================== -->
 
     <xsl:param name="extra2"/>
     <xsl:param name="extra3"/>
 
-    <!-- * FIXME: th.title.max.length needs to be made into a documented -->
-    <!-- * user-configurable parameter -->
-    <xsl:variable name="th.title.max.length" select="'20'"/>
-
     <xsl:text>.TH "</xsl:text>
-    <xsl:value-of select="translate(
-                          substring($title, 1, $th.title.max.length),
-                          'abcdefghijklmnopqrstuvwxyz',
-                          'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-                          )"/>
+    <xsl:call-template name="string.upper">
+      <xsl:with-param name="string">
+        <!-- * truncate title if it exceeds max. length (user-configurable) -->
+        <xsl:value-of select="substring($title, 1, $man.th.title.max.length)"/>
+      </xsl:with-param>
+    </xsl:call-template>
     <xsl:text>" </xsl:text>
     <xsl:value-of select="$section"/>
     <xsl:text> "</xsl:text>
 
   <!-- ============================================================== -->
 
+  <xsl:template name="set.default.formatting">
+    <!-- * Set default hyphenation, justification, and line-breaking -->
+    <!-- * -->
+    <!-- * If the value of man.hypenate is zero (the default), then -->
+    <!-- * disable hyphenation (".nh" = "no hyphenation") -->
+    <xsl:if test="$man.hyphenate = 0">
+      <xsl:text>.\" disable hypenation&#10;</xsl:text>
+      <xsl:text>.nh&#10;</xsl:text>
+    </xsl:if>
+    <!-- * If the value of man.justify is zero (the default), then -->
+    <!-- * disable justification (".ad l" means "adjust to left only") -->
+    <xsl:if test="$man.justify = 0">
+      <xsl:text>.\" disable justification</xsl:text>
+      <xsl:text> (adjust text to left margin only)&#10;</xsl:text>
+      <xsl:text>.ad l&#10;</xsl:text>
+    </xsl:if>
+    <!-- * Unless the value of man.break.after.slash is zero (the -->
+    <!-- * default), tell groff that it is OK to break a line -->
+    <!-- * after a slash when needed. -->
+    <xsl:if test="$man.break.after.slash != 0">
+      <xsl:text>.\" enable line breaks after slashes&#10;</xsl:text>
+      <xsl:text>.cflags 4 /&#10;</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- ============================================================== -->
+
   <!-- * A "stub" is sort of alias for another file, intended to be read -->
   <!-- * and expanded by soelim(1); it's simply a file whose complete -->
   <!-- * contents are just a single line of the following form: -->
index bc5f5df9665585d166d28f1578f5d751796468d0..1e98f58ab12b3c9a5e03d257127740894535ba2b 100644 (file)
@@ -1,3 +1,4 @@
+<!ENTITY man.break.after.slash SYSTEM "../params/man.break.after.slash.xml">
 <!ENTITY man.hyphenate SYSTEM "../params/man.hyphenate.xml">
 <!ENTITY man.justify SYSTEM "../params/man.justify.xml">
 <!ENTITY man.output.quietly SYSTEM "../params/man.output.quietly.xml">
@@ -6,4 +7,5 @@
 <!ENTITY man.charmap.enabled SYSTEM "../params/man.charmap.enabled.xml">
 <!ENTITY man.charmap.use.subset SYSTEM "../params/man.charmap.use.subset.xml">
 <!ENTITY man.charmap.subset.profile SYSTEM "../params/man.charmap.subset.profile.xml">
+<!ENTITY man.th.title.max.length SYSTEM "../params/man.th.title.max.length.xml">
 <!ENTITY man.charmap.uri SYSTEM "../params/man.charmap.uri.xml">
\ No newline at end of file
index 15dedbdcecd8110fdea123233a412a640a82857f..bdf2d414375cf60214d53fd0c1792001bc589943 100644 (file)
 
   <reference id="general">
   <title>General</title>
-&man.justify;
+&man.break.after.slash;
 &man.hyphenate;
+&man.justify;
 &man.output.quietly;
 &man.output.encoding;
 &man.string.subst.map;
+&man.th.title.max.length;
   </reference>
   <reference id="charmap">
   <title>Character map</title>
@@ -66,8 +68,9 @@
 
      ******************************************************************** -->
 
-<src:fragref linkend="man.justify.frag"/>
+<src:fragref linkend="man.break.after.slash.frag"/>
 <src:fragref linkend="man.hyphenate.frag"/>
+<src:fragref linkend="man.justify.frag"/>
 <src:fragref linkend="man.output.quietly.frag"/>
 <src:fragref linkend="man.output.encoding.frag"/>
 <src:fragref linkend="man.string.subst.map.frag"/>
@@ -75,6 +78,7 @@
 <src:fragref linkend="man.charmap.uri.frag"/>
 <src:fragref linkend="man.charmap.use.subset.frag"/>
 <src:fragref linkend="man.charmap.subset.profile.frag"/>
+<src:fragref linkend="man.th.title.max.length.frag"/>
 </xsl:stylesheet>
     </src:fragment>