1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.
This commit is contained in:
Maxime Lapointe 2019-05-30 16:46:18 -04:00 committed by aycabta
parent 73904abb95
commit b67b07bd5b
2 changed files with 5 additions and 5 deletions

View file

@ -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>"

View file

@ -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