diff options
author | Maxime Lapointe <hunter_spawn@hotmail.com> | 2019-05-30 16:46:18 -0400 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2019-07-14 17:46:16 +0900 |
commit | b67b07bd5bd94433051b5e0a5db800f8b22361b4 (patch) | |
tree | d228a8f792474d215f7f76f3d90a0d39aaf7a85e | |
parent | 73904abb951ad60483124fa620b5561015906a79 (diff) |
Fix links to headings
A previous change made the header's id be fully referenced (for the sidebar I believe) but this broke links to them.
This fixes the issue.
-rw-r--r-- | lib/rdoc/markup/to_html_crossref.rb | 2 | ||||
-rw-r--r-- | test/rdoc/test_rdoc_markup_to_html_crossref.rb | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/rdoc/markup/to_html_crossref.rb b/lib/rdoc/markup/to_html_crossref.rb index 2fbddeb83b..4a1350a73c 100644 --- a/lib/rdoc/markup/to_html_crossref.rb +++ b/lib/rdoc/markup/to_html_crossref.rb @@ -153,7 +153,7 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml ref.sections.any? { |section| label == section.title } then path << "##{label}" else - path << "#label-#{label}" + path << "##{ref.aref}-label-#{label}" end if label "<a href=\"#{path}\">#{text}</a>" diff --git a/test/rdoc/test_rdoc_markup_to_html_crossref.rb b/test/rdoc/test_rdoc_markup_to_html_crossref.rb index 598bae3d3f..3d80980791 100644 --- a/test/rdoc/test_rdoc_markup_to_html_crossref.rb +++ b/test/rdoc/test_rdoc_markup_to_html_crossref.rb @@ -19,7 +19,7 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase def test_convert_CROSSREF_label result = @to.convert 'C1@foo' - assert_equal para("<a href=\"C1.html#label-foo\">foo at <code>C1</code></a>"), result + assert_equal para("<a href=\"C1.html#class-C1-label-foo\">foo at <code>C1</code></a>"), result result = @to.convert 'C1#m@foo' assert_equal para("<a href=\"C1.html#method-i-m-label-foo\">foo at <code>C1#m</code></a>"), @@ -28,12 +28,12 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase def test_convert_CROSSREF_label_period result = @to.convert 'C1@foo.' - assert_equal para("<a href=\"C1.html#label-foo\">foo at <code>C1</code></a>."), result + assert_equal para("<a href=\"C1.html#class-C1-label-foo\">foo at <code>C1</code></a>."), result end def test_convert_CROSSREF_label_space result = @to.convert 'C1@foo+bar' - assert_equal para("<a href=\"C1.html#label-foo+bar\">foo bar at <code>C1</code></a>"), + assert_equal para("<a href=\"C1.html#class-C1-label-foo+bar\">foo bar at <code>C1</code></a>"), result end @@ -104,7 +104,7 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase def test_convert_RDOCLINK_rdoc_ref_label result = @to.convert 'rdoc-ref:C1@foo' - assert_equal para("<a href=\"C1.html#label-foo\">foo at <code>C1</code></a>"), result, + assert_equal para("<a href=\"C1.html#class-C1-label-foo\">foo at <code>C1</code></a>"), result, 'rdoc-ref:C1@foo' end |