Skip to content

Commit

Permalink
Support @xrefstyle on link; fix #561
Browse files Browse the repository at this point in the history
  • Loading branch information
ndw committed Nov 11, 2024
1 parent 6e82c1c commit 13952ef
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/guide/xml/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ the combination of options. See <xref linkend="verbatim-environments"/>.</para>
the <tag class="attribute">xml:id</tag> value of a chunk will be used as the
chunk filename.</para>
</listitem>
<listitem>
<para>Support <tag class="attribute">xrefstyle</tag> on <tag>link</tag>;
fixed <link xlink:href="https://github.com/docbook/xslTNG/issues/561">#561</link>.</para>
</listitem>
</itemizedlist>
</section>

Expand Down
2 changes: 1 addition & 1 deletion src/main/xslt/modules/links.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@
</xsl:template>

<xsl:function name="fp:localization-template-from-xrefstyle" as="element(l:template)">
<xsl:param name="xref" as="element(db:xref)"/>
<xsl:param name="xref" as="element()"/>
<xsl:param name="target" as="element()"/>

<xsl:variable name="content" as="item()*">
Expand Down
1 change: 1 addition & 0 deletions src/test/resources/expected/link.006.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" class="no-js"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script><title>Unit test: link.006</title><meta name="viewport" content="width=device-width, initial-scale=1.0"/><link href="https://purl.org/dc/elements/1.1/" rel="schema.dc"/><meta content="2011-04-22T17:02:00-06:00" name="dc.modified"/><meta content="DocBook xslTNG" name="generator"/><link href="./css/docbook.css" rel="stylesheet" media="screen"/></head><body class="home"><nav class="top"></nav><main><article id="article" class="article component"><header><h1>Unit test: link.006</h1></header><p>Test: <a href="#article" class="xref xref-article">xrefstyle: Unit test: link.006</a>.</p><p>Test: <a href="#article" class="xref xref-article">Unit test: link.006</a>.</p><p>Test: <a href="#article" class="xref xref-article">xrefstyle: Unit test: link.006</a>.</p><p>Test: <a href="#article" class="link">link text</a>.</p></article></main><nav class="bottom"></nav></body></html>
14 changes: 14 additions & 0 deletions src/test/resources/xml/link.006.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<article xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="5.0" xml:id="article">
<title>Unit test: link.006</title>

<para>Test: <xref xrefstyle="xrefstyle: %c" linkend="article"/>.</para>

<para>Test: <link linkend="article"/>.</para>

<para>Test: <link xrefstyle="xrefstyle: %c" linkend="article"/>.</para>

<para>Test: <link xrefstyle="xrefstyle: %c" linkend="article">link text</link>.</para>

</article>

0 comments on commit 13952ef

Please sign in to comment.