Skip to content

Commit

Permalink
fix bug 17 from nim-lang#17340
Browse files Browse the repository at this point in the history
  • Loading branch information
a-mr committed Apr 7, 2021
1 parent 4dbb8f1 commit dbdd978
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/packages/docutils/rst.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1752,7 +1752,8 @@ proc whichSection(p: RstParser): RstNodeKind =
return rnCodeBlock
elif currentTok(p).symbol == "::":
return rnLiteralBlock
elif currentTok(p).symbol == ".." and predNL(p):
elif currentTok(p).symbol == ".." and predNL(p) and
nextTok(p).kind in {tkWhite, tkIndent}:
return rnDirective
case currentTok(p).kind
of tkAdornment:
Expand Down
4 changes: 4 additions & 0 deletions tests/stdlib/trstgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ suite "YAML syntax highlighting":
check "(3, 25) Warning: RST style:" in warnings[1]
check "RST style: too many colons for a directive (should be ::)" in warnings[1]

test "not a directive":
let input = "..warning:: I am not a warning."
check input.toHtml == input

test "Anchors, Aliases, Tags":
let input = """.. code-block:: yaml
--- !!map
Expand Down

0 comments on commit dbdd978

Please sign in to comment.