← Back to team overview

anewt-developers team mailing list archive

[Branch ~uws/anewt/anewt.uws] Rev 1711: [doc] Improvements to Doxygen XSLT; create valid XHTML

 

------------------------------------------------------------
revno: 1711
committer: Wouter Bolsterlee <uws@xxxxxxxxx>
branch nick: anewt.uws
timestamp: Sun 2009-08-02 12:45:37 +0200
message:
  [doc] Improvements to Doxygen XSLT; create valid XHTML
  
  The XSLT now handles section headings and code listings, and
  no longer produced invalid XHTML (it did before in some
  uncommon cases).
modified:
  doc/manual/assets/style.css
  doc/manual/doxygen.xsl


--
lp:anewt
https://code.launchpad.net/~uws/anewt/anewt.uws

Your team Anewt developers is subscribed to branch lp:anewt.
To unsubscribe from this branch go to https://code.launchpad.net/~uws/anewt/anewt.uws/+edit-subscription.
=== modified file 'doc/manual/assets/style.css'
--- doc/manual/assets/style.css	2009-07-21 18:25:49 +0000
+++ doc/manual/assets/style.css	2009-08-02 10:45:37 +0000
@@ -272,7 +272,9 @@
  font-size: .9em;
 }
 
-div.example pre {
+div.example pre,
+ol.code
+{
  background-color: #d3d7cf;
  border-color: #babdb6;
  border-style: solid;
@@ -283,6 +285,23 @@
  padding: 1em;
 }
 
+ol.code li {
+ margin: 0;
+ padding: 0;
+}
+
+span.code-normal {
+}
+
+span.code-keywordflow {
+ color: #ce5c00;
+}
+
+span.code-stringliteral {
+ color: #2e3436;
+ color: #f57900;
+}
+
 pre span {
  color: yellow; /* Highlight unstyled types for now */
 }

=== modified file 'doc/manual/doxygen.xsl'
--- doc/manual/doxygen.xsl	2009-07-21 18:25:49 +0000
+++ doc/manual/doxygen.xsl	2009-08-02 10:45:37 +0000
@@ -72,10 +72,7 @@
 
 					<h2 id="inheritance">Inheritance</h2>
 
-					<h3>Base Classes</h3>
 					<xsl:call-template name="base-classes" />
-
-					<h3>Inherited members</h3>
 					<xsl:call-template name="inherited-members" />
 
 				</xsl:if>
@@ -203,8 +200,7 @@
 			</xsl:when>
 
 			<xsl:otherwise>
-				<xsl:message>FIXME: unknown sectiondef type</xsl:message>
-				<xsl:text>FIXME: unknown sectiondef type</xsl:text>
+				<xsl:message terminate="yes">FIXME: unknown sectiondef type</xsl:message>
 			</xsl:otherwise>
 		</xsl:choose>
 	</xsl:template>
@@ -310,6 +306,22 @@
 
 	</xsl:template>
 
+	<xsl:template match="sect1">
+		<xsl:apply-templates/>
+	</xsl:template>
+
+	<xsl:template match="sect1/title">
+		<h3><xsl:apply-templates/></h3>
+	</xsl:template>
+
+	<xsl:template match="sect2">
+		<xsl:apply-templates/>
+	</xsl:template>
+
+	<xsl:template match="sect2/title">
+		<h4><xsl:apply-templates/></h4>
+	</xsl:template>
+
 
 	<!-- Parameter listings -->
 
@@ -335,11 +347,11 @@
 	<xsl:template match="para">
 		<xsl:choose>
 
-			<xsl:when test="itemizedlist|parameterlist|simplesect|xrefsect">
+			<xsl:when test="itemizedlist|orderedlist|parameterlist|simplesect|xrefsect|programlisting">
 				<!-- This para has sub-paras -->
 				<xsl:for-each select="*|text()">
 					<xsl:choose>
-						<xsl:when test="name() = 'itemizedlist' or name() = 'parameterlist' or name() = 'simplesect' or name() = 'xrefsect'">
+						<xsl:when test="name() = 'itemizedlist' or name() = 'orderedlist' or name() = 'parameterlist' or name() = 'simplesect' or name() = 'xrefsect' or name() = 'programlisting'">
 							<!-- Process child elements -->
 							<xsl:apply-templates select="."/>
 						</xsl:when>
@@ -365,8 +377,14 @@
 			</xsl:otherwise>
 
 		</xsl:choose>
-
-	</xsl:template>
+	</xsl:template>
+
+	<xsl:template match="bold">
+		<strong><xsl:apply-templates/></strong>
+	</xsl:template>
+
+
+	<!-- Special sections -->
 
 	<xsl:template match="simplesect[@kind='return']">
 		<h4>Return value</h4>
@@ -382,10 +400,17 @@
 		</ul>
 	</xsl:template>
 
+
+	<!-- Links -->
+
+	<xsl:template match="ulink">
+		<a href="{@url}"><xsl:apply-templates/></a>
+	</xsl:template>
+
 	<xsl:template match="para//ref[@kindref='member']">
 		<!-- TODO check for () in node value to check for function/variable -->
 		<code>
-			<a>
+			<a title="{@tooltip}">
 				<xsl:attribute name="href">
 					<xsl:text>#</xsl:text>
 					<xsl:call-template name="build-string-id">
@@ -399,7 +424,7 @@
 
 	<xsl:template match="para//ref[@kindref='compound']">
 		<code>
-			<a>
+			<a title="{@tooltip}">
 				<xsl:attribute name="href">
 					<xsl:text>class-</xsl:text>
 					<xsl:value-of select="."/>
@@ -410,44 +435,74 @@
 		</code>
 	</xsl:template>
 
+
+	<!-- Lists -->
+
 	<xsl:template match="itemizedlist">
 		<ul>
-			<xsl:for-each select="listitem">
-				<li>
-					<xsl:apply-templates/>
-				</li>
-			</xsl:for-each>
+			<xsl:apply-templates/>
 		</ul>
 	</xsl:template>
 
 	<xsl:template match="orderedlist">
 		<ol>
-			<xsl:for-each select="listitem">
-				<li>
-					<xsl:apply-templates/>
-				</li>
-			</xsl:for-each>
+			<xsl:apply-templates/>
 		</ol>
 	</xsl:template>
 
+	<xsl:template match="listitem">
+		<li>
+			<xsl:choose>
+				<xsl:when test="count(para) = 1">
+					<!-- Single paragraph -->
+					<xsl:apply-templates select="para/*|para/text()"/>
+				</xsl:when>
+				<xsl:otherwise>
+					<!-- Multiple paragraphs -->
+					<xsl:apply-templates/>
+				</xsl:otherwise>
+			</xsl:choose>
+		</li>
+	</xsl:template>
+
+	<xsl:template match="argsstring|inbodydescription|location">
+		<xsl:apply-templates/>
+	</xsl:template>
+
+	<xsl:template match="memberdef/type|memberdef/definition|memberdef/name|memberdef/argsstring">
+		<xsl:apply-templates/>
+	</xsl:template>
+
+	<!-- Code snippets -->
+
 	<xsl:template match="computeroutput">
 		<code><xsl:apply-templates/></code>
 	</xsl:template>
 
-	<xsl:template match="bold">
-		<strong><xsl:apply-templates/></strong>
-	</xsl:template>
-
-	<xsl:template match="argsstring|inbodydescription|location">
-		<xsl:apply-templates/>
-	</xsl:template>
-
-	<xsl:template match="memberdef/type|memberdef/definition|memberdef/name|memberdef/argsstring">
-		<xsl:apply-templates/>
-	</xsl:template>
-
-	<xsl:template match="ulink">
-		<a href="{@url}"><xsl:apply-templates/></a>
+	<xsl:template match="programlisting">
+		<div class="example">
+			<ol class="code">
+				<xsl:apply-templates/>
+			</ol>
+		</div>
+	</xsl:template>
+
+	<xsl:template match="programlisting/codeline">
+		<li>
+			<code>
+				<xsl:apply-templates/>
+			</code>
+		</li>
+	</xsl:template>
+
+	<xsl:template match="programlisting//highlight">
+		<span class="code-{@class}">
+			<xsl:apply-templates/>
+		</span>
+	</xsl:template>
+
+	<xsl:template match="programlisting//sp">
+		<xsl:text>&#160;</xsl:text>
 	</xsl:template>
 
 
@@ -462,6 +517,7 @@
 
 	<xsl:template name="base-classes">
 		<xsl:variable name="current-member-node" select="//inheritancegraph/node[link[@refid=//compounddef/@id]]"/>
+		<h3>Base Classes</h3>
 		<ul>
 			<xsl:apply-templates select="$current-member-node" mode="child"/>
 		</ul>
@@ -492,54 +548,59 @@
 	</xsl:template>
 
 	<xsl:template name="inherited-members">
-		<ul>
-			<xsl:for-each select="//listofallmembers/member[not(@refid = key('members-by-id', @refid)/@id)]">
-				<xsl:sort select="@refid"/>
-				<xsl:variable name="class" select="substring-after(substring(@refid, 0, string-length(@refid) - 33), 'class')"/>
-				<li>
-					<a>
-						<xsl:attribute name="href">
-							<xsl:text>class-</xsl:text>
-							<xsl:value-of select="$class"/>
-							<xsl:text>.html</xsl:text>
-							<xsl:choose>
-								<xsl:when test="starts-with(name, '$')">
-									<xsl:text>#variable-</xsl:text>
-									<xsl:call-template name="build-string-id">
-										<xsl:with-param name="content" select="exsl:node-set(substring-after(name, '$'))"/>
-									</xsl:call-template>
-								</xsl:when>
-								<xsl:otherwise>
-									<xsl:text>#function-</xsl:text>
-									<xsl:call-template name="build-string-id">
-										<xsl:with-param name="content" select="name"/>
-									</xsl:call-template>
-								</xsl:otherwise>
-							</xsl:choose>
-						</xsl:attribute>
-						<xsl:attribute name="title">
-							<xsl:text>Inherited from </xsl:text>
-							<xsl:value-of select="$class"/>
-						</xsl:attribute>
-						<code>
-							<xsl:value-of select="$class"/>
-							<xsl:text>::</xsl:text>
-							<xsl:value-of select="name"/>
-							<xsl:if test="not(starts-with(name, '$'))">
-								<xsl:text>()</xsl:text>
-							</xsl:if>
-						</code>
-					</a>
-				</li>
-			</xsl:for-each>
-		</ul>
+		<xsl:variable name="members" select="//listofallmembers/member[not(@refid = key('members-by-id', @refid)/@id)]"/>
+
+		<xsl:if test="$members">
+			<h3>Inherited members</h3>
+			<ul>
+				<xsl:for-each select="$members">
+					<xsl:sort select="@refid"/>
+					<xsl:variable name="class" select="substring-after(substring(@refid, 0, string-length(@refid) - 33), 'class')"/>
+					<li>
+						<a>
+							<xsl:attribute name="href">
+								<xsl:text>class-</xsl:text>
+								<xsl:value-of select="$class"/>
+								<xsl:text>.html</xsl:text>
+								<xsl:choose>
+									<xsl:when test="starts-with(name, '$')">
+										<xsl:text>#variable-</xsl:text>
+										<xsl:call-template name="build-string-id">
+											<xsl:with-param name="content" select="exsl:node-set(substring-after(name, '$'))"/>
+										</xsl:call-template>
+									</xsl:when>
+									<xsl:otherwise>
+										<xsl:text>#function-</xsl:text>
+										<xsl:call-template name="build-string-id">
+											<xsl:with-param name="content" select="name"/>
+										</xsl:call-template>
+									</xsl:otherwise>
+								</xsl:choose>
+							</xsl:attribute>
+							<xsl:attribute name="title">
+								<xsl:text>Inherited from </xsl:text>
+								<xsl:value-of select="$class"/>
+							</xsl:attribute>
+							<code>
+								<xsl:value-of select="$class"/>
+								<xsl:text>::</xsl:text>
+								<xsl:value-of select="name"/>
+								<xsl:if test="not(starts-with(name, '$'))">
+									<xsl:text>()</xsl:text>
+								</xsl:if>
+							</code>
+						</a>
+					</li>
+				</xsl:for-each>
+			</ul>
+		</xsl:if>
 	</xsl:template>
 
 
 	<!-- Output FIXME for unhandled nodes -->
 
 	<xsl:template match="*">
-		<xsl:message>FIXME: <xsl:value-of select="name()"/></xsl:message>
+		<xsl:message terminate="yes">FIXME: <xsl:value-of select="name()"/></xsl:message>
 		FIXME: &lt;<xsl:value-of select="name()"/>&gt;<xsl:apply-templates/>&lt;/<xsl:value-of select="name()"/>&gt;
 	</xsl:template>
 
@@ -552,8 +613,7 @@
 				<xsl:when test="@kind='return'">Returns:</xsl:when>
 				<xsl:when test="@kind='see'">See also:</xsl:when>
 				<xsl:otherwise>
-					<xsl:message>FIXME: unknown simplesect kind</xsl:message>
-					FIXME: unknown simplesect kind
+					<xsl:message terminate="yes">FIXME: unknown simplesect kind</xsl:message>
 				</xsl:otherwise>
 			</xsl:choose>
 		</p>
@@ -573,5 +633,4 @@
 		<xsl:apply-templates/>
 	</xsl:template>
 
-
 </xsl:stylesheet>