summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/SelfContained.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-07-15 08:15:08 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-07-15 08:16:42 -0700
commitc2ab44af840021c4269e12adcadd53f7345b9192 (patch)
treec2d7e7a3b00d63da1d39a6ddd26b20ed5d6f7174 /src/Text/Pandoc/SelfContained.hs
parent6c32afc3c4c6b4d37759c2c197a6a3350c8f32d4 (diff)
`--self-contained`: Fixed overaggressive CSS minimization.
Previously `--self-contained` wiped out all spaces in CSS, including semantically significant spaces! Closes #2301. Closes #2286.
Diffstat (limited to 'src/Text/Pandoc/SelfContained.hs')
-rw-r--r--src/Text/Pandoc/SelfContained.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Text/Pandoc/SelfContained.hs b/src/Text/Pandoc/SelfContained.hs
index 896e4327a..a77127286 100644
--- a/src/Text/Pandoc/SelfContained.hs
+++ b/src/Text/Pandoc/SelfContained.hs
@@ -103,8 +103,9 @@ parseCSSUrls :: MediaBag -> Maybe String -> FilePath
parseCSSUrls media sourceURL d = B.concat <$> P.many
(pCSSWhite <|> pCSSComment <|> pCSSUrl media sourceURL d <|> pCSSOther)
+-- Note: some whitespace in CSS is significant, so we can't collapse it!
pCSSWhite :: ParsecT ByteString () IO ByteString
-pCSSWhite = P.space >> P.spaces >> return B.empty
+pCSSWhite = B.singleton <$> P.space <* P.spaces
pCSSComment :: ParsecT ByteString () IO ByteString
pCSSComment = P.try $ do