]> xenbits.xensource.com Git - libvirt.git/commitdiff
docs: newapi.xsl: Generate docs on generic typedefs
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 24 May 2023 08:22:47 +0000 (10:22 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 25 May 2023 12:22:13 +0000 (14:22 +0200)
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@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
docs/newapi.xsl

index a8797f800da36293ad074bfd3e5ef809c8876456..9e35fe3a60b626cfae0903a777c8fe2cce97bd60 100644 (file)
           </xsl:call-template>
         </span>
        <xsl:text> </xsl:text>
-       <a id="{$name}"><xsl:value-of select="$name"/></a>
+       <a href="#{$name}"><xsl:value-of select="$name"/></a>
        <xsl:text>
 </xsl:text>
       </xsl:otherwise>
     </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>