git.iko.soy/typeable/pandoc
on master help sign in
RST reader: allow < 3 spaces indent under directives.

Closes #4579.

commitdab3330a585a55721821a8526a56510011a1145e authorJohn MacFarlane <jgm@berkeley.edu> dateSun 22 Apr 2018, 12:18 (9 years ago) parenta9a1a5f
2 files changed+23−3
src/Text/Pandoc/Readers/RST.hs+7−3 test/command/4579.md+16
src/Text/Pandoc/Readers/RST.hs+7−3
@@ -651,11 +651,15 @@ directive' = do
651651 skipMany spaceChar
652652 top <- many $ satisfy (/='\n')
653653 <|> try (char '\n' <*
654− notFollowedBy' (rawFieldListItem 3) <*
655− count 3 (char ' ') <*
654+ notFollowedBy' (rawFieldListItem 1) <*
655+ many1 (char ' ') <*
656656 notFollowedBy blankline)
657657 newline
658− fields <- many $ rawFieldListItem 3
658+ fields <- do
659+ fieldIndent <- length <$> lookAhead (many (char ' '))
660+ if fieldIndent == 0
661+ then return []
662+ else many $ rawFieldListItem fieldIndent
659663 body <- option "" $ try $ blanklines >> indentedBlock
660664 optional blanklines
661665 let body' = body ++ "\n\n"
test/command/4579.mdnew file+16
@@ -0,0 +1,16 @@
1+```
2+% pandoc -f rst -t native
3+.. list-table::
4+ :header-rows: 1
5+
6+ * - Foo
7+ - Bar
8+ * - spam
9+ - ham
10+^D
11+[Table [] [AlignDefault,AlignDefault] [0.0,0.0]
12+ [[Plain [Str "Foo"]]
13+ ,[Plain [Str "Bar"]]]
14+ [[[Plain [Str "spam"]]
15+ ,[Plain [Str "ham"]]]]]
16+```