Repository navigation
Use the method aref for source code ids - #1887
Open
sourya2704 wants to merge 1 commit into
Open
sourya2704 wants to merge 1 commit into
sourya2704 wants to merge 1 commit into
Conversation
The source code block of a method had the id "#{html_name}-source".
html_name doesn't include whether the method is a class or instance
method, so a class with both, like Date.httpdate and Date#httpdate,
had two elements with the id httpdate-source.
Use "#{aref}-source" instead, which gives method-c-httpdate-source and
method-i-httpdate-source. Nothing refers to these ids: the source toggle
finds the block by its class.
Fixes ruby#1884
Member
|
This and the two immediately preceding PRs offend the relevant HTML standard, which requires an ID attribute to be unique and non-empty. I can't mark these as bugs, though they are. @st0012, Can these be approved and merged soon? Thanks, |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1884.
Each method's source code block has the id
"#{method.html_name}-source".html_nameis just the escaped method name, so a class with a class method and an instance method of the same name gets the same id twice. On https://docs.ruby-lang.org/en/master/Date.html,Date.httpdateandDate#httpdateboth have:This uses
method.arefinstead, which already has thec/ipart used by the method's own anchor:The change is in both the darkfish and aliki
class.rhtml. Nothing refers to these ids: the source toggle indarkfish.jsandaliki.jsfinds the block with.method-source-codeinside the.method-detail, so the toggle works as before.The new test in
darkfish_test.rbandaliki_test.rbgenerates a class with.parseand#parse, both with source code. It checks for both ids and that the page has no duplicate ids. It fails on both themes without the fix.I also generated docs for a sample class and
lib/rdoc/markupwith both themes and scanned every page for duplicate ids. Apart from the ones fixed in #1886, these source ids were the only duplicates.bundle exec rake normal_testand RuboCop on the changed tests pass.