Skip to content

Commit 0d64bd5

Browse files
committed
Fix gen_url for non-rdoc-ref links. Issue #56
1 parent 06bf78d commit 0d64bd5

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

History.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Bug fixes
44
* Fix RDoc::Markup parser for a header followed by a non-text token. Issue
55
#56 by Adam Tait
6+
* Fix RDoc::Markup::ToHtmlCrossref#gen_url for non-<tt>rdoc-ref</tt> links.
67
* Fix bug report URL when rdoc crashes.
78

89
=== 3.9 / 2011-07-30

lib/rdoc/markup/to_html_crossref.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def handle_special_HYPERLINK special
9797
# RDoc::Markup::ToHtml to handle other schemes.
9898

9999
def gen_url url, text
100-
super unless url =~ /\Ardoc-ref:/
100+
return super unless url =~ /\Ardoc-ref:/
101101

102102
cross_reference $', text
103103
end

test/test_rdoc_markup_to_html_crossref.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ def test_convert_HYPERLINK_rdoc_ref
2525
assert_equal "\n<p><a href=\"C1.html\">C1</a></p>\n", result
2626
end
2727

28+
def test_gen_url
29+
assert_equal '<a href="C1.html">Some class</a>',
30+
@to.gen_url('rdoc-ref:C1', 'Some class')
31+
32+
assert_equal '<a href="http://example">HTTP example</a>',
33+
@to.gen_url('http://example', 'HTTP example')
34+
end
35+
2836
def test_handle_special_CROSSREF
2937
assert_equal "<a href=\"C2/C3.html\">C2::C3</a>", SPECIAL('C2::C3')
3038
end

0 commit comments

Comments
 (0)