emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* patch for htmlize.el
@ 2013-05-21  0:16 Eric Schulte
  2013-05-21  6:49 ` Carsten Dominik
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Schulte @ 2013-05-21  0:16 UTC (permalink / raw)
  To: Org Mode Mailing List

[-- Attachment #1: Type: text/plain, Size: 217 bytes --]

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,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-export-inline-svg-images-with-htmlize.patch --]
[-- Type: text/x-patch, Size: 1257 bytes --]

From 4611b177def45bf23c2cfb1caf0b12baa5e0e91b Mon Sep 17 00:00:00 2001
From: Eric Schulte <schulte.eric@gmail.com>
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


[-- Attachment #3: Type: text/plain, Size: 46 bytes --]


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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: patch for htmlize.el
  2013-05-21  0:16 patch for htmlize.el Eric Schulte
@ 2013-05-21  6:49 ` Carsten Dominik
  2013-05-21 10:25   ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Carsten Dominik @ 2013-05-21  6:49 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org Mode Mailing List

Yes, that is all right at least for now, please go ahead.

Thanks!

- Carsten

On 21 mei 2013, at 02:16, Eric Schulte <schulte.eric@gmail.com> wrote:

> 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 <schulte.eric@gmail.com>
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: patch for htmlize.el
  2013-05-21  6:49 ` Carsten Dominik
@ 2013-05-21 10:25   ` Bastien
  2013-05-21 12:42     ` Eric Schulte
  0 siblings, 1 reply; 4+ messages in thread
From: Bastien @ 2013-05-21 10:25 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Org Mode Mailing List, Eric Schulte

Hi Eric,

Carsten Dominik <carsten.dominik@gmail.com> writes:

> Yes, that is all right at least for now, please go ahead.

Please also send an email to htmlize.el's author -- I think he's
reading the mailing list, but ensuring he does would be nice.

Best,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: patch for htmlize.el
  2013-05-21 10:25   ` Bastien
@ 2013-05-21 12:42     ` Eric Schulte
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Schulte @ 2013-05-21 12:42 UTC (permalink / raw)
  To: Bastien; +Cc: Org Mode Mailing List, Carsten Dominik

Bastien <bzg@gnu.org> writes:

> Hi Eric,
>
> Carsten Dominik <carsten.dominik@gmail.com> writes:
>
>> Yes, that is all right at least for now, please go ahead.
>

Done

>
> Please also send an email to htmlize.el's author -- I think he's
> reading the mailing list, but ensuring he does would be nice.
>

Done, Thanks,

>
> Best,

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-05-21 12:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-21  0:16 patch for htmlize.el Eric Schulte
2013-05-21  6:49 ` Carsten Dominik
2013-05-21 10:25   ` Bastien
2013-05-21 12:42     ` Eric Schulte

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).