emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* export to single html file (like reveal_single_file:t) in regular html export
@ 2016-11-19  5:46 Xebar Saram
  2016-11-26  6:44 ` Xebar Saram
  0 siblings, 1 reply; 3+ messages in thread
From: Xebar Saram @ 2016-11-19  5:46 UTC (permalink / raw)
  To: org mode

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

Hi all

i love the option in org revel (reveal_single_file:t) that allows me to
export a presentation to my students with image support embedded in the
html file./

ive searched for a way to do it in the normal org to html exporter with no
success. any clue how that can be done?

best

Z

[-- Attachment #2: Type: text/html, Size: 407 bytes --]

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

* Re: export to single html file (like reveal_single_file:t) in regular html export
  2016-11-19  5:46 export to single html file (like reveal_single_file:t) in regular html export Xebar Saram
@ 2016-11-26  6:44 ` Xebar Saram
  2016-11-26 12:56   ` John Kitchin
  0 siblings, 1 reply; 3+ messages in thread
From: Xebar Saram @ 2016-11-26  6:44 UTC (permalink / raw)
  To: org mode

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

ping anyone :) gotta prepare new assignments for students next week :)

On Sat, Nov 19, 2016 at 7:46 AM, Xebar Saram <zeltakc@gmail.com> wrote:

> Hi all
>
> i love the option in org revel (reveal_single_file:t) that allows me to
> export a presentation to my students with image support embedded in the
> html file./
>
> ive searched for a way to do it in the normal org to html exporter with no
> success. any clue how that can be done?
>
> best
>
> Z
>

[-- Attachment #2: Type: text/html, Size: 844 bytes --]

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

* Re: export to single html file (like reveal_single_file:t) in regular html export
  2016-11-26  6:44 ` Xebar Saram
@ 2016-11-26 12:56   ` John Kitchin
  0 siblings, 0 replies; 3+ messages in thread
From: John Kitchin @ 2016-11-26 12:56 UTC (permalink / raw)
  To: Xebar Saram; +Cc: org mode

Here is some code lightly modified from a comment by Evgeny here:
http://kitchingroup.cheme.cmu.edu/blog/2016/10/29/Sending-html-emails-from-org-mode-with-org-mime/

It seems to do what you want. Of course, I only tested it with one
image, one time, so I hope it works for you too! It assumes png, but it
would not be too hard to generalize.

#+BEGIN_SRC emacs-lisp
(defun org-image-data-uri (path)
  (let ((data (with-temp-buffer (insert-file-contents path) (buffer-string))))
    (concat "<img src=\"" 
            "data:image/png;charset=utf-8;base64,"
	    (base64-encode-string (encode-coding-string data 'binary) t)
	    "\"/>")))

(defun my-link (link contents info)
  (let ((type (org-element-property :type link))
	(path (org-element-property :path link)))
    (if (and (string= type "file")
	     (f-ext? path "png"))
	(org-image-data-uri path)
      (org-html-link link contents info))))

(org-export-define-derived-backend 'my-html 'html
  :translate-alist '((link . my-link)))

(browse-url (org-export-to-file 'my-html "embedded-image.html"))
#+END_SRC

Xebar Saram writes:

> ping anyone :) gotta prepare new assignments for students next week :)
>
> On Sat, Nov 19, 2016 at 7:46 AM, Xebar Saram <zeltakc@gmail.com> wrote:
>
>> Hi all
>>
>> i love the option in org revel (reveal_single_file:t) that allows me to
>> export a presentation to my students with image support embedded in the
>> html file./
>>
>> ive searched for a way to do it in the normal org to html exporter with no
>> success. any clue how that can be done?
>>
>> best
>>
>> Z
>>


-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

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

end of thread, other threads:[~2016-11-26 12:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-19  5:46 export to single html file (like reveal_single_file:t) in regular html export Xebar Saram
2016-11-26  6:44 ` Xebar Saram
2016-11-26 12:56   ` John Kitchin

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).