[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Base 64 inline images in html export
From: |
Rasmus |
Subject: |
Re: [O] Base 64 inline images in html export |
Date: |
Tue, 08 Dec 2015 19:47:58 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
Hi Greg,
Thanks for your patch.
Do you intend to finish the patch for inclusion in Org? If so please have
a look at:
http://orgmode.org/worg/org-contribute.html
In particular, you need to assign the copyright of your changes to FSF.
You might also want to familiarize yourself with how comments are done in
Emacs. In particular, they should be prose and informative.
Greg Sexton <address@hidden> writes:
> I've hacked up this ugly proof of concept. I guess it wouldn't take too
> much to productionize this and make the behavior configurable. Any
> thoughts?
I think it would be great. But how about external pictures? It seems
these will not work with your patch. How about SVGs in external files?
If your goal if a self-containing html what about external JS and CSS?
> (defun gs/b64-img (file-uri)
> (let ((file (s-replace "file://" "" file-uri)))
> (if (f-exists? file)
This does not warrant new
> ;; src="data:image/png;base64,iVBORw0KGgoAAAANSUh..."
I don’t get the point of this comment.
> (s-concat "data:image/"
> (f-ext file)
> ";base64,"
> (base64-encode-string (f-read-bytes file)))
> file-uri)))
> (defun org-html--format-image (source attributes info)
> "Return \"img\" tag with given SOURCE and ATTRIBUTES.
> SOURCE is a string specifying the location of the image.
> ATTRIBUTES is a plist, as returned by
> `org-export-read-attribute'. INFO is a plist used as
> a communication channel."
You are removing features from an existing function.
> (org-html-close-tag
> "img"
> (org-html--make-attribute-string
> (org-combine-plists
> (list :src (gs/b64-img source) ; <-- interesting line is here
The comment is no good.
> :alt (if (string-match-p "^ltxpng/" source)
> (org-html-encode-plain-text
> (org-find-text-property-in-string 'org-latex-src source))
> (file-name-nondirectory source)))
> attributes))
> info))
Rasmus
--
Not everything that goes around comes back around, you know