[PATCH vignatti/wayland/doc 1/2] doc: Split protocol description paragraphs properly

Ander Conselvan de Oliveira ander.conselvan.de.oliveira at intel.com
Fri Oct 12 07:28:56 PDT 2012


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.
---
 doc/Wayland/protocol-to-docbook.xsl |   29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/doc/Wayland/protocol-to-docbook.xsl b/doc/Wayland/protocol-to-docbook.xsl
index be7cba3..b76dbd8 100644
--- a/doc/Wayland/protocol-to-docbook.xsl
+++ b/doc/Wayland/protocol-to-docbook.xsl
@@ -20,6 +20,25 @@
   </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="'

'" />
+     <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>
@@ -93,7 +112,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="arg">
       <variablelist>
         <title><xsl:value-of select="../@name"/>::<xsl:value-of select="@name" /> arguments</title>
-- 
1.7.9.5



More information about the wayland-devel mailing list