Skip to content

Commit 2d4711f

Browse files
committed
fix: remove extLst of replaced images
1 parent d399f56 commit 2d4711f

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/stencil/ooxml.clj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@
129129
"http://schemas.microsoft.com/office/powerpoint/2012/main" "p15"
130130
})
131131

132+
;; extension list, used for SVG image reference inside a blip
133+
(def ext-lst :xmlns.http%3A%2F%2Fschemas.openxmlformats.org%2Fdrawingml%2F2006%2Fmain/extLst)
134+
132135
;; drawing, binary large image or picture
133136
(def blip :xmlns.http%3A%2F%2Fschemas.openxmlformats.org%2Fdrawingml%2F2006%2Fmain/blip)
134137
;; hyperlinks

src/stencil/postprocess/images.clj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@
4848
new-val (-> data .relation)]
4949
(assert new-val)
5050
(log/debug "Replacing image relation {} by {}" current-rel new-val)
51-
(assoc-in img-node [:attrs attr-key] new-val)))
51+
(-> img-node
52+
(assoc-in [:attrs attr-key] new-val)
53+
; If placeholder has an SVG graphic, remove so the replacement raster image is used directly:
54+
(update :content remove (comp #{ooxml/ext-lst} :tag)))))
55+
5256

5357
(defn- replace-image [marker-loc]
5458
(if-let [img-loc (->> (zip/remove marker-loc)

0 commit comments

Comments
 (0)