From e70ac0f34c9f195f6e423b3ac7e54b912e62c71d Mon Sep 17 00:00:00 2001 From: Andrey Makarov Date: Tue, 29 Dec 2020 05:32:11 +0300 Subject: [PATCH] RST: fix directive with fields (#16490) (#16493) * RST: fix directive with fields (#16490) * Update tests/stdlib/trstgen.nim Co-authored-by: Clyybber --- lib/packages/docutils/rst.nim | 3 ++- tests/stdlib/trstgen.nim | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/packages/docutils/rst.nim b/lib/packages/docutils/rst.nim index 7dbcaf482..698d76da1 100644 --- a/lib/packages/docutils/rst.nim +++ b/lib/packages/docutils/rst.nim @@ -1737,7 +1737,8 @@ proc parseDirective(p: var RstParser, flags: DirFlags, ## ## .. warning:: Any of the 3 children may be nil. result = parseDirective(p, flags) - if not isNil(contentParser): + if not isNil(contentParser) and + (currentTok(p).kind != tkIndent or indFollows(p)): var nextIndent = p.tok[tokenAfterNewline(p)-1].ival if nextIndent <= currInd(p): # parse only this line nextIndent = currentTok(p).col diff --git a/tests/stdlib/trstgen.nim b/tests/stdlib/trstgen.nim index c3388ab7d..54a3db202 100644 --- a/tests/stdlib/trstgen.nim +++ b/tests/stdlib/trstgen.nim @@ -535,6 +535,17 @@ Test1 doAssert count(output1, "