aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2022-07-23 00:34:09 +0200
committerJohn MacFarlane <[email protected]>2022-07-23 00:34:09 +0200
commit4ea51b6e96e0b04f2e11782002c0ea0950816cc3 (patch)
treefdeeb42a604d4f7f5ed7d0726aa26afaa0a12ef0 /src
parente04ea99326261c1fa935971a864477ce4e4182b1 (diff)
--self-contained: Handle `url()` in style elements.
Previously we handled these in included CSS files but not in style elements. Closes #8193.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/SelfContained.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Text/Pandoc/SelfContained.hs b/src/Text/Pandoc/SelfContained.hs
index c4bf6c8e6..28af691b2 100644
--- a/src/Text/Pandoc/SelfContained.hs
+++ b/src/Text/Pandoc/SelfContained.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE TupleSections #-}
{- |
Module : Text.Pandoc.SelfContained
@@ -62,6 +63,13 @@ convertTags :: PandocMonad m => [Tag T.Text] -> m [Tag T.Text]
convertTags [] = return []
convertTags (t@TagOpen{}:ts)
| fromAttrib "data-external" t == "1" = (t:) <$> convertTags ts
+convertTags (t@(TagOpen "style" _):ts) =
+ case span isTagText ts of
+ (xs,rest) -> do
+ xs' <- mapM (\case
+ TagText s -> TagText . toText <$> cssURLs "" (fromText s)
+ tag -> return tag) xs
+ ((t:xs') ++) <$> convertTags rest
convertTags (t@(TagOpen "script" as):tc@(TagClose "script"):ts) =
case fromAttrib "src" t of
"" -> (t:) <$> convertTags ts