diff options
author | John MacFarlane <jgm@berkeley.edu> | 2018-04-22 12:18:45 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2018-04-22 12:20:25 -0700 |
commit | dab3330a585a55721821a8526a56510011a1145e (patch) | |
tree | 13a7f59d0e81c7b14ad4edbdce11f8054a755358 /src | |
parent | a9a1a5fab3651779e48ae764ac6c53265e791e3d (diff) | |
download | pandoc-dab3330a585a55721821a8526a56510011a1145e.tar.gz |
RST reader: allow < 3 spaces indent under directives.
Closes #4579.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Readers/RST.hs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index 566f9b959..1577908a3 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -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" |