From: Rüdiger Sonderfeld Date: Sun, 16 Jun 2013 14:18:02 +0000 (+0200) Subject: Add support for SVG images X-Git-Url: http://cgit.sxemacs.org/?p=gnus;a=commitdiff_plain;h=e0f550aa54ba0ea2e35a2fbafa8157e64f563746 Add support for SVG images * shr.el (shr-dom-to-xml): (shr-dom-to-xml): New function. (shr-tag-svg): Add support for the SVG tag. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7a1d4b1a1..2b2b63c1c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-06-16 Rüdiger Sonderfeld + + * shr.el (shr-dom-to-xml): (shr-dom-to-xml): New function. + (shr-tag-svg): Add support for the SVG tag. + 2013-06-16 Lars Magne Ingebrigtsen * shr.el (shr-expand-url): Respect // URLs. diff --git a/lisp/shr.el b/lisp/shr.el index 7ed57785e..517390865 100644 --- a/lisp/shr.el +++ b/lisp/shr.el @@ -905,8 +905,31 @@ ones, in case fg and bg are nil." (defun shr-tag-comment (cont) ) +(defun shr-dom-to-xml (dom) + "Convert DOM into a string containing the xml representation." + (let ((arg " ") + (text "")) + (dolist (sub (cdr dom)) + (cond + ((listp (cdr sub)) + (setq text (concat text (dom-to-text sub)))) + ((eq (car sub) 'text) + (setq text (concat text (cdr sub)))) + (t + (setq arg (concat arg (format "%s=\"%s\" " + (substring (symbol-name (car sub)) 1) + (cdr sub))))))) + (format "<%s%s>%s" + (car dom) + (substring arg 0 (1- (length arg))) + text + (car dom)))) + (defun shr-tag-svg (cont) - ) + (when (image-type-available-p 'svg) + (funcall shr-put-image-function + (shr-dom-to-xml (cons 'svg cont)) + "SVG Image"))) (defun shr-tag-sup (cont) (let ((start (point)))