git.iko.soy/typeable/pandoc
on master help sign in
Latex reader: Skip spaces in image options
commit9046dbadb1147a4d9e2b114a2afc1a0292ef7762 authorBen Firshman <ben@firshman.co.uk> dateFri 13 Oct 2017, 16:49 (9 years ago) parentd73fdbf
2 files changed+5
src/Text/Pandoc/Readers/LaTeX.hs+2 test/Tests/Readers/LaTeX.hs+3
src/Text/Pandoc/Readers/LaTeX.hs+2
@@ -758,8 +758,10 @@ keyval = try $ do
758758 Tok _ Word key <- satisfyTok isWordTok
759759 let isSpecSym (Tok _ Symbol t) = t `elem` [".",":","-","|","\\"]
760760 isSpecSym _ = False
761+ optional sp
761762 val <- option [] $ do
762763 symbol '='
764+ optional sp
763765 braced <|> (many1 (satisfyTok isWordTok <|> satisfyTok isSpecSym
764766 <|> anyControlSeq))
765767 optional sp
test/Tests/Readers/LaTeX.hs+3
@@ -130,6 +130,9 @@ tests = [ testGroup "basic"
130130 , "Image width relative to textsize" =:
131131 "\\includegraphics[width=0.6\\textwidth]{foo.png}" =?>
132132 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")
133136 ]
134137
135138 , let hex = ['0'..'9']++['a'..'f'] in