RST reader: allow < 3 spaces indent under directives.

Closes #4579.
This commit is contained in:
John MacFarlane 2018-04-22 12:18:45 -07:00
parent a9a1a5fab3
commit dab3330a58
2 changed files with 23 additions and 3 deletions

View file

@ -651,11 +651,15 @@ directive' = do
skipMany spaceChar
top <- many $ satisfy (/='\n')
<|> try (char '\n' <*
notFollowedBy' (rawFieldListItem 3) <*
count 3 (char ' ') <*
notFollowedBy' (rawFieldListItem 1) <*
many1 (char ' ') <*
notFollowedBy blankline)
newline
fields <- many $ rawFieldListItem 3
fields <- do
fieldIndent <- length <$> lookAhead (many (char ' '))
if fieldIndent == 0
then return []
else many $ rawFieldListItem fieldIndent
body <- option "" $ try $ blanklines >> indentedBlock
optional blanklines
let body' = body ++ "\n\n"

16
test/command/4579.md Normal file
View file

@ -0,0 +1,16 @@
```
% pandoc -f rst -t native
.. list-table::
:header-rows: 1
* - Foo
- Bar
* - spam
- ham
^D
[Table [] [AlignDefault,AlignDefault] [0.0,0.0]
[[Plain [Str "Foo"]]
,[Plain [Str "Bar"]]]
[[[Plain [Str "spam"]]
,[Plain [Str "ham"]]]]]
```