From f02e159b56aaa63713991c0a7f8e7125e91c832e Mon Sep 17 00:00:00 2001 From: Andrey Makarov Date: Sun, 4 Apr 2021 21:54:26 +0300 Subject: [PATCH] fix rst option list at EOF (follow-up #17442) (#17638) --- lib/packages/docutils/rst.nim | 2 +- tests/stdlib/trstgen.nim | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/packages/docutils/rst.nim b/lib/packages/docutils/rst.nim index 66efa3a3c5..dfa2f12beb 100644 --- a/lib/packages/docutils/rst.nim +++ b/lib/packages/docutils/rst.nim @@ -2067,7 +2067,7 @@ proc parseOptionList(p: var RstParser): PRstNode = c.add(b) result.add(c) else: - dec p.idx # back to tkIndent + if currentTok(p).kind != tkEof: dec p.idx # back to tkIndent break proc parseDefinitionList(p: var RstParser): PRstNode = diff --git a/tests/stdlib/trstgen.nim b/tests/stdlib/trstgen.nim index ad0c27f059..57dacdf115 100644 --- a/tests/stdlib/trstgen.nim +++ b/tests/stdlib/trstgen.nim @@ -1362,6 +1362,7 @@ Test1 output) check("""-doption""" in output) + check "

option

" notin output test "Option list 3 (double /)": let input = dedent """ @@ -1378,6 +1379,7 @@ Test1 output) check("""-doption""" in output) + check "

option

" notin output test "Roles: subscript prefix/postfix": let expected = "See some text."