Skip to content

Skip legacy anchors that duplicate the new id - #1886

Open
sourya2704 wants to merge 1 commit into
ruby:masterfrom
sourya2704:fix-duplicate-legacy-anchor-ids
Open

sourya2704 wants to merge 1 commit into
ruby:masterfrom
sourya2704:fix-duplicate-legacy-anchor-ids

Conversation

@sourya2704

Copy link
Copy Markdown

Fixes #1883.

Class pages put a legacy anchor with klass.legacy_aref before the heading with klass.aref. For a class whose name is all lowercase, both are the same, so fatal.html has id="class-fatal" twice:

<span id="class-fatal" class="legacy-anchor"></span>
<h1 id="class-fatal" class="anchor-link class page-title">

Sections have the same problem when the title is a single lowercase word. section.legacy_aref and section.aref are then both foo. In darkfish the duplicate is the <section> id, and in aliki it's the section's <h2> id.

This only emits the legacy anchor when it differs from the new id, in the darkfish and aliki class templates. The new tests generate a lowercase class with a lowercase section and check that the page has no duplicate ids.

bundle exec rake normal_test passes.

#1884 (duplicate *-source ids for method source code) is a different problem and isn't changed here.

Class pages put a legacy-anchor span with klass.legacy_aref before the
heading with klass.aref. For a class whose name is all lowercase, like
fatal, both are class-fatal, so the page has a duplicate id. The same
happens for sections whose title is a single lowercase word.

Only emit the legacy anchor when it differs from the new id, in both
the darkfish and aliki templates.

Fixes ruby#1883

This branch has not been deployed

No deployments
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.

Page has duplicate id values

1 participant