yaml / yaml-spec

YAML Specification
http://yaml.org/spec/
348 stars 53 forks source link

Fix duplicate IDs #271

Closed Thom1729 closed 2 years ago

Thom1729 commented 2 years ago

Fix #269.

Sections and definition terms are given autogenerated IDs. In some cases, these IDs were not unique. This is technically invalid HTML, and in addition, it broke some TOC links.

This PR adds a check when creating an autogenerated ID. If the ID already exists, the new ID will be given a numeric suffix. Since the TOC is generated based on the IDs, this fixes the broken TOC links. There is also a new check at the end that will produce warnings if there are any duplicate IDs in the document. Finally, this PR renames “Example 7.12. Separation Spaces” to “Separation Lines”. I think the previous name (a duplicate of an earlier example) was probably mistaken.

A large number of the previously conflicting IDs were definition terms. I think that some of them should be made headings instead, and the remainder probably don't need IDs at all. Another chunk of the duplicated IDs are from splitting out the productions, and many of them will naturally disappear as we revise the earlier parts. If a significant number still remain, it might make sense to add a common prefix to the IDs in the appendix.

The HTML diff is clean; the only changes are IDs, TOC hrefs, and the name of the one example.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Thom1729 commented 2 years ago

https://spec.yaml.io/pr-271/spec/1.3.0/