emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* ox-html: stand-alone export option?
@ 2015-02-18  5:48 Melanie Bacou
  2015-02-18 10:39 ` Rasmus
  0 siblings, 1 reply; 4+ messages in thread
From: Melanie Bacou @ 2015-02-18  5:48 UTC (permalink / raw)
  To: emacs-orgmode

Hi,
I'm using ox-html to work on shared documents with my collaborators. 
We're working off a Dropbox account and converting our org files to HTML 
periodically.

Problem with all cloud storages is they don't work with relative links 
inside HTML (links to external images, CSS, and JS resources).

We would really benefit from having a "stand-alone" HTML exporter 
feature that automatically embeds all external references into one 
single HTML file, so they can be shared with Dropbox, Google Drive, 
OneDrive and the likes.

Has this been discussed previously? Would there be any other work around?

Thanks all, --Mel.

-- 
Melanie BACOU
International Food Policy Research Institute
Snr. Program Manager, HarvestChoice
E-mail m.bacou@cgiar.org
Visit www.harvestchoice.org

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

* Re: ox-html: stand-alone export option?
  2015-02-18  5:48 ox-html: stand-alone export option? Melanie Bacou
@ 2015-02-18 10:39 ` Rasmus
  2015-02-20  5:18   ` Melanie Bacou
  0 siblings, 1 reply; 4+ messages in thread
From: Rasmus @ 2015-02-18 10:39 UTC (permalink / raw)
  To: emacs-orgmode

Hi Melanie,

Melanie Bacou <mel@mbacou.com> writes:

> I'm using ox-html to work on shared documents with my
> collaborators. We're working off a Dropbox account and converting our
> org files to HTML periodically.

Cool.

> Problem with all cloud storages is they don't work with relative links
> inside HTML (links to external images, CSS, and JS resources).

I use git and ssh to a wm which I guess is different from "cloud storages"
so maybe I don't understand.  If you open the browser of my.html and you
have an absolute path to https://orgmode.org/logo.png the browser would
display it no?  Likewise for img/logo.png.  Probably I've
misunderstood. . .

> We would really benefit from having a "stand-alone" HTML exporter
> feature that automatically embeds all external references into one
> single HTML file, so they can be shared with Dropbox, Google Drive,
> OneDrive and the likes.

Would you base64 encode images and inline code or do you have something
else in mind with single HTML file?  It's not built into Org ATM.

In the short run maybe there's a tool that can do.  For instance, in
Firefox it will save auxiliary material when you save a page.  I don't
know if also save whatever scripts you rely on from whatever CDN far away...

> Has this been discussed previously? Would there be any other work around?

I think there was one guy who had patch that would automatically download
external images.  Pretty neat.  I don't know if it was applied in the end.

—Rasmus

-- 
ツ

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

* Re: ox-html: stand-alone export option?
  2015-02-18 10:39 ` Rasmus
@ 2015-02-20  5:18   ` Melanie Bacou
  2015-02-20 10:32     ` Rasmus
  0 siblings, 1 reply; 4+ messages in thread
From: Melanie Bacou @ 2015-02-20  5:18 UTC (permalink / raw)
  To: emacs-orgmode

Hi Rasmus, see below.

On 2/18/2015 5:39 AM, Rasmus wrote:
> Hi Melanie,
>
> Melanie Bacou <mel@mbacou.com> writes:
>
>> I'm using ox-html to work on shared documents with my
>> collaborators. We're working off a Dropbox account and converting our
>> org files to HTML periodically.
>
> Cool.
>
>> Problem with all cloud storages is they don't work with relative links
>> inside HTML (links to external images, CSS, and JS resources).
>
> I use git and ssh to a wm which I guess is different from "cloud storages"
> so maybe I don't understand.  If you open the browser of my.html and you
> have an absolute path to https://orgmode.org/logo.png the browser would
> display it no?  Likewise for img/logo.png.  Probably I've
> misunderstood. . .

You're right with Github or remote storages there's no problem (links to 
images like `./fig/my_fig.png` or local CSS or JS `./css/my_css_.css` 
are interpreted as usual. The problem is only on cloud storage services 
like Dropbox where each resource gets a unique (unknown a priori) ID. 
These make it difficult to publish HTML documents.

>
>> We would really benefit from having a "stand-alone" HTML exporter
>> feature that automatically embeds all external references into one
>> single HTML file, so they can be shared with Dropbox, Google Drive,
>> OneDrive and the likes.
>
> Would you base64 encode images and inline code or do you have something
> else in mind with single HTML file?  It's not built into Org ATM.

Yes indeed was thinking of a "stand-alone" option that would include 
base64 encoded images and also verbatim include all local CSS and JS in 
the document head.

>
> In the short run maybe there's a tool that can do.  For instance, in
> Firefox it will save auxiliary material when you save a page.  I don't
> know if also save whatever scripts you rely on from whatever CDN far away...

Right, I looked at that too, but no true "stand-alone" option in FF or 
Chrome, both browsers include resources in a separate folder. Might 
spend a little more time searching for another utility.

>
>> Has this been discussed previously? Would there be any other work around?
>
> I think there was one guy who had patch that would automatically download
> external images.  Pretty neat.  I don't know if it was applied in the end.

I'd vote for this feature. In fact I believe it's now an option with 
RMarkdown/HTML documents.

>
> —Rasmus
>

-- 
Melanie BACOU
International Food Policy Research Institute
Snr. Program Manager, HarvestChoice
E-mail m.bacou@cgiar.org
Visit www.harvestchoice.org

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

* Re: ox-html: stand-alone export option?
  2015-02-20  5:18   ` Melanie Bacou
@ 2015-02-20 10:32     ` Rasmus
  0 siblings, 0 replies; 4+ messages in thread
From: Rasmus @ 2015-02-20 10:32 UTC (permalink / raw)
  To: mel; +Cc: emacs-orgmode

Melanie Bacou <mel@mbacou.com> writes:

> You're right with Github or remote storages there's no problem (links
> to images like `./fig/my_fig.png` or local CSS or JS
> `./css/my_css_.css` are interpreted as usual. The problem is only on
> cloud storage services like Dropbox where each resource gets a unique
> (unknown a priori) ID. These make it difficult to publish HTML
> documents.

Interesting.  I only know the dropbox by name, and had no idea it could be
used for publishing.

>>> We would really benefit from having a "stand-alone" HTML exporter
>>> feature that automatically embeds all external references into one
>>> single HTML file, so they can be shared with Dropbox, Google Drive,
>>> OneDrive and the likes.
>>
>> Would you base64 encode images and inline code or do you have something
>> else in mind with single HTML file?  It's not built into Org ATM.
>
> Yes indeed was thinking of a "stand-alone" option that would include
> base64 encoded images and also verbatim include all local CSS and JS
> in the document head.

First, I will advise you to take a look at ox-projects.  It's great when
you have to do heavy customization.  Check the docstring of
org-publish-project-alist.  You can run preparation functions.  Further,
take a look at the (org-export-define-backend 'html in ox-html.el.  With
projects you can replace all the values of :options-alist.

For script you can use :prepare to download all script
and :html-head-extra or :html-head for including them.

So for images Gnus must have something for base64.  For instance, the
"Face" in this email is converted from png to base64 using
gnus-face-encode.  See the functions starting with base64-.  You could use
a preparation function to convert your lossy(?)  images with base64 (see
also :html-inline-image-rules) and maybe org-export-before-processing-hook
for doing the heavy lifting of changing org-links.

Anyway, if there's no options for in-lining images that makes sense to
inline such as .base64 (does that exists?) and .svg, perhaps open a
separate thread with this feature request.  Or better: hack ox-html.el and
submit a patch!  Check org-html--format-image.

>> In the short run maybe there's a tool that can do.  For instance, in
>> Firefox it will save auxiliary material when you save a page.  I don't
>> know if also save whatever scripts you rely on from whatever CDN far away...
>
> Right, I looked at that too, but no true "stand-alone" option in FF or
> Chrome, both browsers include resources in a separate folder.

I know.  This has bothered me as well.

>>> Has this been discussed previously? Would there be any other work around?
>>
>> I think there was one guy who had patch that would automatically download
>> external images.  Pretty neat.  I don't know if it was applied in the end.
>
> I'd vote for this feature. In fact I believe it's now an option with
> RMarkdown/HTML documents.

Perhaps ox-ravel will be of interest to you then:

   https://github.com/chasberry/orgmode-accessories

—Rasmus

-- 
. . . It begins of course with The Internet.  A Net of Peers

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

end of thread, other threads:[~2015-02-20 10:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-18  5:48 ox-html: stand-alone export option? Melanie Bacou
2015-02-18 10:39 ` Rasmus
2015-02-20  5:18   ` Melanie Bacou
2015-02-20 10:32     ` Rasmus

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