[ruby/rdoc] Fix references to nested label in table_of_contents
Fixes https://github.com/ruby/rdoc/pull/1000 https://github.com/ruby/rdoc/commit/291e2b7e8b
This commit is contained in:
parent
83a822f70f
commit
3833d0fee6
@ -36,7 +36,7 @@
|
|||||||
unless table.empty? then %>
|
unless table.empty? then %>
|
||||||
<ul>
|
<ul>
|
||||||
<%- table.each do |item| -%>
|
<%- table.each do |item| -%>
|
||||||
<li><a href="<%= klass.path %>#<%= item.aref %>"><%= item.plain_html %></a>
|
<li><a href="<%= klass.path %>#<%= item.label(klass) %>"><%= item.plain_html %></a>
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
</ul>
|
</ul>
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
|
@ -113,7 +113,9 @@ class TestRDocGeneratorDarkfish < RDoc::TestCase
|
|||||||
refute_match(/Ignored/, File.binread('index.html'))
|
refute_match(/Ignored/, File.binread('index.html'))
|
||||||
summary = File.binread('index.html')[%r[<summary.*Klass\.html.*</summary>.*</details>]m]
|
summary = File.binread('index.html')[%r[<summary.*Klass\.html.*</summary>.*</details>]m]
|
||||||
assert_match(%r[Klass/Inner\.html".*>Inner<], summary)
|
assert_match(%r[Klass/Inner\.html".*>Inner<], summary)
|
||||||
klassnav = File.binread('Klass.html')[%r[<div class="nav-section">.*<div id="class-metadata">]m]
|
|
||||||
|
klass = File.binread('Klass.html')
|
||||||
|
klassnav = klass[%r[<div class="nav-section">.*<div id="class-metadata">]m]
|
||||||
assert_match(
|
assert_match(
|
||||||
%r[<li>\s*<details open>\s*<summary>\s*<a href=\S+>Heading 1</a>\s*</summary>\s*<ul]m,
|
%r[<li>\s*<details open>\s*<summary>\s*<a href=\S+>Heading 1</a>\s*</summary>\s*<ul]m,
|
||||||
klassnav
|
klassnav
|
||||||
@ -122,6 +124,14 @@ class TestRDocGeneratorDarkfish < RDoc::TestCase
|
|||||||
%r[<li>\s*<a href=\S+>Heading 1.1.1.1</a>\s*</ul>\s*</details>\s*</li>]m,
|
%r[<li>\s*<a href=\S+>Heading 1.1.1.1</a>\s*</ul>\s*</details>\s*</li>]m,
|
||||||
klassnav
|
klassnav
|
||||||
)
|
)
|
||||||
|
|
||||||
|
assert_match(/<h1 id="class-Klass-label-Heading\+1">Heading 1(?!\.)/,
|
||||||
|
klass[%r[<section class=\"description\">.*</section>]m])
|
||||||
|
toc = File.binread('table_of_contents.html')
|
||||||
|
assert_match(
|
||||||
|
%r[<a\s+href="Klass\.html#class-Klass-label-Heading\+1">Heading 1</a>]m,
|
||||||
|
toc[%r[<h2\s+id=\"classes\">.*(?=<h2\b)]m][%r[<a\s+href="Klass\.html".*(?=</li\b)]m]
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_generate_page
|
def test_generate_page
|
||||||
|
Loading…
x
Reference in New Issue
Block a user