fixes rst parsing Markdown CodeblockFields blocking the loop (#24128)

```nim
import packages/docutils/[rst, rstgen]

let message = """```llvm-profdata"""

echo rstgen.rstToHtml(message, {roSupportMarkdown}, nil)
```
This commit is contained in:
ringabout
2024-09-18 23:35:46 +08:00
committed by GitHub
parent 04ccd2f4f0
commit c759d7abd1
2 changed files with 13 additions and 1 deletions

View File

@@ -1526,7 +1526,7 @@ proc parseMarkdownCodeblockFields(p: var RstParser): PRstNode =
result = nil
else:
result = newRstNode(rnFieldList)
while currentTok(p).kind != tkIndent:
while currentTok(p).kind notin {tkIndent, tkEof}:
if currentTok(p).kind == tkWhite:
inc p.idx
else:

View File

@@ -16,6 +16,8 @@ discard """
[Suite] RST escaping
[Suite] RST inline markup
[Suite] Misc isssues
'''
matrix: "--mm:refc; --mm:orc"
"""
@@ -1980,3 +1982,13 @@ suite "RST inline markup":
rnLeaf ')'
""")
check(warnings[] == @["input(1, 5) Warning: broken link 'f'"])
suite "Misc isssues":
test "Markdown CodeblockFields in one line (lacking enclosing ```)":
let message = """
```llvm-profdata merge first.profraw second.profraw third.profraw <more stuff maybe> -output data.profdata```"""
try:
echo rstgen.rstToHtml(message, {roSupportMarkdown}, nil)
except EParseError:
discard