mirror of
https://github.com/vim/vim.git
synced 2025-10-16 07:24:23 -04:00
runtime(rst): Fix doctest block syntax
A doctest block usually spans multiple lines, e.g. >>> print('this is a Doctest block') this is a Doctest block Remove ``oneline`` argument to syntax region as this requirement is not met. Consequently, also remove ``display`` as the prerequisite (the syntax region is on a single line) is no longer met. ---- Recognise '>>>' inside doctest blocks Recognise subsequent '>>>' prompts in doctest blocks, e.g. >>> print('this is a Doctest block') this is a Doctest block >>> print('this is a second Doctest block') this is a second Doctest block A doctest block usually spans multiple lines, e.g. >>> print('this is a Doctest block') this is a Doctest block related: #18566 Signed-off-by: Kirk Roemer <91125534+kirk-roemer@users.noreply.github.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
c58f91c035
commit
0940465866
@@ -28,8 +28,11 @@ syn region rstQuotedLiteralBlock matchgroup=rstDelimiter
|
|||||||
\ start="::\_s*\n\ze\z([!\"#$%&'()*+,-./:;<=>?@[\]^_`{|}~]\)"
|
\ start="::\_s*\n\ze\z([!\"#$%&'()*+,-./:;<=>?@[\]^_`{|}~]\)"
|
||||||
\ end='^\z1\@!' contains=@NoSpell
|
\ end='^\z1\@!' contains=@NoSpell
|
||||||
|
|
||||||
syn region rstDoctestBlock oneline display matchgroup=rstDelimiter
|
syn region rstDoctestBlock matchgroup=rstDoctestBlockPrompt
|
||||||
\ start='^>>>\s' end='^$'
|
\ start='^>>>\s' end='^$'
|
||||||
|
\ contains=rstDoctestBlockPrompt
|
||||||
|
|
||||||
|
syn match rstDoctestBlockPrompt contained '^>>>\s'
|
||||||
|
|
||||||
syn region rstTable transparent start='^\n\s*+[-=+]\+' end='^$'
|
syn region rstTable transparent start='^\n\s*+[-=+]\+' end='^$'
|
||||||
\ contains=rstTableLines,@rstCruft
|
\ contains=rstTableLines,@rstCruft
|
||||||
@@ -256,6 +259,7 @@ hi def link rstTransition rstSections
|
|||||||
hi def link rstLiteralBlock String
|
hi def link rstLiteralBlock String
|
||||||
hi def link rstQuotedLiteralBlock String
|
hi def link rstQuotedLiteralBlock String
|
||||||
hi def link rstDoctestBlock PreProc
|
hi def link rstDoctestBlock PreProc
|
||||||
|
hi def link rstDoctestBlockPrompt rstDelimiter
|
||||||
hi def link rstTableLines rstDelimiter
|
hi def link rstTableLines rstDelimiter
|
||||||
hi def link rstSimpleTableLines rstTableLines
|
hi def link rstSimpleTableLines rstTableLines
|
||||||
hi def link rstExplicitMarkup rstDirective
|
hi def link rstExplicitMarkup rstDirective
|
||||||
|
Reference in New Issue
Block a user