From 2de6e18774ec9f0f15c88ab916d7f501ba13b467 Mon Sep 17 00:00:00 2001 From: Miran Date: Fri, 25 Sep 2020 09:25:47 +0200 Subject: [PATCH] fix #11537, correct parse inline code without surrounding spaces (#15399) --- doc/advopt.txt | 2 +- lib/packages/docutils/rst.nim | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/advopt.txt b/doc/advopt.txt index 8b906298dd..830b8bfc6a 100644 --- a/doc/advopt.txt +++ b/doc/advopt.txt @@ -13,7 +13,7 @@ Advanced commands: //genDepend generate a DOT file containing the module dependency graph //dump dump all defined conditionals and search paths - see also: --dump.format:json (useful with: ` | jq`) + see also: --dump.format:json (useful with: `| jq`) //check checks the project for syntax and semantic Runtime checks (see -x): diff --git a/lib/packages/docutils/rst.nim b/lib/packages/docutils/rst.nim index 123922c99d..56bfe580b3 100644 --- a/lib/packages/docutils/rst.nim +++ b/lib/packages/docutils/rst.nim @@ -507,6 +507,7 @@ proc isInlineMarkupEnd(p: RstParser, markup: string): bool = if not result: return # Rule 4: result = (p.tok[p.idx + 1].kind in {tkIndent, tkWhite, tkEof}) or + (markup in ["``", "`"] and p.tok[p.idx + 1].kind in {tkIndent, tkWhite, tkWord, tkEof}) or (p.tok[p.idx + 1].symbol[0] in {'\'', '\"', ')', ']', '}', '>', '-', '/', '\\', ':', '.', ',', ';', '!', '?', '_'}) @@ -522,6 +523,7 @@ proc isInlineMarkupStart(p: RstParser, markup: string): bool = if not result: return # Rule 1: result = (p.idx == 0) or (p.tok[p.idx - 1].kind in {tkIndent, tkWhite}) or + (markup in ["``", "`"] and p.tok[p.idx - 1].kind in {tkIndent, tkWhite, tkWord}) or (p.tok[p.idx - 1].symbol[0] in {'\'', '\"', '(', '[', '{', '<', '-', '/', ':', '_'}) if not result: