Skip to content

Commit 0940465

Browse files
Kirk Roemerchrisbra
authored andcommitted
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>
1 parent c58f91c commit 0940465

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

runtime/syntax/rst.vim

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ syn region rstQuotedLiteralBlock matchgroup=rstDelimiter
2828
\ start="::\_s*\n\ze\z([!\"#$%&'()*+,-./:;<=>?@[\]^_`{|}~]\)"
2929
\ end='^\z1\@!' contains=@NoSpell
3030

31-
syn region rstDoctestBlock oneline display matchgroup=rstDelimiter
31+
syn region rstDoctestBlock matchgroup=rstDoctestBlockPrompt
3232
\ start='^>>>\s' end='^$'
33+
\ contains=rstDoctestBlockPrompt
34+
35+
syn match rstDoctestBlockPrompt contained '^>>>\s'
3336

3437
syn region rstTable transparent start='^\n\s*+[-=+]\+' end='^$'
3538
\ contains=rstTableLines,@rstCruft
@@ -256,6 +259,7 @@ hi def link rstTransition rstSections
256259
hi def link rstLiteralBlock String
257260
hi def link rstQuotedLiteralBlock String
258261
hi def link rstDoctestBlock PreProc
262+
hi def link rstDoctestBlockPrompt rstDelimiter
259263
hi def link rstTableLines rstDelimiter
260264
hi def link rstSimpleTableLines rstTableLines
261265
hi def link rstExplicitMarkup rstDirective

0 commit comments

Comments
 (0)