зеркало из https://github.com/github/ruby.git
[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:
Родитель
83a822f70f
Коммит
3833d0fee6
|
@ -36,7 +36,7 @@
|
|||
unless table.empty? then %>
|
||||
<ul>
|
||||
<%- 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 -%>
|
||||
</ul>
|
||||
<%- end -%>
|
||||
|
|
|
@ -113,7 +113,9 @@ class TestRDocGeneratorDarkfish < RDoc::TestCase
|
|||
refute_match(/Ignored/, File.binread('index.html'))
|
||||
summary = File.binread('index.html')[%r[<summary.*Klass\.html.*</summary>.*</details>]m]
|
||||
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(
|
||||
%r[<li>\s*<details open>\s*<summary>\s*<a href=\S+>Heading 1</a>\s*</summary>\s*<ul]m,
|
||||
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,
|
||||
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
|
||||
|
||||
def test_generate_page
|
||||
|
|
Загрузка…
Ссылка в новой задаче