aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-10-06 20:07:32 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-10-06 20:07:32 -0700
commit31435ad3f50ed4c3ab8dcb3bceb40a25846db45e (patch)
tree5daeac2d62be9feaa71191df1381a60ab918c1ff /src/Text/Pandoc
parentb617cce95ba2da682a5c25bf3420a5dcceb0a0b8 (diff)
downloadpandoc-31435ad3f50ed4c3ab8dcb3bceb40a25846db45e.tar.gz
RST reader: Don't create empty definition list for metadata field lists.
Previously a field list consisting only of metadata fields (author, title, date) would be parsed as an empty DefinitionList, which is not legal in LaTeX and not needed in any format. This patch fixes the problem, which I learned of from http://stackoverflow.com/questions/12762767/modify-variable-in-rst-with-pandoc.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/RST.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 7aed42523..60301ad85 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -193,9 +193,9 @@ fieldList :: RSTParser Blocks
fieldList = try $ do
indent <- lookAhead $ many spaceChar
items <- many1 $ fieldListItem indent
- if null items
- then return mempty
- else return $ B.definitionList $ catMaybes items
+ case catMaybes items of
+ [] -> return mempty
+ items' -> return $ B.definitionList items'
--
-- line block