HowTos/NewPacket: Some updates
[senf.git] / doclib / html-munge.xsl
index 6bc7038..3229bf7 100644 (file)
@@ -9,7 +9,7 @@
 \r
   <xsl:param name="topdir" select="''"/>\r
   \r
-  <xsl:template match="*">\r
+  <xsl:template match="*" name="copy">\r
     <xsl:copy>\r
       <xsl:call-template name="copy-attributes"/>\r
       <xsl:apply-templates/>\r
     </xsl:for-each>\r
   </xsl:template>\r
 \r
-  <!-- Remove the automatically inserted search form (we build our own) -->\r
-  <xsl:template match="li[form]"> \r
-  </xsl:template>\r
-  \r
-  <!-- Replace @TOPDIR@ with  relative top directory path -->\r
+  <!-- Replace @TOPDIR@ with relative top directory path -->\r
+\r
   <xsl:template match="@*[contains(current(),'@TOPDIR@')]">\r
-    <xsl:value-of select="substring-before(current(),'@TOPDIR')"/>\r
+    <xsl:value-of select="substring-before(current(),'@TOPDIR@')"/>\r
     <xsl:value-of select="$topdir"/>\r
-    <xsl:value-of select="substring-after(current(),'@TOPDIR')"/>\r
+    <xsl:value-of select="substring-after(current(),'@TOPDIR@')"/>\r
   </xsl:template>\r
   \r
   <!-- Add 'class' attribute to some special paragraphs/lists -->\r
     </xsl:copy>\r
   </xsl:template>\r
 \r
+  <!-- Add '<br/>' tag after every ', ' -->\r
+  <!-- This code is not very robust, it works with the doxygen output though -->\r
+\r
+  <xsl:template name="break-comma">\r
+    <xsl:copy>\r
+      <xsl:call-template name="copy-attributes"/>\r
+      <xsl:attribute name="class">commalist</xsl:attribute>\r
+      <xsl:apply-templates mode="break-comma"/>\r
+    </xsl:copy>\r
+  </xsl:template>\r
\r
+  <xsl:template match="text()[1]" mode="break-comma">\r
+    <xsl:value-of select="current()"/><br/>\r
+  </xsl:template>\r
+\r
+  <xsl:template match="*" mode="break-comma">\r
+    <xsl:call-template name="copy"/>\r
+  </xsl:template>\r
+\r
+  <xsl:template match="text()[contains(current(),' and') or contains(current(),'and ')]" mode="break-comma" priority="1">\r
+    <xsl:value-of select="substring-before(current(),'and')"/>\r
+    <br/>\r
+    <xsl:value-of select="substring-after(current(),'and')"/>\r
+  </xsl:template>\r
+\r
+  <xsl:template match="text()[contains(current(),',')]" mode="break-comma">\r
+    <xsl:value-of select="substring-before(current(),',')"/>\r
+    <xsl:text>,</xsl:text><br/>\r
+    <xsl:value-of select="substring-after(current(),',')"/>\r
+  </xsl:template>\r
+\r
+  <!-- ====================================================================== -->\r
+\r
+  <!-- Remove the automatically inserted search form (we build our own) -->\r
+  <xsl:template match="li[form]"> \r
+  </xsl:template>\r
+  \r
   <xsl:template match="dl[dt/b/a/text()='Bug:']">\r
     <xsl:call-template name="add-class">\r
       <xsl:with-param name="class">xref-bug</xsl:with-param>\r
     </xsl:call-template>\r
   </xsl:template>\r
 \r
+  <xsl:template match="p[starts-with(text(),'Inherited by ')]">\r
+    <xsl:call-template name="break-comma"/>\r
+  </xsl:template>\r
+\r
+  <xsl:template match="p[starts-with(text(),'Inherits ')]">\r
+    <xsl:call-template name="break-comma"/>\r
+  </xsl:template>\r
+\r
   <!-- Remove external items from the namespace index -->\r
   <xsl:template match="div[@id='content2']/table[contains(preceding-sibling::h1/text(),'Namespace Reference')]/tr[td[@class='memItemRight']/a[1][@class='elRef'][@doxygen]]">\r
   </xsl:template>\r