Repository navigation
Fix links, xrefs and scripts that font-lock got wrong - #91
Merged
Merged
Conversation
The replacement keywords (`'' apostrophes, `...', `->', `(C)', ...) ran before the inline macros and reserved their text, and the URL, link, xref, footnote and image macros refuse to match across reserved text. So `https://example.org[Bob's page]' wasn't a link at all, and the bare-URL fallback grabbed `https://example.org[Bob' instead. Replacements now run after the macros and cross-references, as the macros may contain them. Macro targets are reserved so replacements and bare URLs leave them alone, and replacements skip attribute lists (link text and the like), whose face is applied to the list as a whole later on. Link text may also hold other already highlighted markup (`[*bold* text]', a code span). A bare URL can't contain brackets, as in Asciidoctor.
The font-lock `<<id,caption>>' regexp let the id run across `>>' to
find a comma, so `<<foo>>, <<bar>>' became one xref with the id
`foo>>' and the caption ` <<bar'. The id now stops at `>' and `,' (it
may still wrap onto a second line), and may start with `_', `#', `/',
`.', `:', `{' or a non-ASCII letter like Asciidoctor's, so
`<<_installation>>' is an xref too.
They were highlighted as unconstrained quotes, whose text may span spaces and lines, so the text between two tildes in `~/.emacs.d/init.el to ~/backup' came out as a subscript. Asciidoctor only takes non-whitespace (`\S+?') between the marks. A new `adoc-script' quote type passes that content regexp to adoc-re-unconstrained-quote.
adoc-facespec-superscript decided whether to raise the text from the subscript's entry (car) but raised it by the superscript's (cadr), a copy-paste slip between the two functions. They now share one adoc-facespec-script.
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 #66. Links lost their highlighting and click keymap whenever their text held an apostrophe, an ellipsis, an arrow or other inline markup, because the replacement keywords ran before the macros and reserved those characters. Running replacements after the macros was the fix with the fewest side effects: a face comparison over about 210 real docs found no regressions, and with
adoc-insert-replacementon, no overlay lands inside a URL or link text anymore.Also in here, since they're the same kind of regexp slip: adjacent
<<xref>>s ran together, and super/subscripts could span whitespace.