Refresh our XSL templates to work with current docbook xslt for manpages
authorAlexander Bokovoy <ab@samba.org>
Sun, 6 Apr 2008 20:29:06 +0000 (20:29 +0000)
committerGerald W. Carter <jerry@samba.org>
Wed, 23 Apr 2008 13:47:45 +0000 (08:47 -0500)
(This used to be commit fa20959680ce87b549e4534023ecec399d158b84)

docs/smbdotconf/printing/addportcommand.xml
docs/smbdotconf/security/checkpasswordscript.xml
docs/smbdotconf/vfs/setquotacommand.xml
docs/xslt/expand-sambadoc.xsl
docs/xslt/expand-smbconfdoc.xsl
docs/xslt/man.xsl

index 1ba9a6c063ee64b8a6c86b7de00599216752998c..70957e2bce24724196c994b714856aeaca36faa8 100644 (file)
@@ -4,12 +4,11 @@
                 advanced="1" developer="1"
                  xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
 <description>
-    <para>Samba 3.0.23 introduces support for adding printer ports
+    <para>Samba 3.0.23 introduced support for adding printer ports
        remotely using the Windows &quot;Add Standard TCP/IP Port Wizard&quot;.
        This option defines an external program to be executed when
        smbd receives a request to add a new Port to the system.
-       he script is passed two parameters:
-    </para>
+       he script is passed two parameters:</para>
                
     <itemizedlist>
        <listitem><para><parameter moreinfo="none">port name</parameter></para></listitem>
index 7fe898dfbffc27b0003bb89e0ebd7962c2f48831..9169891c298fae00ec0b897bf4e18ac9772ac029 100644 (file)
@@ -12,7 +12,7 @@
     user will be notified and the password change will fail.</para>
 
     <para>Note: In the example directory there is a sample program called crackcheck
-    that uses cracklib to checkpassword quality</para>.
+    that uses cracklib to checkpassword quality.</para>
 
 </description>
 
index 7c8d15015f5b2d738d3b22c363f2117d81cccdc6..b00a6206286e05258104ed2ebf9b2b733f8e598f 100644 (file)
@@ -24,8 +24,7 @@
                                <listitem><para>2 - user default quotas (uid = -1)</para></listitem>
                                <listitem><para>3 - group quotas</para></listitem>
                                <listitem><para>4 - group default quotas (gid = -1)</para></listitem>
-                       </itemizedlist>
-                       </para></listitem>
+                       </itemizedlist></para></listitem>
                <listitem><para>2 - id (uid for user, gid for group, -1 if N/A)</para></listitem>
                <listitem><para>3 - quota state (0 = disable, 1 = enable, 2 = enable and enforce)</para></listitem>
                <listitem><para>4 - block softlimit</para></listitem>
index 0a6326ef0bef63874adb72b4b5d1fbb3c2c337ca..3e1028189ca1d98f21c294d731457d9e59cd4171 100644 (file)
                </xsl:copy>
        </xsl:template>
 
+       <xsl:template name="smbconfoption">
+               <xsl:param name="name"/>
+               <xsl:param name="content"/>
+               <xsl:variable name="linkcontent">
+                       <xsl:element name="parameter">
+                               <xsl:attribute name="moreinfo">
+                                       <xsl:text>none</xsl:text>
+                               </xsl:attribute>
+                               <xsl:value-of select="$name"/>  
+                       </xsl:element>
+
+                       <xsl:choose>
+                               <xsl:when test="$content != ''">
+                                       <xsl:text> = </xsl:text>
+                                       <xsl:value-of select="$content"/>
+                               </xsl:when>
+                       </xsl:choose>
+               </xsl:variable>
+
+               <xsl:choose>
+                       <xsl:when test="$noreference = 1">
+                               <xsl:value-of select="$linkcontent"/>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:element name="link">
+                                       <xsl:attribute name="linkend">
+                                               <xsl:value-of select="translate(translate(string($name),' ',''),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+                                       </xsl:attribute>
+                                       <xsl:value-of select="$linkcontent"/>
+                               </xsl:element>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+
+       <xsl:template match="related">
+               <xsl:element name="para">
+                       <xsl:text>Related command: </xsl:text>
+                       <xsl:call-template name="smbconfoption">
+                               <xsl:with-param name="name" select="text()"/>
+                       </xsl:call-template>
+               </xsl:element>
+       </xsl:template>
+
        <xsl:template match="smbconfblock/smbconfoption">
                <xsl:element name="member">
-                       <xsl:element name="indexterm">
-                               <xsl:element name="primary">
+                       <xsl:element name="term">
                                        <xsl:value-of select="@name"/>
-                               </xsl:element>
                        </xsl:element>
-                       <xsl:element name="parameter">
-                               <xsl:value-of select="@name"/>
-                               <xsl:choose>
-                                       <xsl:when test="text() != ''">
+                       <xsl:choose>
+                               <xsl:when test="text() != ''">
+                                       <xsl:element name="parameter">
+                                               <xsl:value-of select="@name"/>
                                                <xsl:text> = </xsl:text>
                                                <xsl:value-of select="text()"/>
-                                       </xsl:when>
-                               </xsl:choose>
-                       </xsl:element>
+                                       </xsl:element>
+                               </xsl:when>
+                       </xsl:choose>
                </xsl:element>
        </xsl:template>
 
        </xsl:template>
 
        <xsl:template match="smbconfoption">
-               <!-- Include an index term -->
-               <xsl:element name="indexterm">
-                       <xsl:element name="primary">
-                               <xsl:value-of select="@name"/>
-                       </xsl:element>
-               </xsl:element>
-
-               <xsl:variable name="linkcontent">
-                       <xsl:element name="parameter">
-                               <xsl:attribute name="moreinfo">
-                                       <xsl:text>none</xsl:text>
-                               </xsl:attribute>
-                               <xsl:value-of select="@name"/>  
-                       </xsl:element>
-
-                       <xsl:choose>
-                               <xsl:when test="text() != ''">
-                                       <xsl:text> = </xsl:text>
-                                       <xsl:value-of select="text()"/>
-                               </xsl:when>
-                       </xsl:choose>
-               </xsl:variable>
-
-               <xsl:choose>
-                       <xsl:when test="$noreference = 1">
-                               <xsl:value-of select="$linkcontent"/>
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <xsl:element name="link">
-                                       <xsl:attribute name="linkend">
-                                               <xsl:value-of select="translate(translate(string(@name),' ',''),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
-                                       </xsl:attribute>
-                                       <xsl:value-of select="$linkcontent"/>
-                               </xsl:element>
-                       </xsl:otherwise>
-               </xsl:choose>
+               <xsl:call-template name="smbconfoption">
+                       <xsl:with-param name="name" select="@name"/>
+                       <xsl:with-param name="content"><xsl:copy-of select="text()"/></xsl:with-param>
+               </xsl:call-template>
        </xsl:template>
 
+
        <xsl:template match="smbconfblock">
                <xsl:element name="simplelist">
                        <xsl:apply-templates/>
index 8cad9b832840d15d0ad34727aeebf399ea545094..712a7f4ae15117deda9cdb36883c7f19455a50d1 100644 (file)
@@ -18,7 +18,7 @@
 
        <xsl:template match="synonym"><xsl:apply-templates/></xsl:template>
 
-       <xsl:template match="related"><xsl:apply-templates/></xsl:template>
+       <xsl:template match="related"><xsl:element name="para"><xsl:text>Related command</xsl:text><xsl:apply-templates/></xsl:element></xsl:template>
 
        <xsl:template match="samba:parameterlist">
                <xsl:apply-templates>
index 5232d2ead22b9b8dba5703a74956d8d3a6d1387d..e403122965d986c21d794aa1fdf6c98284404177 100644 (file)
@@ -9,27 +9,6 @@
 <xsl:param name="chunk.first.sections" select="1"/>
 <xsl:param name="use.id.as.filename" select="1"/>
 
-<xsl:template name="string-subst">
-  <xsl:param name="content" select="''"/>
-  <xsl:param name="replace" select="''"/>
-  <xsl:param name="with" select="''"/>
-  <xsl:choose>
-    <xsl:when test="not(contains($content,$replace))">
-      <xsl:value-of select="$content"/>
-    </xsl:when>
-    <xsl:otherwise>
-      <xsl:value-of select="substring-before($content,$replace)"/>
-      <xsl:value-of select="$with"/>
-      <xsl:call-template name="string-subst">
-        <xsl:with-param name="content"
-             select="substring-after($content,$replace)"/>
-        <xsl:with-param name="replace" select="$replace"/>
-        <xsl:with-param name="with" select="$with"/>
-      </xsl:call-template>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
 <!-- 
     Our ulink stylesheet omits @url part if content was specified
 -->
   </xsl:if>
 </xsl:template>
 
-<xsl:template match="refentry">
-
-  <xsl:variable name="section" select="refmeta/manvolnum"/>
-  <xsl:variable name="name" select="refnamediv/refname[1]"/>
-  <xsl:variable name="base.dir" select="$base.dir"/>
-  <!-- standard man page width is 64 chars; 6 chars needed for the two
-       (x) volume numbers, and 2 spaces, leaves 56 -->
-  <xsl:variable name="twidth" select="(74 - string-length(refmeta/refentrytitle)) div 2"/>
-
-  <xsl:variable name="reftitle" 
-               select="substring(refmeta/refentrytitle, 1, $twidth)"/>
-
-  <xsl:variable name="title">
-    <xsl:choose>
-      <xsl:when test="refentryinfo/title">
-        <xsl:value-of select="refentryinfo/title"/>
-      </xsl:when>
-      <xsl:when test="../referenceinfo/title">
-        <xsl:value-of select="../referenceinfo/title"/>
-      </xsl:when>
-    </xsl:choose>
-  </xsl:variable>
-
-  <xsl:variable name="date">
-    <xsl:choose>
-      <xsl:when test="refentryinfo/date">
-        <xsl:value-of select="refentryinfo/date"/>
-      </xsl:when>
-      <xsl:when test="../referenceinfo/date">
-        <xsl:value-of select="../referenceinfo/date"/>
-      </xsl:when>
-    </xsl:choose>
-  </xsl:variable>
-
-  <xsl:variable name="productname">
-    <xsl:choose>
-      <xsl:when test="refentryinfo/productname">
-        <xsl:value-of select="refentryinfo/productname"/>
-      </xsl:when>
-      <xsl:when test="../referenceinfo/productname">
-        <xsl:value-of select="../referenceinfo/productname"/>
-      </xsl:when>
-    </xsl:choose>
-  </xsl:variable>
-
-  <xsl:call-template name="write.text.chunk">
-    <xsl:with-param name="filename"
-                   select="concat($base.dir, normalize-space ($name), '.', $section)"/>
-    <xsl:with-param name="content">
-      <xsl:text>.\"Generated by db2man.xsl. Don't modify this, modify the source.
-.de Sh \" Subsection
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Ip \" List item
-.br
-.ie \\n(.$>=3 .ne \\$3
-.el .ne 3
-.IP "\\$1" \\$2
-..
-.TH "</xsl:text>
-      <xsl:value-of select="translate($reftitle,'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
-      <xsl:text>" </xsl:text>
-      <xsl:value-of select="refmeta/manvolnum[1]"/>
-      <xsl:text> "</xsl:text>
-      <xsl:value-of select="normalize-space($date)"/>
-      <xsl:text>" "</xsl:text>
-      <xsl:value-of select="normalize-space($productname)"/>
-      <xsl:text>" "</xsl:text>
-      <xsl:value-of select="$title"/>
-      <xsl:text>"
-</xsl:text>
-      <xsl:apply-templates/>
-      <xsl:text>&#10;</xsl:text>
-
-      <!-- Author section -->
-      <xsl:choose>
-        <xsl:when test="refentryinfo//author">
-          <xsl:apply-templates select="refentryinfo" mode="authorsect"/>
-        </xsl:when>
-      </xsl:choose>
-    </xsl:with-param>
-  </xsl:call-template>
-</xsl:template>
-
-<xsl:template match="informalexample|screen|programlisting">
-  <xsl:text>&#10;.nf&#10;</xsl:text>
-  <xsl:apply-templates/>
-  <xsl:text>&#10;.fi&#10;</xsl:text>
-</xsl:template>
-
-<xsl:template match="//emphasis">
-  <xsl:text>\fB</xsl:text>
-  <xsl:apply-templates/>
-  <xsl:text>\fR</xsl:text>
-</xsl:template>
-
-<xsl:template match="//quote">
-  <xsl:text>\fB</xsl:text>
-  <xsl:apply-templates/>
-  <xsl:text>\fR</xsl:text>
-</xsl:template>
-
-<xsl:template match="//literal">
-<xsl:variable name="foo">
-  <xsl:apply-templates />
-</xsl:variable>
-  <xsl:call-template name="string-subst">
-    <xsl:with-param name="content" select="$foo" />
-    <xsl:with-param name="replace" select="'\'" />
-    <xsl:with-param name="with" select="'\\'" />
-  </xsl:call-template>
-</xsl:template>
-
 <xsl:template match="itemizedlist/listitem">
-  <xsl:text>\(bu&#10;</xsl:text>
-  <xsl:apply-templates/>
-  <xsl:if test="following-sibling::listitem">
-    <xsl:text>.TP</xsl:text> 
-    <xsl:text>&#10;</xsl:text>
+  <!-- * We output a real bullet here (rather than, "\(bu", -->
+  <!-- * the roff bullet) because, when we do character-map -->
+  <!-- * processing before final output, the character-map will -->
+  <!-- * handle conversion of the &#x2022; to "\(bu" for us -->
+  <xsl:text>&#10;</xsl:text>
+  <xsl:text>.sp</xsl:text>
+  <xsl:text>&#10;</xsl:text>
+  <xsl:text>.RS</xsl:text>
+  <xsl:if test="not($list-indent = '')">
+    <xsl:text> </xsl:text>
+    <xsl:value-of select="$list-indent"/>
   </xsl:if>
-</xsl:template>
-
-
-<xsl:template match="para|simpara|remark" mode="list">
-  <xsl:variable name="foo">
-    <xsl:apply-templates/>
-  </xsl:variable>
-  <xsl:choose match="node()">
-    <!-- Don't normalize-space() for verbatim paragraphs        -->
-    <xsl:when test="informalexample|screen|programlisting">
-      <xsl:value-of select="$foo"/>
+  <xsl:text>&#10;</xsl:text>
+  <!-- * if "n" then we are using "nroff", which means the output is for -->
+  <!-- * TTY; so we do some fixed-width-font hackery with \h to make a -->
+  <!-- * hanging indent (instead of using .IP, which has some -->
+  <!-- * undesirable side effects under certain circumstances) -->
+  <xsl:call-template name="roff-if-else-start"/>
+  <xsl:text>\h'-</xsl:text>
+  <xsl:choose>
+    <xsl:when test="not($list-indent = '')">
+      <xsl:text>0</xsl:text>
+      <xsl:value-of select="$list-indent"/>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:value-of select="normalize-space($foo)"/>
-      <xsl:text>&#10;</xsl:text>
+      <xsl:text>\n(INu</xsl:text>
     </xsl:otherwise>
   </xsl:choose>
-  <xsl:text>&#10;</xsl:text>
-  <xsl:if test="following-sibling::para or following-sibling::simpara or
-               following-sibling::remark">
-    <!-- Make sure multiple paragraphs within a list item don't -->
-    <!-- merge together.                                        -->
+  <xsl:text>'</xsl:text>
+  <xsl:text>&#x2022;</xsl:text>
+  <xsl:text>\h'+</xsl:text>
+  <xsl:choose>
+    <xsl:when test="not($list-indent = '')">
+      <xsl:text>0</xsl:text>
+      <xsl:value-of select="$list-indent - 1"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:text>\n(INu-1</xsl:text>
+    </xsl:otherwise>
+  </xsl:choose>
+  <xsl:text>'\c&#10;</xsl:text>
+  <!-- * else, we are not using for "nroff", but instead "troff" - which -->
+  <!-- * means not for TTY, but for PS or whatever; so we’re not using a -->
+  <!-- * fixed-width font, so use a real .IP instead -->
+  <xsl:call-template name="roff-else"/>
+  <!-- * .IP generates a blank like of space, so let’s go backwards one -->
+  <!-- * line up to compensate for that -->
+  <xsl:text>.sp -1&#10;</xsl:text>
+  <xsl:text>.IP \(bu 2.3&#10;</xsl:text>
+  <!-- * The value 2.3 is the amount of indentation; we use 2.3 instead -->
+  <!-- * of 2 because when the font family is New Century Schoolbook it -->
+  <!-- * seems to require the extra space. -->
+  <xsl:call-template name="roff-if-end"/>
+  <xsl:apply-templates/>
+  <xsl:if test=" following-sibling::listitem">
+        <xsl:text>&#10;.RE&#10;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="itemizedlist|orderedlist|procedure">
+  <xsl:if test="title">
+    <xsl:text>.PP&#10;</xsl:text>
+    <xsl:call-template name="bold">
+      <xsl:with-param name="node" select="title"/>
+      <xsl:with-param name="context" select="."/>
+    </xsl:call-template>
     <xsl:text>&#10;</xsl:text>
   </xsl:if>
+  <!-- * DocBook allows just about any block content to appear in -->
+  <!-- * lists before the actual list items, so we need to get that -->
+  <!-- * content (if any) before getting the list items -->
+  <xsl:apply-templates
+    select="*[not(self::listitem) and not(self::title)]"/>
+  <xsl:apply-templates select="listitem"/>
+  <xsl:if test="(parent::para or parent::listitem) or following-sibling::node()">
+    <xsl:text>.sp&#10;</xsl:text>
+    <xsl:text>.RE&#10;</xsl:text>
+  </xsl:if>
 </xsl:template>
 
 <xsl:template match="refsect3">