Treat SVG images like other image types in 'shr-put-image'
For both SVG and no-SVG builds, this works as expected (in the no-SVG case, it would raise an error which subsequently gets ignored). However, compared to the previous implementation, this lets users resize SVG images just like every other image type (bug#71913). * lisp/net/shr.el (shr-put-image): Don't special-case SVGs.
This commit is contained in:
parent
5389b6a856
commit
f38c42d1c7
1 changed files with 6 additions and 11 deletions
|
@ -1193,23 +1193,18 @@ You can specify the following optional properties:
|
|||
(if (display-graphic-p)
|
||||
(let* ((zoom (or (plist-get flags :zoom)
|
||||
(car shr-image-zoom-levels)))
|
||||
(zoom-function (nth 2 (assq zoom shr-image-zoom-level-alist)))
|
||||
(zoom-function (or (nth 2 (assq zoom shr-image-zoom-level-alist))
|
||||
(error "Unrecognized zoom level %s" zoom)))
|
||||
(data (if (consp spec)
|
||||
(car spec)
|
||||
spec))
|
||||
(content-type (and (consp spec)
|
||||
(cadr spec)))
|
||||
(start (point))
|
||||
(image (cond
|
||||
((eq content-type 'image/svg+xml)
|
||||
(when (image-type-available-p 'svg)
|
||||
(create-image data 'svg t :ascent shr-image-ascent)))
|
||||
(zoom-function
|
||||
(ignore-errors
|
||||
(funcall zoom-function data content-type
|
||||
(plist-get flags :width)
|
||||
(plist-get flags :height))))
|
||||
(t (error "Unrecognized zoom level %s" zoom)))))
|
||||
(image (ignore-errors
|
||||
(funcall zoom-function data content-type
|
||||
(plist-get flags :width)
|
||||
(plist-get flags :height)))))
|
||||
(when image
|
||||
;; The trailing space can confuse shr-insert into not
|
||||
;; putting any space after inline images.
|
||||
|
|
Loading…
Add table
Reference in a new issue