[libvirt] [PATCH] docs: Make anchors in API html files clickable/linkable

Peter Krempa posted 1 patch 12 weeks ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/d917f6389fe7bc2b2c0e6c8df7468dfa9af620cc.1565857319.git.pkrempa@redhat.com
docs/newapi.xsl | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

[libvirt] [PATCH] docs: Make anchors in API html files clickable/linkable

Posted by Peter Krempa 12 weeks ago
Use 'id' instead of 'name' for anchors which adds the hidden clickable
headerlink helper so it's way simpler to link to a specific part of the
docs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 docs/newapi.xsl | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/docs/newapi.xsl b/docs/newapi.xsl
index c808fe5ff8..f9cbcb6323 100644
--- a/docs/newapi.xsl
+++ b/docs/newapi.xsl
@@ -308,7 +308,7 @@

   <xsl:template match="typedef[@type = 'enum']">
     <xsl:variable name="name" select="string(@name)"/>
-    <h3><a name="{$name}"><code><xsl:value-of select="$name"/></code></a></h3>
+    <h3><a id="{$name}"><code><xsl:value-of select="$name"/></code></a></h3>
     <div class="api">
       <pre>
         <span class="keyword">enum</span><xsl:text> </xsl:text>
@@ -357,7 +357,7 @@
   </xsl:template>

   <xsl:template match="struct">
-    <h3><a name="{@name}"><code><xsl:value-of select="@name"/></code></a></h3>
+    <h3><a id="{@name}"><code><xsl:value-of select="@name"/></code></a></h3>
     <div class="api">
       <pre>
         <span class="keyword">struct </span>
@@ -447,7 +447,7 @@

   <xsl:template match="macro">
     <xsl:variable name="name" select="string(@name)"/>
-    <h3><a name="{$name}"><code><xsl:value-of select="$name"/></code></a></h3>
+    <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">
@@ -558,7 +558,7 @@
     <xsl:variable name="nlen" select="string-length($name)"/>
     <xsl:variable name="tlen" select="string-length(return/@type)"/>
     <xsl:variable name="blen" select="(($nlen + 8) - (($nlen + 8) mod 8)) + (($tlen + 8) - (($tlen + 8) mod 8))"/>
-    <h3><a name="{$name}"><code><xsl:value-of select="$name"/></code></a></h3>
+    <h3><a id="{$name}"><code><xsl:value-of select="$name"/></code></a></h3>
     <pre class="api">
     <span class="keyword">typedef</span><xsl:text> </xsl:text>
     <span class="type">
@@ -636,7 +636,7 @@
     <xsl:variable name="nlen" select="string-length($name)"/>
     <xsl:variable name="tlen" select="string-length(return/@type)"/>
     <xsl:variable name="blen" select="(($nlen + 8) - (($nlen + 8) mod 8)) + (($tlen + 8) - (($tlen + 8) mod 8))"/>
-    <h3><a name="{$name}"><code><xsl:value-of select="$name"/></code></a></h3>
+    <h3><a id="{$name}"><code><xsl:value-of select="$name"/></code></a></h3>
     <pre class="api">
     <span class="type">
       <xsl:call-template name="dumptext">
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] docs: Make anchors in API html files clickable/linkable

Posted by Ján Tomko 12 weeks ago
On Thu, Aug 15, 2019 at 10:21:59AM +0200, Peter Krempa wrote:
>Use 'id' instead of 'name' for anchors which adds the hidden clickable
>headerlink helper so it's way simpler to link to a specific part of the
>docs.
>

<a name> was deprecated in favor of <a id> anyway.

>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> docs/newapi.xsl | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

There are also three more occurrences of <a name> inside a heading:
$ git grep -n 'h.*a name' docs/newapi.xsl
docs/newapi.xsl:786:          <h3><a name="macros">Macros</a></h3>
docs/newapi.xsl:791:        <h3><a name="types">Types</a></h3>
docs/newapi.xsl:795:        <h3><a name="functions">Functions</a></h3>

Feel free to include the changes here. Or not.

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list