From 0604fa297dfdacf32cd8360a0c48651e45c9e566 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 9 Feb 2024 11:59:26 -0800 Subject: Fix id replacements in SVGs with clipping paths. This fixes `--embed-resources` when SVGs have `clip-path` attributes. Closes #9420. --- src/Text/Pandoc/SelfContained.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/Text/Pandoc/SelfContained.hs b/src/Text/Pandoc/SelfContained.hs index 54d49127a..ddb44385a 100644 --- a/src/Text/Pandoc/SelfContained.hs +++ b/src/Text/Pandoc/SelfContained.hs @@ -185,6 +185,10 @@ convertTags (t@(TagOpen tagname as):ts) case T.uncons x of Just ('#', x') -> (k, "#" <> svgid <> "_" <> x') _ -> (k, x) + addIdPrefix ("clip-path", x) = ("clip-path", + case T.stripPrefix "url(#" x of + Just x' -> "url(#" <> svgid <> "_" <> x' + Nothing -> x) addIdPrefix kv = kv let ensureUniqueId (TagOpen tname ats) = TagOpen tname (map addIdPrefix ats) -- cgit v1.2.3