fix #11537, correct parse inline code without surrounding spaces (#15399)

This commit is contained in:
Miran 2020-09-25 09:25:47 +02:00 • committed by GitHub
commit 2de6e18774
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -507,6 +507,7 @@ proc isInlineMarkupEnd(p: RstParser, markup: string): bool =
if not result: if not result:
return # Rule 4: return # Rule 4:
result = (p.tok[p.idx + 1].kind in {tkIndent, tkWhite, tkEof}) or 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 (p.tok[p.idx + 1].symbol[0] in
{'\'', '\"', ')', ']', '}', '>', '-', '/', '\\', ':', '.', ',', ';', '!', {'\'', '\"', ')', ']', '}', '>', '-', '/', '\\', ':', '.', ',', ';', '!',
'?', '_'}) '?', '_'})
@ -522,6 +523,7 @@ proc isInlineMarkupStart(p: RstParser, markup: string): bool =
if not result: if not result:
return # Rule 1: return # Rule 1:
result = (p.idx == 0) or (p.tok[p.idx - 1].kind in {tkIndent, tkWhite}) or 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 (p.tok[p.idx - 1].symbol[0] in
{'\'', '\"', '(', '[', '{', '<', '-', '/', ':', '_'}) {'\'', '\"', '(', '[', '{', '<', '-', '/', ':', '_'})
if not result: if not result: