From 633e589a975b90dd5639b26b992f0fc9f42e4e4b Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Sat, 22 Nov 2025 10:49:32 +0000 Subject: [PATCH 1/2] Remove outdated go-to-top link feature --- lib/rdoc/generator/template/aliki/class.rhtml | 5 +-- lib/rdoc/generator/template/aliki/index.rhtml | 2 +- lib/rdoc/generator/template/aliki/js/aliki.js | 2 +- lib/rdoc/generator/template/aliki/page.rhtml | 2 +- lib/rdoc/markup/to_html.rb | 3 +- test/rdoc/generator/markup_test.rb | 3 +- test/rdoc/markup/to_html_test.rb | 32 +++++++------------ 7 files changed, 17 insertions(+), 32 deletions(-) diff --git a/lib/rdoc/generator/template/aliki/class.rhtml b/lib/rdoc/generator/template/aliki/class.rhtml index 593b96db22..0d6fbe25ba 100644 --- a/lib/rdoc/generator/template/aliki/class.rhtml +++ b/lib/rdoc/generator/template/aliki/class.rhtml @@ -1,4 +1,4 @@ - + <%= render '_header.rhtml' %> <%= render '_sidebar_toggle.rhtml' %> @@ -43,9 +43,6 @@

<%= section.title %>

- - ↑ top - <%- end %> diff --git a/lib/rdoc/generator/template/aliki/index.rhtml b/lib/rdoc/generator/template/aliki/index.rhtml index 1b6051d4d6..b86154a33e 100644 --- a/lib/rdoc/generator/template/aliki/index.rhtml +++ b/lib/rdoc/generator/template/aliki/index.rhtml @@ -1,4 +1,4 @@ - + <%= render '_header.rhtml' %> <%= render '_sidebar_toggle.rhtml' %> diff --git a/lib/rdoc/generator/template/aliki/js/aliki.js b/lib/rdoc/generator/template/aliki/js/aliki.js index af851900c4..f0c10e7c42 100644 --- a/lib/rdoc/generator/template/aliki/js/aliki.js +++ b/lib/rdoc/generator/template/aliki/js/aliki.js @@ -191,7 +191,7 @@ function generateToc() { const link = document.createElement('a'); link.href = `#${heading.id}`; link.className = 'toc-link'; - link.textContent = heading.textContent.replace(/¶.*$/, '').trim(); // Remove pilcrow and "top" links + link.textContent = heading.textContent.replace(/¶.*$/, '').trim(); // Remove pilcrow link link.setAttribute('data-target', heading.id); li.appendChild(link); diff --git a/lib/rdoc/generator/template/aliki/page.rhtml b/lib/rdoc/generator/template/aliki/page.rhtml index 8581cdc0a9..f4a752fe6e 100644 --- a/lib/rdoc/generator/template/aliki/page.rhtml +++ b/lib/rdoc/generator/template/aliki/page.rhtml @@ -1,4 +1,4 @@ - + <%= render '_header.rhtml' %> <%= render '_sidebar_toggle.rhtml' %> diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb index a949c53e41..409c46d3a1 100644 --- a/lib/rdoc/markup/to_html.rb +++ b/lib/rdoc/markup/to_html.rb @@ -314,8 +314,7 @@ def accept_heading(heading) end @res << to_html(heading.text) unless @options.pipe then - @res << "" - @res << " " + @res << "" end @res << "\n" end diff --git a/test/rdoc/generator/markup_test.rb b/test/rdoc/generator/markup_test.rb index 682214267b..f86f5be446 100644 --- a/test/rdoc/generator/markup_test.rb +++ b/test/rdoc/generator/markup_test.rb @@ -38,8 +38,7 @@ def test_cvs_url def test_description @comment = '= Hello' - links = ' ' + - '' + links = '' assert_equal "\n

Hello#{links}

\n", description end diff --git a/test/rdoc/markup/to_html_test.rb b/test/rdoc/markup/to_html_test.rb index caa11c3e7f..e78c082806 100644 --- a/test/rdoc/markup/to_html_test.rb +++ b/test/rdoc/markup/to_html_test.rb @@ -24,44 +24,38 @@ def accept_document end def accept_heading - links = ' ' + - '' + links = '' expected = "\n
Hello#{links}
\n" assert_equal expected, @to.res.join end def accept_heading_1 - links = ' ' + - '' + links = '' assert_equal "\n

Hello#{links}

\n", @to.res.join end def accept_heading_2 - links = ' ' + - '' + links = '' assert_equal "\n

Hello#{links}

\n", @to.res.join end def accept_heading_3 - links = ' ' + - '' + links = '' assert_equal "\n

Hello#{links}

\n", @to.res.join end def accept_heading_4 - links = ' ' + - '' + links = '' assert_equal "\n

Hello#{links}

\n", @to.res.join end def accept_heading_b - links = ' ' + - '' + links = '' inner = "Hello" assert_equal "\n

#{inner}#{links}

\n", @@ -69,8 +63,7 @@ def accept_heading_b end def accept_heading_suppressed_crossref - links = ' ' + - '' + links = '' assert_equal "\n

Hello#{links}

\n", @to.res.join end @@ -348,8 +341,7 @@ def test_accept_heading_7 @to.accept_heading @RM::Heading.new(7, 'Hello') - links = ' ' + - '' + links = '' assert_equal "\n
Hello#{links}
\n", @to.res.join end @@ -360,8 +352,7 @@ def test_accept_heading_aref_class @to.accept_heading head(1, 'Hello') - links = ' ' + - '' + links = '' assert_equal "\n

Hello#{links}

\n", @to.res.join @@ -373,8 +364,7 @@ def test_accept_heading_aref_method @to.accept_heading @RM::Heading.new(1, 'Hello') - links = ' ' + - '' + links = '' assert_equal "\n

Hello#{links}

\n", @to.res.join @@ -437,7 +427,7 @@ def test_accept_heading_output_decoration @to.accept_heading @RM::Heading.new(1, 'Hello') - assert_equal "\n

Hello

\n", @to.res.join + assert_equal "\n

Hello

\n", @to.res.join end def test_accept_heading_output_decoration_with_pipe From f183f9bd0b2abf7f3022e423d12492190df6c85e Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Sat, 22 Nov 2025 16:52:47 +0000 Subject: [PATCH 2/2] Make headers/method names directly linkable instead of using pilcrow items --- lib/rdoc/generator/template/aliki/class.rhtml | 8 +-- .../generator/template/aliki/css/rdoc.css | 61 ++++++------------- lib/rdoc/generator/template/aliki/js/aliki.js | 2 +- lib/rdoc/markup/to_html.rb | 9 ++- test/rdoc/generator/darkfish_test.rb | 4 +- test/rdoc/generator/markup_test.rb | 4 +- test/rdoc/markup/to_html_test.rb | 42 ++++--------- 7 files changed, 45 insertions(+), 85 deletions(-) diff --git a/lib/rdoc/generator/template/aliki/class.rhtml b/lib/rdoc/generator/template/aliki/class.rhtml index 0d6fbe25ba..2f721a5610 100644 --- a/lib/rdoc/generator/template/aliki/class.rhtml +++ b/lib/rdoc/generator/template/aliki/class.rhtml @@ -41,7 +41,7 @@ <%- if section.title then %>

- <%= section.title %> + <%= section.title %>

<%- end %> @@ -55,7 +55,7 @@ <%- unless constants.empty? then %>
-

Constants

+

Constants

<%- constants.each do |const| %> @@ -80,7 +80,7 @@ <%- unless attributes.empty? then %>
-

Attributes

+

Attributes

<%- attributes.each do |attrib| %> @@ -115,7 +115,7 @@ next if methods.empty? %>