mirror of
https://github.com/vim/vim.git
synced 2025-10-16 07:24:23 -04:00
runtime(rst): Correctly end nested comments
Previously, a comment in a directive block would incorrectly mark all subsequent lines in the directive block as comment, because the syn-region did not check the leading indent. related: #18566 Signed-off-by: Antony Lee <anntzer.lee@gmail.com> Signed-off-by: Marshall Ward <marshall.ward@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
47949b4b46
commit
4e9f16dd1e
@@ -52,7 +52,8 @@ syn cluster rstDirectives contains=rstFootnote,rstCitation,
|
|||||||
\ rstHyperlinkTarget,rstExDirective
|
\ rstHyperlinkTarget,rstExDirective
|
||||||
|
|
||||||
syn match rstExplicitMarkup '^\s*\.\.\_s'
|
syn match rstExplicitMarkup '^\s*\.\.\_s'
|
||||||
\ nextgroup=@rstDirectives,rstComment,rstSubstitutionDefinition
|
\ nextgroup=@rstDirectives,rstSubstitutionDefinition
|
||||||
|
\ contains=rstComment
|
||||||
|
|
||||||
" "Simple reference names are single words consisting of alphanumerics plus
|
" "Simple reference names are single words consisting of alphanumerics plus
|
||||||
" isolated (no two adjacent) internal hyphens, underscores, periods, colons
|
" isolated (no two adjacent) internal hyphens, underscores, periods, colons
|
||||||
@@ -61,10 +62,10 @@ let s:ReferenceName = '[[:alnum:]]\%([-_.:+]\?[[:alnum:]]\+\)*'
|
|||||||
|
|
||||||
syn keyword rstTodo contained FIXME TODO XXX NOTE
|
syn keyword rstTodo contained FIXME TODO XXX NOTE
|
||||||
|
|
||||||
execute 'syn region rstComment contained' .
|
syn region rstComment
|
||||||
\ ' start=/.*/'
|
\ start='\v^\z(\s*)\.\.(\_s+[\[|_]|\_s+.*::)@!' skip=+^$+ end=/^\(\z1 \)\@!/
|
||||||
\ ' skip=+^$+' .
|
\ contains=@Spell,rstTodo
|
||||||
\ ' end=/^\s\@!/ contains=rstTodo'
|
|
||||||
|
|
||||||
execute 'syn region rstFootnote contained matchgroup=rstDirective' .
|
execute 'syn region rstFootnote contained matchgroup=rstDirective' .
|
||||||
\ ' start=+\[\%(\d\+\|#\%(' . s:ReferenceName . '\)\=\|\*\)\]\_s+' .
|
\ ' start=+\[\%(\d\+\|#\%(' . s:ReferenceName . '\)\=\|\*\)\]\_s+' .
|
||||||
|
Reference in New Issue
Block a user