From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/83316 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?R=FCdiger?= Sonderfeld Newsgroups: gmane.emacs.gnus.general Subject: [PATCH] shr.el: Add support for SVG elements. Date: Thu, 13 Jun 2013 06:21:59 +0200 Message-ID: <2078521.h7ZcY5jiiK@descartes> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1371098447 30253 80.91.229.3 (13 Jun 2013 04:40:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Jun 2013 04:40:47 +0000 (UTC) Cc: larsi@gnus.org To: ding@gnus.org Original-X-From: ding-owner+M31582@lists.math.uh.edu Thu Jun 13 06:40:47 2013 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UmzL4-0005nv-D0 for ding-account@gmane.org; Thu, 13 Jun 2013 06:40:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1UmzJ6-0002x2-Fg; Wed, 12 Jun 2013 23:38:44 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1Umz33-0002sI-NY for ding@lists.math.uh.edu; Wed, 12 Jun 2013 23:22:09 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1Umz32-0006HM-2O for ding@lists.math.uh.edu; Wed, 12 Jun 2013 23:22:09 -0500 Original-Received: from ptmx.org ([178.63.28.110]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1Umz30-0006zI-2W; Thu, 13 Jun 2013 06:22:06 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ptmx.org (Postfix) with ESMTP id C774D21669; Thu, 13 Jun 2013 06:22:05 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at ptmx.org Original-Received: from ptmx.org ([127.0.0.1]) by localhost (ptmx.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IZ4+tYKi2Cxr; Thu, 13 Jun 2013 06:22:04 +0200 (CEST) Original-Received: from descartes.localnet (chello080108246092.7.14.vie.surfer.at [80.108.246.92]) by ptmx.org (Postfix) with ESMTPSA id E39C121464; Thu, 13 Jun 2013 06:22:03 +0200 (CEST) User-Agent: KMail/4.10.3 (Linux/3.8.0-23-generic; KDE/4.10.3; x86_64; ; ) X-Spam-Score: -0.0 (/) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:83316 Archived-At: * lisp/shr.el (shr-dom-to-xml): New function. (shr-tag-svg): Add support for the SVG tag. Signed-off-by: R=C3=BCdiger Sonderfeld --- 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) ) =20 +(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=3D\"%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"))) =20 (defun shr-tag-sup (cont) (let ((start (point))) --=20 1.8.3