restyle RST option lists (#17637)

* WIP: restyle RST option lists

* apply similar style to Latex

* fix tests

* minor visual tweaks

* update tests

* remove leftover comments
This commit is contained in:
Andrey Makarov 2021-04-10 10:49:01 +03:00 • committed by GitHub
commit 2150cd1826
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 103 additions and 21 deletions

View file

@ -2085,6 +2085,7 @@ proc parseBulletList(p: var RstParser): PRstNode =
proc parseOptionList(p: var RstParser): PRstNode =
result = newRstNodeA(p, rnOptionList)
let col = currentTok(p).col
var order = 1
while true:
if currentTok(p).col == col and isOptionList(p):
var a = newRstNode(rnOptionGroup)
@ -2107,6 +2108,7 @@ proc parseOptionList(p: var RstParser): PRstNode =
if currentTok(p).kind == tkIndent: inc p.idx
c.add(a)
c.add(b)
c.order = order; inc order
result.add(c)
else:
if currentTok(p).kind != tkEof: dec p.idx # back to tkIndent