mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
docs: newapi: Avoid empty <div>s when there is no description
The various objects we generate API for may have empty description in which case an empty div would be generated when processing the API description. As we're using XML output mode the generator would shorten such divs to the non-pair empty element version, which doesn't work well with HTML5 parsers requiring a pair tag for <div> Avoid empty description <div> elements altogether by skipping it if the description is empty. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
3a0af92df6
commit
47a8ff9979
@ -222,6 +222,19 @@
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="formattextdiv">
|
||||
<xsl:param name="text"/>
|
||||
<xsl:param name="divclass"/>
|
||||
|
||||
<xsl:if test="$text">
|
||||
<div class="{$divclass}">
|
||||
<xsl:call-template name="formattext">
|
||||
<xsl:with-param name="text" select="$text"/>
|
||||
</xsl:call-template>
|
||||
</div>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="macro" mode="toc">
|
||||
<span class="directive">#define</span><xsl:text> </xsl:text>
|
||||
<a href="#{@name}"><xsl:value-of select="@name"/></a>
|
||||
@ -287,11 +300,10 @@
|
||||
<xsl:template match="typedef[@type = 'enum']">
|
||||
<xsl:variable name="name" select="string(@name)"/>
|
||||
<h3><a id="{$name}"><code><xsl:value-of select="$name"/></code></a></h3>
|
||||
<div class="description">
|
||||
<xsl:call-template name="formattext">
|
||||
<xsl:call-template name="formattextdiv">
|
||||
<xsl:with-param name="text" select="info"/>
|
||||
<xsl:with-param name="divclass">description</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</div>
|
||||
<div class="api">
|
||||
<pre>
|
||||
<span class="keyword">enum</span><xsl:text> </xsl:text>
|
||||
@ -343,11 +355,10 @@
|
||||
<xsl:text>;</xsl:text>
|
||||
</pre>
|
||||
</div>
|
||||
<div class="description">
|
||||
<xsl:call-template name="formattext">
|
||||
<xsl:call-template name="formattextdiv">
|
||||
<xsl:with-param name="text" select="info"/>
|
||||
<xsl:with-param name="divclass">description</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="struct" mode="toc">
|
||||
@ -452,11 +463,11 @@
|
||||
<xsl:variable name="name" select="string(@name)"/>
|
||||
<h3><a id="{$name}"><code><xsl:value-of select="$name"/></code></a></h3>
|
||||
<pre class="api"><span class="directive">#define</span><xsl:text> </xsl:text><xsl:value-of select="$name"/></pre>
|
||||
<div class="description">
|
||||
<xsl:call-template name="formattext">
|
||||
<xsl:call-template name="formattextdiv">
|
||||
<xsl:with-param name="text" select="info"/>
|
||||
<xsl:with-param name="divclass">description</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</div><xsl:text>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
@ -604,11 +615,10 @@
|
||||
<xsl:text>)
|
||||
</xsl:text>
|
||||
</pre>
|
||||
<div class="description">
|
||||
<xsl:call-template name="formattext">
|
||||
<xsl:call-template name="formattextdiv">
|
||||
<xsl:with-param name="text" select="info"/>
|
||||
<xsl:with-param name="divclass">description</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</div>
|
||||
<xsl:if test="arg | return">
|
||||
<dl class="variablelist">
|
||||
<xsl:for-each select="arg">
|
||||
@ -680,11 +690,11 @@
|
||||
</xsl:for-each>
|
||||
<xsl:text>)</xsl:text>
|
||||
</pre>
|
||||
<div class="description">
|
||||
<xsl:call-template name="formattext">
|
||||
<xsl:call-template name="formattextdiv">
|
||||
<xsl:with-param name="text" select="info"/>
|
||||
<xsl:with-param name="divclass">description</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</div><xsl:text>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:if test="arg | return/@info">
|
||||
<dl class="variablelist">
|
||||
|
Loading…
Reference in New Issue
Block a user