[PATCH 1/3] docs: newapi.xsl: Generate docs on generic typedefs

Michal Privoznik mprivozn at redhat.com
Wed May 24 16:21:05 UTC 2023


We have plenty of generic typedefs (that basically just alias a
struct, or our popular virXXXPtr). Because we do not generate
HTML docs for it, the documentation is placed at random places,
e.g.: comment from virDomainPtr typedef ("a virDomainPtr is
pointer to a virDomain private structure ...") ends up after
virDomainProcessSignal enum block.

There are some less weird occurrences of this problem (e.g.
virBlkioParameterPtr), but yet - the typedef appears in TOC.

Therefore, generate a block for each typedef and put its
description there.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 docs/newapi.xsl | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/docs/newapi.xsl b/docs/newapi.xsl
index a8797f800d..3ddcc27d96 100644
--- a/docs/newapi.xsl
+++ b/docs/newapi.xsl
@@ -324,6 +324,26 @@
     </div>
   </xsl:template>
 
+  <xsl:template match="typedef">
+    <xsl:variable name="name" select="string(@name)"/>
+    <xsl:variable name="type" select="string(@type)"/>
+    <h3><a id="{$name}"><code><xsl:value-of select="$name"/></code></a></h3>
+    <div class="api">
+      <pre>
+        <span class="keyword">typedef</span><xsl:text> </xsl:text>
+        <xsl:value-of select="$type"/>
+        <xsl:text> </xsl:text>
+        <xsl:value-of select="$name"/>
+        <xsl:text>;</xsl:text>
+      </pre>
+    </div>
+    <div class="description">
+    <xsl:call-template name="formattext">
+      <xsl:with-param name="text" select="info"/>
+    </xsl:call-template>
+    </div>
+  </xsl:template>
+
   <xsl:template match="struct" mode="toc">
     <span class="keyword">typedef</span><xsl:text> </xsl:text>
     <span class="type"><xsl:value-of select="@type"/></span>
-- 
2.39.3



More information about the libvir-list mailing list