Closed anntzer closed 7 years ago
Yeah, confirmed. Looks like rstSubstitutionDefinition
is borrowing the rules for single-word references. Thanks for finding it.
This should be fixed now. I've introduced a PhraseReference
definition alongside the single-word ReferencePhrase
. Can you try it out?
Works for me, thanks!
Actually, substitution references may simply contain any character (vertical bars must be escaped of course) (http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#inline-markup). Thus, while I didn't find this explicitly in the text, it is reasonable to believe that their definitions may also contain arbitrary text.
See https://raw.githubusercontent.com/anntzer/mplcursors/master/README.rst /https://github.com/anntzer/mplcursors/blob/master/README.rst (the gitter link) for a real-life example, which indicates that this is indeed docutils' behavior.
Accordingly, can you reopen the issue? Thanks in advance.
I guess it may be possible to hack Define{,One}InlineMarkup to make the make the defined group optionally contained, but I haven't been successful trying that.
Maybe just wildcard the whole thing then? (Maybe also redefine as a region with a skip
for escaped |
?)
Something like this:
execute 'syn match rstSubstitutionDefinition contained' .
\ ' /|.*|\_s\+/ nextgroup=@rstDirectives'
No strong opinion as to the best way to implement this.
I'll do the wildcard for now, and wait for the inevitable problems to emerge :)
Changed in 6da8601 will close if it all looks good.
Well, looks good enough for until next time I find something :-)
The following example is from http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#substitution-definitions:
rst.vim currently does not highlight
.. |The Transparent Society|
as a reference due to the presence of spaces.