Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using a custom anchor with an empty fragment from multiple sections gives a "Multiple elements have the same ID" error #2531

Closed
jyasskin opened this issue Apr 20, 2023 · 2 comments

Comments

@jyasskin
Copy link
Collaborator

<pre class='metadata'>
Title: Your Spec Title
Shortname: your-spec
Level: 1
Status: w3c/UD
Group: WGNAMEORWHATEVER
Repository: org/repo-name
URL: http://example.com/url-this-spec-will-live-at
Editor: Your Name, Your Company http://example.com/your-company, [email protected], http://example.com/your-personal-website
Abstract: A short description of your spec, one or two sentences.
Complain About: accidental-2119 yes, missing-example-ids yes
Markup Shorthands: markdown yes, css no
</pre>

<pre class="anchors">
urlPrefix: https://tools.ietf.org/html/rfc8941; spec: rfc8941
    type: dfn
        text: structured header; url: #
</pre>

[=Structured Header=]

Section {#section}
----------------------------

[=Structured Header=]

Error:

LINE ~28: Multiple elements have the same ID '60d1f67e0'.
Deduping, but this ID may not be stable across revisions.
@tabatkins
Copy link
Collaborator

Okay it's extremely weird that this happens solely with an empty anchor; changing that to #foo avoids the error. Investigating...

@tabatkins
Copy link
Collaborator

Ah, figured it out. Two overlapping bugs:

  • Because I used the fragment of the href to auto-gen the ID on a elements, I was testing for the fragment and just not generating an ID at all if it lacked on (or, as it turns out, if it had one but it was empty). Fixed now; these now generate the ID ref-for-something. (And everything generated in this step gets deduped properly.)
  • If a link didn't previously have an ID, I generated one via a different process while adding dfn panels. For Reasons I can't rely on the normal deduping here, so I instead hashed some stuff together in a way that should be unique per panel, and appended an increasing number to keep them unique from each other. But this number was accidentally reset per section. Fixed now to constantly increase for a given dfn panel.

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

No branches or pull requests

2 participants