mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Make shr respect privacy when viewing documents with SVG images
(shr-tag-svg): Respect `shr-inhibit-images'. (shr-dom-to-xml): Respect `shr-blocked-images'. Fixes: debbugs:15882
This commit is contained in:
parent
dba6e3ec42
commit
cc477daa01
2 changed files with 13 additions and 3 deletions
|
|
@ -972,11 +972,18 @@ ones, in case fg and bg are nil."
|
|||
(defun shr-dom-to-xml (dom)
|
||||
"Convert DOM into a string containing the xml representation."
|
||||
(let ((arg " ")
|
||||
(text ""))
|
||||
(text "")
|
||||
url)
|
||||
(dolist (sub (cdr dom))
|
||||
(cond
|
||||
((listp (cdr sub))
|
||||
(setq text (concat text (shr-dom-to-xml sub))))
|
||||
;; Ignore external image definitions if required.
|
||||
;; <image xlink:href="http://TRACKING_URL/"/>
|
||||
(when (or (not (eq (car sub) 'image))
|
||||
(not (setq url (cdr (assq ':xlink:href (cdr sub)))))
|
||||
(not shr-blocked-images)
|
||||
(not (string-match shr-blocked-images url)))
|
||||
(setq text (concat text (shr-dom-to-xml sub)))))
|
||||
((eq (car sub) 'text)
|
||||
(setq text (concat text (cdr sub))))
|
||||
(t
|
||||
|
|
@ -990,7 +997,8 @@ ones, in case fg and bg are nil."
|
|||
(car dom))))
|
||||
|
||||
(defun shr-tag-svg (cont)
|
||||
(when (image-type-available-p 'svg)
|
||||
(when (and (image-type-available-p 'svg)
|
||||
(not shr-inhibit-images))
|
||||
(funcall shr-put-image-function
|
||||
(shr-dom-to-xml (cons 'svg cont))
|
||||
"SVG Image")))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue