Skip to content

Commit

Permalink
Merge pull request #531 from ndw/iss-528
Browse files Browse the repository at this point in the history
Support linking on arg/group, improved verbatim CSS
  • Loading branch information
ndw authored Oct 20, 2024
2 parents 06512d0 + ae30774 commit cbd4713
Show file tree
Hide file tree
Showing 254 changed files with 361 additions and 354 deletions.
9 changes: 9 additions & 0 deletions src/guide/xml/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ development continues.</para>
fixed <link xlink:href="https://github.com/docbook/xslTNG/issues/497">#497</link>.
</para>
</listitem>
<listitem>
<para>Support linking on <tag>db:arg</tag> and <tag>db:group</tag> elements;
fixed <link xlink:href="https://github.com/docbook/xslTNG/issues/528">#528</link>.
</para>
</listitem>
<listitem>
<para>Provided additional class attributes on various flavors of synopsis to enable
more precise CSS styling.</para>
</listitem>
</itemizedlist>
</section>

Expand Down
15 changes: 6 additions & 9 deletions src/main/xslt/modules/programming.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@

<div>
<xsl:apply-templates select="." mode="m:attributes"/>
<div class="pre-wrap">
<div class="pre-wrap {local-name()}-wrap">
<pre>
<xsl:apply-templates select="$package/preceding-sibling::*" mode="m:synopsis"/>
<xsl:text>package </xsl:text>
Expand All @@ -754,7 +754,7 @@
<div>
<xsl:apply-templates select="." mode="m:attributes"/>
<xsl:apply-templates select="db:classsynopsisinfo"/>
<div class="pre-wrap">
<div class="pre-wrap {local-name()}-wrap">
<pre>
<xsl:apply-templates select="db:ooclass/db:modifier" mode="m:synopsis"/>
<xsl:text>class </xsl:text>
Expand All @@ -776,7 +776,7 @@
<xsl:param name="indent" select="''"/>
<div>
<xsl:apply-templates select="." mode="m:attributes"/>
<div class="pre-wrap">
<div class="pre-wrap {local-name()}-wrap">
<pre class="synopsis">
<xsl:apply-templates select="." mode="m:synopsis"/>
</pre>
Expand Down Expand Up @@ -829,7 +829,7 @@
<xsl:param name="indent" select="''"/>
<div>
<xsl:apply-templates select="." mode="m:attributes"/>
<div class="pre-wrap">
<div class="pre-wrap {local-name()}-wrap">
<pre class="synopsis">
<xsl:apply-templates select="." mode="m:synopsis"/>
</pre>
Expand Down Expand Up @@ -918,7 +918,7 @@
<div>
<xsl:apply-templates select="." mode="m:attributes"/>
<xsl:apply-templates select="db:synopsisinfo"/>
<div class="pre-wrap">
<div class="pre-wrap {local-name()}-wrap">
<pre>
<xsl:apply-templates select="db:modifier" mode="m:synopsis"/>
<xsl:text>enum </xsl:text>
Expand Down Expand Up @@ -1036,10 +1036,7 @@
</xsl:otherwise>
</xsl:choose>

<span>
<xsl:apply-templates select="." mode="m:attributes"/>
<xsl:apply-templates/>
</span>
<xsl:call-template name="t:inline"/>

<xsl:choose>
<xsl:when test="$rep='repeat'">
Expand Down
8 changes: 4 additions & 4 deletions src/main/xslt/modules/verbatim.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@
</xsl:for-each>
</xsl:variable>

<div class="pre-wrap">
<div class="pre-wrap {local-name()}-wrap">
<pre>
<xsl:apply-templates select="." mode="m:attributes">
<xsl:with-param name="style" select="'plain'"/>
Expand Down Expand Up @@ -314,7 +314,7 @@
<xsl:apply-templates/>
</xsl:variable>

<div class="pre-wrap">
<div class="pre-wrap {local-name()}-wrap">
<pre>
<xsl:apply-templates select="." mode="m:attributes">
<xsl:with-param name="style" select="'raw'"/>
Expand Down Expand Up @@ -430,7 +430,7 @@
<xsl:variable name="syntax-highlight"
select="f:highlight-verbatim(.)"/>

<div class="pre-wrap{if ($syntax-highlight) then ' highlight' else ''}">
<div class="pre-wrap {local-name()}-wrap{if ($syntax-highlight) then ' highlight' else ''}">
<xsl:if test="$numbered">
<xsl:attribute name="db-startinglinenumber" select="$starting-line-number"/>
<xsl:attribute name="db-numberoflines" select="array:size($lines)"/>
Expand Down Expand Up @@ -597,7 +597,7 @@
<xsl:variable name="syntax-highlight"
select="f:highlight-verbatim(.)"/>

<div class="pre-wrap{if ($syntax-highlight) then ' highlight' else ''}">
<div class="pre-wrap {local-name()}-wrap{if ($syntax-highlight) then ' highlight' else ''}">
<xsl:if test="$numbered">
<xsl:attribute name="db-startinglinenumber" select="$starting-line-number"/>
<xsl:attribute name="db-numberoflines" select="array:size($lines)"/>
Expand Down
6 changes: 3 additions & 3 deletions src/test/resources/expected/address.001.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!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>Article wrapper</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"/><script src="./js/copy-verbatim.js" defer="defer"></script></head><body class="home"><nav class="top"></nav><main><article class="article component"><header><h1>Article wrapper</h1></header><p>An address:</p><div class="pre-wrap"><pre class="address verbatim"><span class="first-last personname">Santa Clause</span>
<!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>Article wrapper</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"/><script src="./js/copy-verbatim.js" defer="defer"></script></head><body class="home"><nav class="top"></nav><main><article class="article component"><header><h1>Article wrapper</h1></header><p>An address:</p><div class="pre-wrap address-wrap"><pre class="address verbatim"><span class="first-last personname">Santa Clause</span>
<span class="street">1 Main Street</span>
<span class="city">North Pole</span>, <span class="state">AK</span>
<span class="postcode">12345</span>
<span class="country">US</span></pre></div><p>Other address fields:</p><div class="pre-wrap"><pre class="address verbatim">Information:
<span class="country">US</span></pre></div><p>Other address fields:</p><div class="pre-wrap address-wrap"><pre class="address verbatim">Information:
<span class="phone">+1-914-555-1212</span>
<span class="fax">+1-213-555-1212</span>
<code class="email">[email protected]</code>
<code class="uri">http://www.example.com/</code></pre></div><p>With a PO Box:</p><div class="pre-wrap"><pre class="address verbatim"><span class="otheraddr whynotorgname">Some Company</span>
<code class="uri">http://www.example.com/</code></pre></div><p>With a PO Box:</p><div class="pre-wrap address-wrap"><pre class="address verbatim"><span class="otheraddr whynotorgname">Some Company</span>
<span class="pob">P.O. Box 123</span>
<span class="city">Anytown</span>, <span class="state">XX</span>
<span class="postcode">12345</span></pre></div></article></main><nav class="bottom"></nav></body></html>
6 changes: 3 additions & 3 deletions src/test/resources/expected/address.002.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!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>Test: address.002</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"/><script src="./js/copy-verbatim.js" defer="defer"></script></head><body class="home"><nav class="top"></nav><main><article class="article component"><header><h1>Test: address.002</h1></header><p>An address (in table style):</p><div class="pre-wrap"><table class="verbatim"><tr><td><pre class="address verbatim verblines"><span class="line"><span class="ln"> <span class="nsep">|</span></span></span>
<!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>Test: address.002</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"/><script src="./js/copy-verbatim.js" defer="defer"></script></head><body class="home"><nav class="top"></nav><main><article class="article component"><header><h1>Test: address.002</h1></header><p>An address (in table style):</p><div class="pre-wrap address-wrap"><table class="verbatim"><tr><td><pre class="address verbatim verblines"><span class="line"><span class="ln"> <span class="nsep">|</span></span></span>
<span class="line"><span class="ln"> <span class="nsep">|</span></span></span>
<span class="line"><span class="ln"> <span class="nsep">|</span></span></span>
<span class="line"><span class="ln"> <span class="nsep">|</span></span></span>
Expand All @@ -8,7 +8,7 @@
<span class="line"><span class="ld"><span class="city">North Pole</span>, <span class="state">AK</span></span></span>
<span class="line"><span class="ld"><span class="postcode">12345</span></span></span>
<span class="line"><span class="ld"><span class="country">US</span></span></span>
</pre></td></tr></table></div><p>Other address fields:</p><div class="pre-wrap"><table class="verbatim"><tr><td><pre class="address verbatim verblines"><span class="line"><span class="ln"> <span class="nsep">|</span></span></span>
</pre></td></tr></table></div><p>Other address fields:</p><div class="pre-wrap address-wrap"><table class="verbatim"><tr><td><pre class="address verbatim verblines"><span class="line"><span class="ln"> <span class="nsep">|</span></span></span>
<span class="line"><span class="ln"> <span class="nsep">|</span></span></span>
<span class="line"><span class="ln"> <span class="nsep">|</span></span></span>
<span class="line"><span class="ln"> <span class="nsep">|</span></span></span>
Expand All @@ -18,7 +18,7 @@
<span class="line"><span class="ld"><span class="fax">+1-213-555-1212</span></span></span>
<span class="line"><span class="ld"><code class="email">[email protected]</code></span></span>
<span class="line"><span class="ld"><code class="uri">http://www.example.com/</code></span></span>
</pre></td></tr></table></div><p>With a PO Box:</p><div class="pre-wrap"><table class="verbatim"><tr><td><pre class="address verbatim verblines"><span class="line"><span class="ln"> <span class="nsep">|</span></span></span>
</pre></td></tr></table></div><p>With a PO Box:</p><div class="pre-wrap address-wrap"><table class="verbatim"><tr><td><pre class="address verbatim verblines"><span class="line"><span class="ln"> <span class="nsep">|</span></span></span>
<span class="line"><span class="ln"> <span class="nsep">|</span></span></span>
<span class="line"><span class="ln"> <span class="nsep">|</span></span></span>
<span class="line"><span class="ln"> <span class="nsep">|</span></span></span>
Expand Down
6 changes: 3 additions & 3 deletions src/test/resources/expected/book.003.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
Blah. Blah blah blah blah. Blah blah. Blah blah blah blah.
Blah blah blah blah blah blah blah blah. Blah blah blah blah.
Blah. Blah blah blah blah. Blah blah. Blah blah blah blah.
</p><div id="figduck" class="figure formalobject"><div class="pre-wrap" db-startinglinenumber="1" db-numberoflines="1"><pre class="language-none numbered programlisting verbatim verblines"><span class="line" db-line="1"><span class="ln"> <span class="nsep">|</span></span><span class="ld"><code>A figure. Just to test the numeration.</code></span></span>
</pre></div><header><div class="title">Figure <span class="label">1<span class="sep">.</span>1</span><span class="sep"></span>A Test Figure</div></header></div></div><section id="chap1_s1" class="section"><header><h2><span class="label">1</span><span class="sep"></span>First Section</h2></header><div id="figduck2" class="figure formalobject"><div class="pre-wrap" db-startinglinenumber="1" db-numberoflines="1"><pre class="language-none numbered programlisting verbatim verblines"><span class="line" db-line="1"><span class="ln"> <span class="nsep">|</span></span><span class="ld"><code>A figure. Just to test the numeration.</code></span></span>
</p><div id="figduck" class="figure formalobject"><div class="pre-wrap programlisting-wrap" db-startinglinenumber="1" db-numberoflines="1"><pre class="language-none numbered programlisting verbatim verblines"><span class="line" db-line="1"><span class="ln"> <span class="nsep">|</span></span><span class="ld"><code>A figure. Just to test the numeration.</code></span></span>
</pre></div><header><div class="title">Figure <span class="label">1<span class="sep">.</span>1</span><span class="sep"></span>A Test Figure</div></header></div></div><section id="chap1_s1" class="section"><header><h2><span class="label">1</span><span class="sep"></span>First Section</h2></header><div id="figduck2" class="figure formalobject"><div class="pre-wrap programlisting-wrap" db-startinglinenumber="1" db-numberoflines="1"><pre class="language-none numbered programlisting verbatim verblines"><span class="line" db-line="1"><span class="ln"> <span class="nsep">|</span></span><span class="ld"><code>A figure. Just to test the numeration.</code></span></span>
</pre></div><header><div class="title">Figure <span class="label">1<span class="sep">.</span>2</span><span class="sep"></span>Another Test Figure</div></header></div><p>Blah blah blah blah. Blah blah blah blah. Blah blah blah blah.
Blah blah blah blah blah blah blah blah. Blah blah blah blah.
Blah. Blah blah blah blah. Blah blah. Blah blah blah blah.
Expand All @@ -53,7 +53,7 @@
Blah. Blah blah blah blah. Blah blah. Blah blah blah blah.
Blah blah blah blah blah blah blah blah. Blah blah blah blah.
Blah. Blah blah blah blah. Blah blah. Blah blah blah blah.
</p><div id="example" class="example formalobject"><div class="pre-wrap" db-startinglinenumber="1" db-numberoflines="1"><pre class="language-none numbered programlisting verbatim verblines"><span class="line" db-line="1"><span class="ln"> <span class="nsep">|</span></span><span class="ld"><code>An example.</code></span></span>
</p><div id="example" class="example formalobject"><div class="pre-wrap programlisting-wrap" db-startinglinenumber="1" db-numberoflines="1"><pre class="language-none numbered programlisting verbatim verblines"><span class="line" db-line="1"><span class="ln"> <span class="nsep">|</span></span><span class="ld"><code>An example.</code></span></span>
</pre></div><header><div class="title">Example <span class="label">1<span class="sep">.</span>1</span><span class="sep"></span>Test Example</div></header></div><section id="chap1_s1_s1" class="section"><header><h3><span class="label">1<span class="sep">.</span>1</span><span class="sep"></span>First Subsection</h3></header><p>Blah blah blah blah. Blah blah blah blah. Blah blah blah blah.
Blah blah blah blah blah blah blah blah. Blah blah blah blah.
Blah. Blah blah blah blah. Blah blah. Blah blah blah blah.
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/expected/book.021.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
But you can fix it changing the <code>self::db:article</code> template in the
“title-numbered” part of the localization to:

<div class="pre-wrap highlight" db-startinglinenumber="1" db-numberoflines="1"><pre class="language-xml numbered programlisting verbatim verblines"><span class="line" db-line="1"><span class="ln"> <span class="nsep">|</span></span><span class="ld"><code><span class="nt">&lt;template</span><span class="w"> </span><span class="na">match=</span><span class="s">"self::db:article"</span><span class="nt">&gt;</span>%l%.%c<span class="nt">&lt;/template&gt;</span></code></span></span>
<div class="pre-wrap programlisting-wrap highlight" db-startinglinenumber="1" db-numberoflines="1"><pre class="language-xml numbered programlisting verbatim verblines"><span class="line" db-line="1"><span class="ln"> <span class="nsep">|</span></span><span class="ld"><code><span class="nt">&lt;template</span><span class="w"> </span><span class="na">match=</span><span class="s">"self::db:article"</span><span class="nt">&gt;</span>%l%.%c<span class="nt">&lt;/template&gt;</span></code></span></span>
</pre></div>
</p></section><section id="R_art1" class="article component"><header><h1>First Article</h1></header><div class="db-bfs"><p>This article is numbered, so are its sections.</p></div><section id="R_art1_s1" class="section"><header><h2><span class="label">1</span><span class="sep"></span>First section</h2></header><section id="R_art1_s1_s1" class="section"><header><h3><span class="label">1<span class="sep">.</span>1</span><span class="sep"></span>Second section</h3></header><p></p></section></section></section><section id="R_art2" class="article component"><header><h1>Second Article</h1></header><div class="db-bfs"><p>This article is not numbered, neither are its sections.</p></div><section id="R_art2_s1" class="section"><header><h2>First section</h2></header><section id="R_art2_s1_s1" class="section"><header><h3>Second section</h3></header></section></section></section><section id="R_art3" class="article component"><header><h1>Third Article</h1></header><div class="db-bfs"><p>This article is numbered, its sections are not.</p></div><section id="R_art3_s1" class="section"><header><h2>First section</h2></header><section id="R_art3_s1_s1" class="section"><header><h3>Second section</h3></header><p></p></section></section></section><section id="R_art4" class="article component"><header><h1>Fourth Article</h1></header><div class="db-bfs"><p>This article is not numbered, but its sections are.</p></div><section id="R_art4_s1" class="section"><header><h2><span class="label">1</span><span class="sep"></span>First section</h2></header><section id="R_art4_s1_s1" class="section"><header><h3><span class="label">1<span class="sep">.</span>1</span><span class="sep"></span>Second section</h3></header></section></section></section></article></main><nav class="bottom"></nav></body></html>
Loading

0 comments on commit cbd4713

Please sign in to comment.