Skip to content

Commit

Permalink
Merge pull request #549 from ndw/simplesect
Browse files Browse the repository at this point in the history
Fix simplesect titles
  • Loading branch information
ndw authored Nov 2, 2024
2 parents 5e95601 + 02230bf commit e86f67f
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 3 deletions.
50 changes: 50 additions & 0 deletions src/main/xslt/modules/templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,56 @@
</header>
</db:section>

<!-- h5/h6 is small enough ... -->
<db:simplesect
context="parent::db:section/parent::db:section/parent::db:section
|parent::db:sect3|parent::db:sect4|parent::db:sect5">
<header>
<tmp:apply-templates select="db:title">
<h5><tmp:content/></h5>
</tmp:apply-templates>
<tmp:apply-templates select="db:subtitle">
<h6><tmp:content/></h6>
</tmp:apply-templates>
</header>
</db:simplesect>

<db:simplesect
context="parent::db:section/parent::db:section
|parent::db:sect2">
<header>
<tmp:apply-templates select="db:title">
<h4><tmp:content/></h4>
</tmp:apply-templates>
<tmp:apply-templates select="db:subtitle">
<h5><tmp:content/></h5>
</tmp:apply-templates>
</header>
</db:simplesect>

<db:simplesect context="parent::db:section
|parent::db:sect1">
<header>
<tmp:apply-templates select="db:title">
<h3><tmp:content/></h3>
</tmp:apply-templates>
<tmp:apply-templates select="db:subtitle">
<h4><tmp:content/></h4>
</tmp:apply-templates>
</header>
</db:simplesect>

<db:simplesect>
<header>
<tmp:apply-templates select="db:title">
<h2><tmp:content/></h2>
</tmp:apply-templates>
<tmp:apply-templates select="db:subtitle">
<h3><tmp:content/></h3>
</tmp:apply-templates>
</header>
</db:simplesect>

<db:refsect3>
<header>
<tmp:apply-templates select="db:title">
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/expected/section.005.html
Original file line number Diff line number Diff line change
@@ -1 +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: section.005</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 class="article component"><header><h1>Unit Test: section.005</h1><h2>Deeply nested sections with subtitles</h2><div class="author"><h3><span class="first-last personname"><span class="firstname">Michael</span> <span class="surname">Smith</span></span></h3></div></header><div class="list-of-titles"><div class="lot toc"><div class="title">Table of Contents</div><ul class="toc"><li><a href="#c2s1"><span class="label">1</span><span class="sep">. </span>Section 1</a><ul class="toc"><li><a href="#c2s1s1"><span class="label">1<span class="sep">.</span>1</span><span class="sep">. </span>Section 1.1</a><ul class="toc"><li><a href="#c2s1s1s1"><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1</span><span class="sep">. </span>Section 1.1.1</a><ul class="toc"><li><a href="#c2s1s1s1s1"><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1</span><span class="sep">. </span>Section 1.1.1.1</a><ul class="toc"><li><a href="#c2s1s1s1s1s1"><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1</span><span class="sep">. </span>Section 1.1.1.1.1</a></li><li><a href="#c2s1s1s1s1s2"><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>2</span><span class="sep">. </span>Section 1.1.1.1.2</a><ul class="toc"><li><a href="#c2s1s1s1s1s2s1"><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>2<span class="sep">.</span>1</span><span class="sep">. </span>Section 1.1.1.1.2.1</a></li></ul></li><li><a href="#c2s1s1s1s1s3"><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>3</span><span class="sep">. </span>Section 1.1.1.1.3</a></li></ul></li><li><a href="#c2s1s1s1s2"><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>2</span><span class="sep">. </span>Section 1.1.1.2</a></li><li><a href="#c2s1s1s1s3"><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>3</span><span class="sep">. </span>Section 1.1.1.3</a></li></ul></li><li><a href="#c2s1s1s2"><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>2</span><span class="sep">. </span>Section 1.1.2</a></li><li><a href="#c2s1s1s3"><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>3</span><span class="sep">. </span>Section 1.1.3</a></li></ul></li><li><a href="#c2s1s2"><span class="label">1<span class="sep">.</span>2</span><span class="sep">. </span>Section 1.2</a></li><li><a href="#c2s1s3"><span class="label">1<span class="sep">.</span>3</span><span class="sep">. </span>Section 1.3</a></li></ul></li></ul></div></div><div class="db-bfs"><p>See <a href="#c2s1s1s2" class="xref xref-section">Section <span class="label">1<span class="sep">.</span>1<span class="sep">.</span>2</span>, “Section 1.1.2”</a>.</p></div><section id="c2s1" class="section"><header><h2><span class="label">1</span><span class="sep">. </span>Section 1</h2><h3>Subtitle</h3></header><p>blah.</p><section id="c2s1s1" class="section"><header><h3><span class="label">1<span class="sep">.</span>1</span><span class="sep">. </span>Section 1.1</h3><h4>Subtitle</h4></header><p>blah.</p><section id="c2s1s1s1" class="section"><header><h4><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1</span><span class="sep">. </span>Section 1.1.1</h4><h5>Subtitle</h5></header><p>blah.</p><section id="c2s1s1s1s1" class="section"><header><h5><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1</span><span class="sep">. </span>Section 1.1.1.1</h5><h6>Subtitle</h6></header><p>blah.</p><section id="c2s1s1s1s1s1" class="section"><header><h5><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1</span><span class="sep">. </span>Section 1.1.1.1.1</h5><h6>Subtitle</h6></header><p>blah.</p></section><section id="c2s1s1s1s1s2" class="section"><header><h5><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>2</span><span class="sep">. </span>Section 1.1.1.1.2</h5><h6>Subtitle</h6></header><p>blah.</p><section id="c2s1s1s1s1s2s1" class="section"><header><h5><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>2<span class="sep">.</span>1</span><span class="sep">. </span>Section 1.1.1.1.2.1</h5><h6>Subtitle</h6></header><p>blah.</p></section></section><section id="c2s1s1s1s1s3" class="section"><header><h5><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>3</span><span class="sep">. </span>Section 1.1.1.1.3</h5><h6>Subtitle</h6></header><p>blah.</p><section id="c2s1s1s1s1s3s1" class="simplesect"><header><div class="title">Section 1.1.1.1.3.1</div></header><p>blah.</p></section></section></section><section id="c2s1s1s1s2" class="section"><header><h5><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>2</span><span class="sep">. </span>Section 1.1.1.2</h5><h6>Subtitle</h6></header><p>blah.</p></section><section id="c2s1s1s1s3" class="section"><header><h5><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>3</span><span class="sep">. </span>Section 1.1.1.3</h5><h6>Subtitle</h6></header><p>blah.</p></section></section><section id="c2s1s1s2" class="section"><header><h4><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>2</span><span class="sep">. </span>Section 1.1.2</h4><h5>Subtitle</h5></header><p>blah.</p></section><section id="c2s1s1s3" class="section"><header><h4><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>3</span><span class="sep">. </span>Section 1.1.3</h4><h5>Subtitle</h5></header><p>blah.</p></section></section><section id="c2s1s2" class="section"><header><h3><span class="label">1<span class="sep">.</span>2</span><span class="sep">. </span>Section 1.2</h3><h4>Subtitle</h4></header><p>blah.</p></section><section id="c2s1s3" class="section"><header><h3><span class="label">1<span class="sep">.</span>3</span><span class="sep">. </span>Section 1.3</h3><h4>Subtitle</h4></header><p>blah.</p></section></section></article></main><nav class="bottom"></nav></body></html>
<!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: section.005</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 class="article component"><header><h1>Unit Test: section.005</h1><h2>Deeply nested sections with subtitles</h2><div class="author"><h3><span class="first-last personname"><span class="firstname">Michael</span> <span class="surname">Smith</span></span></h3></div></header><div class="list-of-titles"><div class="lot toc"><div class="title">Table of Contents</div><ul class="toc"><li><a href="#c2s1"><span class="label">1</span><span class="sep">. </span>Section 1</a><ul class="toc"><li><a href="#c2s1s1"><span class="label">1<span class="sep">.</span>1</span><span class="sep">. </span>Section 1.1</a><ul class="toc"><li><a href="#c2s1s1s1"><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1</span><span class="sep">. </span>Section 1.1.1</a><ul class="toc"><li><a href="#c2s1s1s1s1"><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1</span><span class="sep">. </span>Section 1.1.1.1</a><ul class="toc"><li><a href="#c2s1s1s1s1s1"><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1</span><span class="sep">. </span>Section 1.1.1.1.1</a></li><li><a href="#c2s1s1s1s1s2"><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>2</span><span class="sep">. </span>Section 1.1.1.1.2</a><ul class="toc"><li><a href="#c2s1s1s1s1s2s1"><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>2<span class="sep">.</span>1</span><span class="sep">. </span>Section 1.1.1.1.2.1</a></li></ul></li><li><a href="#c2s1s1s1s1s3"><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>3</span><span class="sep">. </span>Section 1.1.1.1.3</a></li></ul></li><li><a href="#c2s1s1s1s2"><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>2</span><span class="sep">. </span>Section 1.1.1.2</a></li><li><a href="#c2s1s1s1s3"><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>3</span><span class="sep">. </span>Section 1.1.1.3</a></li></ul></li><li><a href="#c2s1s1s2"><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>2</span><span class="sep">. </span>Section 1.1.2</a></li><li><a href="#c2s1s1s3"><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>3</span><span class="sep">. </span>Section 1.1.3</a></li></ul></li><li><a href="#c2s1s2"><span class="label">1<span class="sep">.</span>2</span><span class="sep">. </span>Section 1.2</a></li><li><a href="#c2s1s3"><span class="label">1<span class="sep">.</span>3</span><span class="sep">. </span>Section 1.3</a></li></ul></li></ul></div></div><div class="db-bfs"><p>See <a href="#c2s1s1s2" class="xref xref-section">Section <span class="label">1<span class="sep">.</span>1<span class="sep">.</span>2</span>, “Section 1.1.2”</a>.</p></div><section id="c2s1" class="section"><header><h2><span class="label">1</span><span class="sep">. </span>Section 1</h2><h3>Subtitle</h3></header><p>blah.</p><section id="c2s1s1" class="section"><header><h3><span class="label">1<span class="sep">.</span>1</span><span class="sep">. </span>Section 1.1</h3><h4>Subtitle</h4></header><p>blah.</p><section id="c2s1s1s1" class="section"><header><h4><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1</span><span class="sep">. </span>Section 1.1.1</h4><h5>Subtitle</h5></header><p>blah.</p><section id="c2s1s1s1s1" class="section"><header><h5><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1</span><span class="sep">. </span>Section 1.1.1.1</h5><h6>Subtitle</h6></header><p>blah.</p><section id="c2s1s1s1s1s1" class="section"><header><h5><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1</span><span class="sep">. </span>Section 1.1.1.1.1</h5><h6>Subtitle</h6></header><p>blah.</p></section><section id="c2s1s1s1s1s2" class="section"><header><h5><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>2</span><span class="sep">. </span>Section 1.1.1.1.2</h5><h6>Subtitle</h6></header><p>blah.</p><section id="c2s1s1s1s1s2s1" class="section"><header><h5><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>2<span class="sep">.</span>1</span><span class="sep">. </span>Section 1.1.1.1.2.1</h5><h6>Subtitle</h6></header><p>blah.</p></section></section><section id="c2s1s1s1s1s3" class="section"><header><h5><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>3</span><span class="sep">. </span>Section 1.1.1.1.3</h5><h6>Subtitle</h6></header><p>blah.</p><section id="c2s1s1s1s1s3s1" class="simplesect"><header><h5>Section 1.1.1.1.3.1</h5><h6>Subtitle</h6></header><p>blah.</p></section></section></section><section id="c2s1s1s1s2" class="section"><header><h5><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>2</span><span class="sep">. </span>Section 1.1.1.2</h5><h6>Subtitle</h6></header><p>blah.</p></section><section id="c2s1s1s1s3" class="section"><header><h5><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>1<span class="sep">.</span>3</span><span class="sep">. </span>Section 1.1.1.3</h5><h6>Subtitle</h6></header><p>blah.</p></section></section><section id="c2s1s1s2" class="section"><header><h4><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>2</span><span class="sep">. </span>Section 1.1.2</h4><h5>Subtitle</h5></header><p>blah.</p></section><section id="c2s1s1s3" class="section"><header><h4><span class="label">1<span class="sep">.</span>1<span class="sep">.</span>3</span><span class="sep">. </span>Section 1.1.3</h4><h5>Subtitle</h5></header><p>blah.</p></section></section><section id="c2s1s2" class="section"><header><h3><span class="label">1<span class="sep">.</span>2</span><span class="sep">. </span>Section 1.2</h3><h4>Subtitle</h4></header><p>blah.</p></section><section id="c2s1s3" class="section"><header><h3><span class="label">1<span class="sep">.</span>3</span><span class="sep">. </span>Section 1.3</h3><h4>Subtitle</h4></header><p>blah.</p></section></section></article></main><nav class="bottom"></nav></body></html>
2 changes: 1 addition & 1 deletion src/test/resources/expected/simplesect.001.html
Original file line number Diff line number Diff line change
@@ -1 +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>Chapter 1. Chapter 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"/></head><body class="home"><nav class="top"></nav><main><article class="chapter component"><header><h1>Chapter <span class="label">1</span><span class="sep"></span>Chapter wrapper</h1></header><div class="db-bfs"><p>This test case is for simplesect.</p></div><section id="R_s1" class="section"><header><h2><span class="label">1</span><span class="sep"></span>A Section Title</h2></header><p>Some content <span class="acronym">here</span>.</p><section class="simplesect"><header><div class="title">First Simplesect</div></header><p>Some content</p></section></section><section id="R_s2" class="section"><header><h2><span class="label">2</span><span class="sep"></span>Another Section Title</h2></header><p>Some content</p><section id="R_s2_s1" class="section"><header><h3><span class="label">2<span class="sep">.</span>1</span><span class="sep"></span>A Subsection Title</h3></header><p>Some content</p><section class="simplesect"><header><div class="title">Second Simplesect</div></header><p>Some content</p></section></section></section></article></main><nav class="bottom"></nav></body></html>
<!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>Chapter 1. Chapter 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"/></head><body class="home"><nav class="top"></nav><main><article class="chapter component"><header><h1>Chapter <span class="label">1</span><span class="sep"></span>Chapter wrapper</h1></header><div class="db-bfs"><p>This test case is for simplesect.</p></div><section id="R_s1" class="section"><header><h2><span class="label">1</span><span class="sep"></span>A Section Title</h2></header><p>Some content <span class="acronym">here</span>.</p><section class="simplesect"><header><h3>First Simplesect</h3></header><p>Some content</p></section></section><section id="R_s2" class="section"><header><h2><span class="label">2</span><span class="sep"></span>Another Section Title</h2></header><p>Some content</p><section id="R_s2_s1" class="section"><header><h3><span class="label">2<span class="sep">.</span>1</span><span class="sep"></span>A Subsection Title</h3></header><p>Some content</p><section class="simplesect"><header><h4>Second Simplesect</h4><h5>Subtitle</h5></header><p>Some content</p></section></section></section></article></main><nav class="bottom"></nav></body></html>
Loading

0 comments on commit e86f67f

Please sign in to comment.