* [PATCH] shr.el: Add support for SVG elements. @ 2013-06-13 4:21 Rüdiger Sonderfeld 2013-06-16 14:18 ` Lars Magne Ingebrigtsen 0 siblings, 1 reply; 4+ messages in thread From: Rüdiger Sonderfeld @ 2013-06-13 4:21 UTC (permalink / raw) To: ding; +Cc: larsi * lisp/shr.el (shr-dom-to-xml): New function. (shr-tag-svg): Add support for the SVG tag. Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de> --- lisp/shr.el | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/lisp/shr.el b/lisp/shr.el index 0a2c698..68ed95c 100644 --- a/lisp/shr.el +++ b/lisp/shr.el @@ -891,8 +891,31 @@ (defun shr-tag-script (cont) (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</%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))) -- 1.8.3 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] shr.el: Add support for SVG elements. 2013-06-13 4:21 [PATCH] shr.el: Add support for SVG elements Rüdiger Sonderfeld @ 2013-06-16 14:18 ` Lars Magne Ingebrigtsen 2013-06-16 15:14 ` [PATCH] shr.el: Fix function call to `shr-dom-to-xml' Rüdiger Sonderfeld 0 siblings, 1 reply; 4+ messages in thread From: Lars Magne Ingebrigtsen @ 2013-06-16 14:18 UTC (permalink / raw) To: Rüdiger Sonderfeld; +Cc: ding Rüdiger Sonderfeld <ruediger@c-plusplus.de> writes: > * lisp/shr.el (shr-dom-to-xml): New function. > (shr-tag-svg): Add support for the SVG tag. Thanks; applied. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/ ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] shr.el: Fix function call to `shr-dom-to-xml'. 2013-06-16 14:18 ` Lars Magne Ingebrigtsen @ 2013-06-16 15:14 ` Rüdiger Sonderfeld 2013-06-16 15:31 ` Lars Magne Ingebrigtsen 0 siblings, 1 reply; 4+ messages in thread From: Rüdiger Sonderfeld @ 2013-06-16 15:14 UTC (permalink / raw) To: ding; +Cc: larsi Sorry forgot to change all function calls when I renamed it. btw. do you use ert/unit testing? I also have a test case for the function. -- 8< ---------------------------------------------------------------->8 -- * lisp/shr.el (shr-dom-to-xml): Fixed function call. Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de> --- lisp/shr.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/shr.el b/lisp/shr.el index 7f79e1a..fae1742 100644 --- a/lisp/shr.el +++ b/lisp/shr.el @@ -920,7 +920,7 @@ (defun shr-dom-to-xml (dom) (dolist (sub (cdr dom)) (cond ((listp (cdr sub)) - (setq text (concat text (dom-to-text sub)))) + (setq text (concat text (shr-dom-to-xml sub)))) ((eq (car sub) 'text) (setq text (concat text (cdr sub)))) (t -- 1.8.3.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] shr.el: Fix function call to `shr-dom-to-xml'. 2013-06-16 15:14 ` [PATCH] shr.el: Fix function call to `shr-dom-to-xml' Rüdiger Sonderfeld @ 2013-06-16 15:31 ` Lars Magne Ingebrigtsen 0 siblings, 0 replies; 4+ messages in thread From: Lars Magne Ingebrigtsen @ 2013-06-16 15:31 UTC (permalink / raw) To: Rüdiger Sonderfeld; +Cc: ding Rüdiger Sonderfeld <ruediger@c-plusplus.de> writes: > Sorry forgot to change all function calls when I renamed it. Thanks; applied. > btw. do you use ert/unit testing? I also have a test case for the function. Nope; no testing. :-) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/ ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-06-16 15:31 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-06-13 4:21 [PATCH] shr.el: Add support for SVG elements Rüdiger Sonderfeld 2013-06-16 14:18 ` Lars Magne Ingebrigtsen 2013-06-16 15:14 ` [PATCH] shr.el: Fix function call to `shr-dom-to-xml' Rüdiger Sonderfeld 2013-06-16 15:31 ` Lars Magne Ingebrigtsen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).