git.iko.soy/typeable/pandoc
on master help sign in
Latex reader: Skip spaces in image options
9046dbaBen Firshman
src/Text/Pandoc/Readers/LaTeX.hs+2
@@ -758,8 +758,10 @@ keyval = try $ do
758 Tok _ Word key <- satisfyTok isWordTok
758 Tok _ Word key <- satisfyTok isWordTok
759 let isSpecSym (Tok _ Symbol t) = t `elem` [".",":","-","|","\\"]
759 let isSpecSym (Tok _ Symbol t) = t `elem` [".",":","-","|","\\"]
760 isSpecSym _ = False
760 isSpecSym _ = False
761+ optional sp
761 val <- option [] $ do
762 val <- option [] $ do
762 symbol '='
763 symbol '='
764+ optional sp
763 braced <|> (many1 (satisfyTok isWordTok <|> satisfyTok isSpecSym
765 braced <|> (many1 (satisfyTok isWordTok <|> satisfyTok isSpecSym
764 <|> anyControlSeq))
766 <|> anyControlSeq))
765 optional sp
767 optional sp
test/Tests/Readers/LaTeX.hs+3
@@ -130,6 +130,9 @@ tests = [ testGroup "basic"
130 , "Image width relative to textsize" =:
130 , "Image width relative to textsize" =:
131 "\\includegraphics[width=0.6\\textwidth]{foo.png}" =?>
131 "\\includegraphics[width=0.6\\textwidth]{foo.png}" =?>
132 para (imageWith ("", [], [("width", "60%")]) "foo.png" "" "image")
132 para (imageWith ("", [], [("width", "60%")]) "foo.png" "" "image")
133+ , "Image with options with spaces" =:
134+ "\\includegraphics[width=12cm, height = 5cm]{foo.png}" =?>
135+ para (imageWith ("", [], [("width", "12cm"), ("height", "5cm")]) "foo.png" "" "image")
133 ]
136 ]
134
137
135 , let hex = ['0'..'9']++['a'..'f'] in
138 , let hex = ['0'..'9']++['a'..'f'] in