doc: Split protocol description paragraphs properly
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Fri, 12 Oct 2012 14:28:56 +0000 (17:28 +0300)
committerKristian Høgsberg <krh@bitplanet.net>
Mon, 15 Oct 2012 17:04:19 +0000 (13:04 -0400)
The xsl translation from the protocol xml to publican would create only
one paragraph for all the text in a description. Make it generate one
paragraph for each block of text separated by two consecutive line
breaks instead.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
doc/Wayland/protocol-to-docbook.xsl

index be7cba3..b76dbd8 100644 (file)
   </appendix>
 </xsl:template>
 
+<!-- Break text blocks separated by two new lines into paragraphs -->
+<xsl:template name="break">
+     <xsl:param name="text" />
+     <xsl:param name="linebreak" select="'&#10;&#10;'" />
+     <xsl:choose>
+       <xsl:when test="contains($text,$linebreak)">
+         <para>
+           <xsl:value-of select="substring-before($text,$linebreak)" />
+         </para>
+         <xsl:call-template name="break">
+           <xsl:with-param name="text" select="substring-after($text,$linebreak)" />
+         </xsl:call-template>
+       </xsl:when>
+       <xsl:otherwise>
+         <para><xsl:value-of select="$text" /></para>
+       </xsl:otherwise>
+     </xsl:choose>
+</xsl:template>
+
 <!-- Copyright blurb -->
 <xsl:template match="copyright">
   <para>
@@ -41,9 +60,9 @@
        - <xsl:value-of select="description/@summary" />
       </xsl:if>
     </title>
-    <para>
-      <xsl:value-of select="description"/>
-    </para>
+    <xsl:call-template name="break">
+      <xsl:with-param name="text" select="description" />
+    </xsl:call-template>
     <xsl:if test="request">
       <section>
         <title>Requests provided by <xsl:value-of select="@name" /></title>
         - <xsl:value-of select="description/@summary" />
       </xsl:if>
     </title>
-    <para><xsl:value-of select="description"/></para>
+    <xsl:call-template name="break">
+      <xsl:with-param name="text" select="description" />
+    </xsl:call-template>
     <xsl:if test="arg">
       <variablelist>
         <title><xsl:value-of select="../@name"/>::<xsl:value-of select="@name" /> arguments</title>