mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 22:10:33 +00:00
* RST: fix directive with fields (#16490) * Update tests/stdlib/trstgen.nim Co-authored-by: Clyybber <darkmine956@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -535,6 +535,17 @@ Test1
|
||||
doAssert count(output1, "<ul ") == 1
|
||||
doAssert count(output1, "</ul>") == 1
|
||||
|
||||
test "Nim (RST extension) code-block":
|
||||
# check that presence of fields doesn't consume the following text as
|
||||
# its code (which is a literal block)
|
||||
let input0 = dedent """
|
||||
.. code-block:: nim
|
||||
:number-lines: 0
|
||||
|
||||
Paragraph1"""
|
||||
let output0 = rstToHtml(input0, {roSupportMarkdown}, defaultConfig())
|
||||
doAssert "<p>Paragraph1</p>" in output0
|
||||
|
||||
test "RST admonitions":
|
||||
# check that all admonitions are implemented
|
||||
let input0 = dedent """
|
||||
|
||||
Reference in New Issue
Block a user