git.iko.soy/typeable/pandoc
on master help sign in
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.

commit31435ad3f50ed4c3ab8dcb3bceb40a25846db45e authorJohn MacFarlane <fiddlosopher@gmail.com> dateSat 6 Oct 2012, 20:07 (14 years ago) parentb617cce
1 file changed+3−3
src/Text/Pandoc/Readers/RST.hs+3−3
src/Text/Pandoc/Readers/RST.hs+3−3
@@ -193,9 +193,9 @@ fieldList :: RSTParser Blocks
193193fieldList = try $ do
194194 indent <- lookAhead $ many spaceChar
195195 items <- many1 $ fieldListItem indent
196− if null items
197− then return mempty
198− else return $ B.definitionList $ catMaybes items
196+ case catMaybes items of
197+ [] -> return mempty
198+ items' -> return $ B.definitionList items'
199199
200200--
201201-- line block