From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: Base 64 inline images in html export Date: Tue, 08 Dec 2015 19:47:58 +0100 Message-ID: <87lh94lqu9.fsf@gmx.us> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59194) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a6NJ3-0006Ag-Vv for emacs-orgmode@gnu.org; Tue, 08 Dec 2015 13:48:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a6NJ0-0001R1-Nu for emacs-orgmode@gnu.org; Tue, 08 Dec 2015 13:48:09 -0500 Received: from plane.gmane.org ([80.91.229.3]:52054) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a6NJ0-0001QH-G7 for emacs-orgmode@gnu.org; Tue, 08 Dec 2015 13:48:06 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1a6NIy-0001lA-2L for emacs-orgmode@gnu.org; Tue, 08 Dec 2015 19:48:04 +0100 Received: from tsn109-201-154-139.dyn.nltelcom.net ([109.201.154.139]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 08 Dec 2015 19:48:04 +0100 Received: from rasmus by tsn109-201-154-139.dyn.nltelcom.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 08 Dec 2015 19:48:04 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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 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