git.iko.soy/typeable/pandoc
on master help sign in
LaTeX reader: Ignore empty groups {}, { }.

Closes #322.

commitda57775171d3575816f9b6a0d77fe6872e5d89b7 authorJohn MacFarlane <fiddlosopher@gmail.com> dateSat 12 Nov 2011, 13:03 (15 years ago) parent8ed33f6
1 file changed+8
src/Text/Pandoc/Readers/LaTeX.hs+8
src/Text/Pandoc/Readers/LaTeX.hs+8
@@ -574,6 +574,7 @@ inline = choice [ str
574574 , ensureMath
575575 , rawLaTeXInline'
576576 , escapedChar
577+ , emptyGroup
577578 , unescapedChar
578579 , comment
579580 ] <?> "inline"
@@ -677,6 +678,13 @@ escapedChar = do
677678 result <- escaped (oneOf specialChars)
678679 return $ if result == Str "\n" then Str " " else result
679680
681+emptyGroup :: GenParser Char st Inline
682+emptyGroup = try $ do
683+ char '{'
684+ spaces
685+ char '}'
686+ return $ Str ""
687+
680688-- nonescaped special characters
681689unescapedChar :: GenParser Char st Inline
682690unescapedChar = oneOf "`$^&_#{}[]|<>" >>= return . (\c -> Str [c])