Conversation
freshTag inserts Tag.internal but looked up the plain String, which the Coe instance turns into Tag.provided, so the check never matched a tag it had assigned and the numeric suffix was never appended. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017wS1phtpAFaUWUPrQMf1ip
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017wS1phtpAFaUWUPrQMf1ip
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 #897.
Every section in a manual carries a tag: it becomes the section's HTML id and the target that cross-references resolve to, and Verso generates one from the title when the author has not chosen it. Two sections whose titles agree therefore need two different generated tags. They do not get them, and the manual fails to build instead:
The generator,
freshTag, is meant to prevent exactly this: it triesSame, thenSame-0, until it finds a name thatTraverseState.tagsdoes not already hold. That search never finds anything. It looks the candidate up as aString, whichCoe String Tagturns intoTag.provided, while the name it goes on to store is aTag.internal, so it never sees the names it assigned itself and the numeric suffix is never appended.The search was right when the suffix was introduced in e223cfc, where
tagStrreturned aTag. It stopped working in e842684, which changedfreshTagto return aString: the insertion was updated toTag.internal tag, the lookup kept its old shape, and the coercion kept it compiling. Since then any two headings that sluggify to the same string collide. Headings in a non-Latin script collide readily, because every unsupported character becomes___: two Japanese headings of the same length always produce the same slug.This changes the lookup to use the constructor that is stored, and adds two tests to
VersoTests.Tags— two elements with the same hint, and two different Japanese headings. On the current main they produceSame/Sameand______/______; with this change they produceSame/Same-0and______/______-0, and the example above builds, giving the two sectionsTest--SameandTest--Same-0.lake testpasses (649 tests).This picks up #937, which proposed the same one-line change and was closed for lack of response — the failing test and the fuller description asked for there are what this adds.
Drafted with Claude Opus 5