From 8284ec393f409b152e5f9cdbe022a9d4f34d84f7 Mon Sep 17 00:00:00 2001 From: Minjie Xu Date: Fri, 1 May 2020 01:58:49 +0800 Subject: [PATCH] Fix highlights nested in directive body The leading two dots of a RST directive gets matched by rstExplicitMarkup group first, and then the directive name and directive body will be matched by the groups contained in rstDirectives cluster in order. The rstExDirective group in rstDiretives matches any RST directives other than footnote, citation and hyperlink target, therefore admonition and code block will be matched by rstExDirective. This fix has rstExDirective contain rstExplicitMarkup so as to enable recursive RST directives match. The interpreted texts enclosed in quotes are not highlighted within a RST directive body, because the rstCruft cluster contains a non-existing rstInterpretedText group.It should be renamed to rstInterpretedTextOrHyperlinkReference which is defined in a DefineInlineMarkup function call. --- syntax/rst.vim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/syntax/rst.vim b/syntax/rst.vim index 4e1b117..9289dc8 100644 --- a/syntax/rst.vim +++ b/syntax/rst.vim @@ -17,8 +17,9 @@ syn case ignore syn match rstTransition /^[=`:.'"~^_*+#-]\{4,}\s*$/ syn cluster rstCruft contains=rstEmphasis,rstStrongEmphasis, - \ rstInterpretedText,rstInlineLiteral,rstSubstitutionReference, - \ rstInlineInternalTargets,rstFootnoteReference,rstHyperlinkReference + \ rstInterpretedTextOrHyperlinkReference,rstInlineLiteral, + \ rstSubstitutionReference, rstInlineInternalTargets,rstFootnoteReference, + \ rstHyperlinkReference syn region rstLiteralBlock matchgroup=rstDelimiter \ start='\(^\z(\s*\).*\)\@<=::\n\s*\n' skip='^\s*$' end='^\(\z1\s\+\)\@!' @@ -84,7 +85,7 @@ syn region rstHyperlinkTarget matchgroup=rstDirective execute 'syn region rstExDirective contained matchgroup=rstDirective' . \ ' start=+' . s:ReferenceName . '::\_s+' . \ ' skip=+^$+' . - \ ' end=+^\s\@!+ contains=@rstCruft,rstLiteralBlock' + \ ' end=+^\s\@!+ contains=@rstCruft,rstLiteralBlock,rstExplicitMarkup' execute 'syn match rstSubstitutionDefinition contained' . \ ' /|.*|\_s\+/ nextgroup=@rstDirectives'