Skip to content

Commit 502ccb6

Browse files
author
christopappas
committed
Merge pull request oreillymedia#202 from oreillymedia/chris
Updating xref-to behavior for div refentry.
2 parents 24aadff + a69a567 commit 502ccb6

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

htmlbook-xsl/xrefgen.xsl

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@
201201
</xsl:template>
202202

203203
<!-- Special xref-to handling for refentries -->
204-
<xsl:template match="h:div[@class='refentry']" mode="xref-to">
204+
<xsl:template match="h:div[contains(@class,'refentry')]" mode="xref-to">
205205
<xsl:choose>
206206
<xsl:when test="descendant::*[@class='refname']">
207207
<!-- Choose the first descendant element with class of refname, if one exists, and wrap in "code" tag -->

htmlbook-xsl/xspec/xrefgen.xspec

+20
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,26 @@ toc:lower-roman
202202

203203
</x:scenario>
204204

205+
<x:scenario label="When an XREF points to a refentry that has other roles">
206+
<x:context mode="xref-to">
207+
<div class="refentry pagebreak-before refentry_nospace">
208+
<header>
209+
<p class="refname">print</p>
210+
<p class="refpurpose">Output some text to stdout.</p>
211+
</header>
212+
<div class="refsynopsisdiv">
213+
<pre class="synopsis">print "<em>Hello World</em>"</pre>
214+
</div>
215+
<div class="refsect1">
216+
<h6>Description</h6>
217+
<p>More description would go here</p>
218+
</div>
219+
</div>
220+
</x:context>
221+
<x:expect label="Generated text should be refname tagged as code"><code class="refentry">print</code></x:expect>
222+
223+
</x:scenario>
224+
205225
<x:scenario label="When an XREF points to a refentry without a refname 'p'">
206226
<x:context mode="xref-to">
207227
<div class="refentry">

0 commit comments

Comments
 (0)