Skip to content

Commit 34339e2

Browse files
bwhelmfmoralesc
authored andcommitted
Fixes for parenthetical citations (#189)
- Fix parenthetical citations so that it doesn't capture too much. Without this, a parenthetical citation inside a footnote captures the whole footnote. Since we're giving an exhaustive list of all possible characters for citation keys, we should be greedy in matching them. - Change highlighting of citations.
1 parent e9fb387 commit 34339e2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

syntax/pandoc.vim

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,11 @@ syn match pandocAutomaticLink /<\(https\{0,1}.\{-}\|[A-Za-z0-9!#$%&'*+\-/=?^_`{|
269269
"}}}
270270
" Citations: {{{2
271271
" parenthetical citations
272-
syn match pandocPCite /\[.\{-}-\{0,1}@.\{-}\]/ contains=pandocEmphasis,pandocStrong,pandocLatex,pandocCiteKey,@Spell display
272+
syn match pandocPCite /\^\@<!\[[^\[\]]\{-}-\{0,1}@[[:alnum:]_][[:alnum:]äëïöüáéíóúàèìòùłßÄËÏÖÜÁÉÍÓÚÀÈÌÒÙŁß_:.#$%&\-+?<>~\/]*.\{-}\]/ contains=pandocEmphasis,pandocStrong,pandocLatex,pandocCiteKey,@Spell display
273273
" in-text citations with location
274-
syn match pandocICite /@[[:graph:]äëïöüáéíóúàèìòùłßÄËÏÖÜÁÉÍÓÚÀÈÌÒÙŁß]*\s\[.\{-}\]/ contains=pandocCiteKey,@Spell display
274+
syn match pandocICite /@[[:alnum:]_][[:alnum:]äëïöüáéíóúàèìòùłßÄËÏÖÜÁÉÍÓÚÀÈÌÒÙŁß_:.#$%&\-+?<>~\/]*\s\[.\{-1,}\]/ contains=pandocCiteKey,@Spell display
275275
" cite keys
276-
syn match pandocCiteKey /\(-\=@[[:graph:]äëïöüáéíóúàèìòùłßÄËÏÖÜÁÉÍÓÚÀÈÌÒÙŁß]*\)\(\]\|\>\)\@=/ containedin=pandocPCite,pandocICite contains=@NoSpell display
276+
syn match pandocCiteKey /\(-\=@[[:alnum:]_][[:alnum:]äëïöüáéíóúàèìòùłßÄËÏÖÜÁÉÍÓÚÀÈÌÒÙŁß_:.#$%&\-+?<>~\/]*\)/ containedin=pandocPCite,pandocICite contains=@NoSpell display
277277
syn match pandocCiteAnchor /[-@]/ contained containedin=pandocCiteKey display
278278
syn match pandocCiteLocator /[\[\]]/ contained containedin=pandocPCite,pandocICite
279279
" }}}
@@ -569,9 +569,9 @@ hi link pandocFootnoteDefTail Type
569569
hi link pandocFootnoteBlock Comment
570570
hi link pandocFootnoteBlockSeparator Operator
571571

572-
hi link pandocPCite Normal
573-
hi link pandocICite Normal
574-
hi link pandocCiteKey Identifier
572+
hi link pandocPCite Operator
573+
hi link pandocICite Operator
574+
hi link pandocCiteKey Label
575575
hi link pandocCiteAnchor Operator
576576
hi link pandocCiteLocator Operator
577577

0 commit comments

Comments
 (0)