Skip to content

Commit 2562568

Browse files
committed
fixup! Enable cross reference in code
1 parent 39e65ac commit 2562568

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

lib/rdoc/markup/to_html_crossref.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,13 @@ def convert_flow(flow)
182182
case item
183183
when RDoc::Markup::AttrChanger then
184184
# Make "+Class#method+" a cross reference
185-
if respond_to?(:cross_reference) and
186-
tt_tag?(item.turn_on) and
187-
String === (str = flow[i]) and
185+
if tt_tag?(item.turn_on) and
186+
String === (text = flow[i]) and
188187
RDoc::Markup::AttrChanger === flow[i+1] and
189188
tt_tag?(flow[i+1].turn_off, true) and
190-
(text = cross_reference str) != str
189+
(@options.hyperlink_all ? ALL_CROSSREF_REGEXP : CROSSREF_REGEXP).match?(text)
191190
then
191+
text = cross_reference text
192192
text = yield text, res if defined?(yield)
193193
res << text
194194
i += 2

test/rdoc/test_rdoc_markup_to_html_crossref.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ def test_convert_CROSSREF
1717
assert_equal para("<a href=\"C1.html\"><code>C1</code></a>"), result
1818

1919
result = @to.convert '+C1+'
20-
2120
assert_equal para("<a href=\"C1.html\"><code>C1</code></a>"), result
21+
22+
result = @to.convert '<tt># :stopdoc:</tt>:'
23+
assert_equal para("<code># :stopdoc:</code>:"), result
2224
end
2325

2426
def test_convert_CROSSREF_method

0 commit comments

Comments
 (0)