Repository navigation
Fix cross-reference id lookups - #92
Merged
Merged
Conversation
Asciidoctor ids are case-sensitive, but adoc--goto-id and adoc--xref-collect searched with the default case-fold-search, and the Antora project-wide search handed grep `-i' for the same reason. So `<<foo>>' could jump to `[[FOO]]', and definitions and references mixed ids that only differ in case.
The `#' in `xref:#id[]' isn't part of the id, but adoc-xref-id-at-point
returned `#id', so following it failed ("Can't find an anchor
defining '#id'") and M-? found no references. Strip it there, and let
adoc--re-xref-to match the `#' form like the Antora search already did.
adoc-re-anchor's inline-special regexp, given an id, only allowed whitespace between the id and the closing `]]', so `[[inl,Inline Ref]]' never matched `inl': completion offered the id (it splits at the comma) but definitions and following came up empty. Allow the reftext, brackets in it included.
xref-backend-identifier-at-point only knew about xrefs and anchors, so M-? on a section title prompted instead of finding the references to that section. It now returns the section's id. That id is the explicit one when the section has one - a block anchor or id right above the title, or an anchor at the end of it - since Asciidoctor then doesn't generate an auto-id at all. For the same reason such sections no longer contribute an auto-id to completion and section lookups; their anchors already define them.
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.
Ids were looked up case-insensitively,
xref:#id[]and[[id,reftext]]couldn't be resolved, andM-?on a section title prompted instead of using the section's id.A section with an explicit id now uses that id and stops offering its auto-id, since Asciidoctor doesn't generate one for it. The rest of the section auto-id differences (duplicate titles,
{attr}in titles,:sectids!:) are left for another time.