[libvirt] [PATCH] docs: add a permalink to html headers
Claudio Bley
cbley at av-test.de
Thu Jan 23 15:24:43 UTC 2014
At Tue, 10 Dec 2013 13:45:05 +0100,
Michal Privoznik wrote:
>
> On 08.12.2013 23:57, Dan Kenigsberg wrote:
> > Note to reviewers: this patch is too naive and has devastating effect of
> > headers that lack a named anchor element. Still, I'd love to hear your
> > opinion about the idea.
> >
> > On Sun, Dec 08, 2013 at 02:05:46PM +0000, Dan Kenigsberg wrote:
> >> Quite often, I need to cite URLs like
> >> http://libvirt.org/formatnetwork.html#elementQoS
> >> but it is annoying to copy them from the table of contents or the html
> >> source.
> >>
> >> This patch borrows from the Python documentation in order to make it
> >> easier to cite headers on libvirt's oneline documentation.
> >> ---
> >> docs/libvirt.css | 13 +++++++++++++
> >> docs/page.xsl | 7 +++++++
> >> 2 files changed, 20 insertions(+)
>
> I like the idea - I often find myself in the same situation, but if we decide to merge this, we need to fix some issues:
>
> Validating internals/command.html
> ./html/libvirt-libvirt.html:6: element a: validity error : No declaration for attribute xmlns:html of element a
> ne">blah</a></h2><h3><a xmlns:html="http://www.w3.org/1999/xhtml" href="#macros"
> ^
>
> (line repeats over and over)
>
> Moreover, going with '¶' turns out to be not cool:
>
> Generating logging.html.tmp
> ../docs/page.xsl:192: parser error : Input is not proper UTF-8, indicate encoding !
> Bytes: 0xB6 0x3C 0x2F 0x61
> <a class="headerlink" href="#{html:a/@name}" title="Permalink to this headline">
Hi.
I like the idea too.
Works for me if you squash this in:
------------ >8 ------- 8< -------------------------------
diff --git a/docs/page.xsl b/docs/page.xsl
index 7f6f2af..d560c09 100644
--- a/docs/page.xsl
+++ b/docs/page.xsl
@@ -187,9 +187,22 @@
</xsl:template>
<xsl:template match="html:h2 | html:h3 | html:h4 | html:h5 | html:h6" mode="content">
- <xsl:copy>
- <xsl:copy-of select="./*"/>
- <a class="headerlink" href="#{html:a/@name}" title="Permalink to this headline"><B6></a>
- </xsl:copy>
+ <xsl:element name="{name()}" namespace="{namespace-uri()}">
+ <xsl:apply-templates mode="copy" />
+ <xsl:if test="./html:a/@name">
+ <a class="headerlink" href="#{html:a/@name}" title="Permalink to this headline">¶</a>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="text()" mode="copy">
+ <xsl:value-of select="."/>
+ </xsl:template>
+
+ <xsl:template match="node()" mode="copy">
+ <xsl:element name="{name()}" namespace="{namespace-uri()}">
+ <xsl:copy-of select="./@*"/>
+ <xsl:apply-templates mode="copy" />
+ </xsl:element>
</xsl:template>
</xsl:stylesheet
------------ >8 ------- 8< -------------------------------
Claudio
--
AV-Test GmbH, Henricistraße 20, 04155 Leipzig, Germany
Phone: +49 341 265 310 19
Web:<http://www.av-test.org>
Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076)
Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern
More information about the libvir-list
mailing list