emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: Base 64 inline images in html export
Date: Tue, 08 Dec 2015 19:47:58 +0100	[thread overview]
Message-ID: <87lh94lqu9.fsf@gmx.us> (raw)
In-Reply-To: cieptky4d6lait.fsf@amazon.co.uk

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 <gsexton@amazon.co.uk> 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

  reply	other threads:[~2015-12-08 18:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-07 12:15 Base 64 inline images in html export Greg Sexton
2015-12-08 18:47 ` Rasmus [this message]
2015-12-23  1:48 ` Grant Rettke
2015-12-23  2:04   ` John Kitchin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lh94lqu9.fsf@gmx.us \
    --to=rasmus@gmx.us \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).