Re: [PATCH] docs: add a permalink to html headers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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(+)
> 
> diff --git a/docs/libvirt.css b/docs/libvirt.css
> index b324ac8..1d27873 100644
> --- a/docs/libvirt.css
> +++ b/docs/libvirt.css
> @@ -498,3 +498,16 @@ div.description pre.code {
>      padding: 5px 10px 5px 10px;
>      margin-left: 2.5em;
>  }
> +
> +a.headerlink {
> +    text-decoration: none!important;
> +    visibility: hidden;
> +}
> +
> +h2:hover > a.headerlink,
> +h3:hover > a.headerlink,
> +h4:hover > a.headerlink,
> +h5:hover > a.headerlink,
> +h6:hover > a.headerlink {
> +    visibility: visible;
> +}
> diff --git a/docs/page.xsl b/docs/page.xsl
> index a2da854..107f6e2 100644
> --- a/docs/page.xsl
> +++ b/docs/page.xsl
> @@ -185,4 +185,11 @@
>  
>      <xsl:apply-templates select="exsl:node-set($inchtml)/html:html/html:body/*" mode="content"/>
>    </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">¶</a>
> +    </xsl:copy>
> +  </xsl:template>
>  </xsl:stylesheet>
> -- 
> 1.8.3.1
> 

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





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]