зеркало из https://github.com/github/ruby.git
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:
Родитель
73904abb95
Коммит
b67b07bd5b
|
@ -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>"
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче