Skip to content

Commit

Permalink
use a second comprehension for imgAttrs
Browse files Browse the repository at this point in the history
  • Loading branch information
cscheid committed Apr 15, 2024
1 parent 2fd0564 commit 2aaead5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Text/Pandoc/SelfContained.hs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ combineSvgAttrs svgAttrs imgAttrs =
dropPointZero t = case T.stripSuffix ".0" t of
Nothing -> t
Just t' -> t'
combinedAttrs = imgAttrs ++
combinedAttrs =
[(k, v) | (k, v) <- imgAttrs
, k /= "class"] ++
[(k, v) | (k, v) <- svgAttrs
, isNothing (lookup k imgAttrs)
, k `notElem` ["xmlns", "xmlns:xlink", "version", "class"]] ++
Expand All @@ -275,7 +277,6 @@ combineSvgAttrs svgAttrs imgAttrs =
lookup "viewBox" svgAttrs >>= parseViewBox
(mbHeight :: Maybe Int) = lookup "height" combinedAttrs >>= safeRead
(mbWidth :: Maybe Int) = lookup "width" combinedAttrs >>= safeRead
-- https://github.com/jgm/pandoc/issues/9652
mergedClasses = case (lookup "class" imgAttrs, lookup "class" svgAttrs) of
(Just c1, Just c2) -> [("class", c1 <> " " <> c2)]
_ -> []
Expand Down

0 comments on commit 2aaead5

Please sign in to comment.