mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
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:
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user