From: Noah Hoffman <noah.hoffman@gmail.com>
To: emacs-orgmode@gnu.org
Subject: embed base64 encoded images in exported html
Date: Mon, 23 Apr 2012 10:33:24 -0700 [thread overview]
Message-ID: <CANZRKX12qf+Q-3k2JVi0TUzC8DKYBCHjrFrD4hnm2mfZt1VZ9A@mail.gmail.com> (raw)
Hello -
I am trying to export a monolithic html file by embedding
base64-encoded images, and I can't quite figure out how to prevent the
output from being escaped in one way or another... here's an example
of one permutation that doesn't do exactly what I want:
#+BEGIN_SRC R :results output
png('plot.png')
plot(1:10)
invisible(dev.off())
list.files(pattern = '*.png')
#+END_SRC
#+RESULTS:
: [1] "plot.png"
#+BEGIN_SRC python :results output raw :exports results
with open('plot.png', 'rb') as image:
data = image.read()
print '<img src="data:image/png;base64,%s">' % data.encode("base64")
#+END_SRC
#+RESULTS:
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAAHgCAMAAABKCk6nAAACuFBMVEUAAAABAQEDAwMEBAQHBwcJ
CQkKCgoMDAwNDQ0ODg4PDw8QEBARERESEhITExMUFBQVFRUWFhYXFxcYGBgZGRkaGhobGxscHBwf
Hx8gICAhISEiIiIjIyMkJCQlJSUmJiYnJycoKCgqKiorKyssLCwtLS0uLi4vLy8wMDAxMTEyMjI0
NDQ4ODg5OTk6Ojo7Ozs8PDw9PT0+Pj4/Pz9AQEBBQUFCQkJDQ0NERERFRUVGRkZHR0dISEhJSUlK
SkpLS0tMTExNTU1OTk5PT09QUFBRUVFSUlJTU1NUVFRVVVVXV1dYWFhZWVlaWlpbW1tcXFxdXV1e
<remainder truncated>
Here the "results" block is not exposed as raw html in the exported
file. Can anyone suggest how I might do this? I'm using emacs 23.4.1,
org-mode 7.8.03
Thanks a lot,
Noah
next reply other threads:[~2012-04-23 17:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-23 17:33 Noah Hoffman [this message]
2012-04-23 16:35 ` embed base64 encoded images in exported html Eric Schulte
2012-04-23 18:48 ` Noah Hoffman
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=CANZRKX12qf+Q-3k2JVi0TUzC8DKYBCHjrFrD4hnm2mfZt1VZ9A@mail.gmail.com \
--to=noah.hoffman@gmail.com \
--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).