Closed ghost closed 3 years ago
Good catch! Thanks very much for the detailed feedback.
This week is busy for me, but I plan to handle this and your other issues sometime at the end of the week.
Hey!
This week is busy for me, but I plan to handle this and your other issues sometime at the end of the week.
No worries! This (and all the others) have time. Have a nice week and an even more enjoyable weekend!
This seems very reasonable to me, and thanks as well for including the test file.
I noticed that footnotes of the form
[1]
are matched as citations. Below a bugfix which matches them correctly as footnotes.Remark: To literally see that they are matched wrong either a) change the highlighting color of footnotes or citations so they are not the same b) Use https://vim.fandom.com/wiki/Identify_the_syntax_highlighting_group_used_at_the_cursor
Implementation note: The proposed fix uses priority ordering of syntax rules (if multiple rules match the last takes priority) as the regex for citations also matches footnotes. More robust would be to follow the ReST spec [1] and match valid-reference names except numeric-only labels. However, doing a "negative" string match is tricky with regexs...
You don't see it in the diff, but all this commit does is swapping the definitions of rstCitation and rstFootnote (plus adding a comment).
[1] https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#citations