emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] patch for htmlize.el


From: Eric Schulte
Subject: [O] patch for htmlize.el
Date: Mon, 20 May 2013 18:16:08 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Hi,

I'd like to commit the following patch which improves htmlize's handling
of svg image overlays.  I couldn't find an upstream for htmlize, is it
appropriate to patch htmlize in the Org-mode source tree?

Thanks,

>From 4611b177def45bf23c2cfb1caf0b12baa5e0e91b Mon Sep 17 00:00:00 2001
From: Eric Schulte <address@hidden>
Date: Mon, 20 May 2013 18:15:05 -0600
Subject: [PATCH] export inline svg images with htmlize

---
 contrib/lisp/htmlize.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/contrib/lisp/htmlize.el b/contrib/lisp/htmlize.el
index c03d605..3bf5949 100644
--- a/contrib/lisp/htmlize.el
+++ b/contrib/lisp/htmlize.el
@@ -601,10 +601,12 @@ list."
                      (htmlize-attr-escape (file-relative-name file))
                      alt-attr)))
           ((plist-get imgprops :data)
-           (format "<img src=\"data:image/%s;base64,%s\"%s />"
-                   (or (plist-get imgprops :type) "")
-                   (base64-encode-string (plist-get imgprops :data))
-                   alt-attr)))))
+          (if (equalp (plist-get imgprops :type) 'svg)
+              (plist-get imgprops :data)
+            (format "<img src=\"data:image/%s;base64,%s\"%s />"
+                    (or (plist-get imgprops :type) "")
+                    (base64-encode-string (plist-get imgprops :data))
+                    alt-attr))))))
 
 (defconst htmlize-ellipsis "...")
 (put-text-property 0 (length htmlize-ellipsis) 'htmlize-ellipsis t 
htmlize-ellipsis)
-- 
1.8.2.3

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

reply via email to

[Prev in Thread] Current Thread [Next in Thread]