Skip to content

Encapsulate superclass method link rendering#1741

Merged
st0012 merged 1 commit into
ruby:masterfrom
st0012:codex/encapsulate-superclass-method-link
Jun 23, 2026
Merged

Encapsulate superclass method link rendering#1741
st0012 merged 1 commit into
ruby:masterfrom
st0012:codex/encapsulate-superclass-method-link

Conversation

@st0012

@st0012 st0012 commented Jun 23, 2026

Copy link
Copy Markdown
Member

Problem

While reviewing #1571, I noticed a small follow-up refactoring opportunity in the superclass-method notice rendered by the HTML templates.

Both Aliki and Darkfish were reaching through method.formatter directly to build the superclass method link. That leaves template code responsible for formatter details and makes the escaping boundary less explicit.

Solution

  • Add RDoc::AnyMethod#superclass_method_link as the generator-facing helper for rendering the superclass method link.
  • Escape the visible link text inside that helper while preserving the raw method name for cross-reference lookup.
  • Update the Aliki and Darkfish templates to call the new helper instead of constructing formatter links directly.
  • Cover the helper behavior with a generator markup unit test, including operator method names such as <<.

@st0012 st0012 requested a deployment to fork-preview-protection June 23, 2026 11:17 — with GitHub Actions Waiting
@st0012 st0012 marked this pull request as ready for review June 23, 2026 11:20
Copilot AI review requested due to automatic review settings June 23, 2026 11:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors how the HTML generators render the “Calls superclass method …” link by moving link construction into a generator-facing helper on RDoc::AnyMethod, making escaping behavior explicit and keeping formatter details out of templates.

Changes:

  • Add RDoc::AnyMethod#superclass_method_link to encapsulate superclass-method link rendering (including escaping of visible text).
  • Update Aliki and Darkfish class templates to call superclass_method_link instead of reaching into method.formatter.
  • Add generator markup tests covering normal and operator (<<) method names.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
test/rdoc/generator/markup_test.rb Adds unit tests for superclass_method_link, including operator-name escaping.
lib/rdoc/generator/template/darkfish/class.rhtml Switches superclass-method notice rendering to the new helper.
lib/rdoc/generator/template/aliki/class.rhtml Switches superclass-method notice rendering to the new helper.
lib/rdoc/generator/markup.rb Introduces RDoc::AnyMethod#superclass_method_link for generator use.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/rdoc/generator/markup_test.rb
@st0012 st0012 merged commit daa7768 into ruby:master Jun 23, 2026
28 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants