* a post-processing export hook?
@ 2015-12-02 0:50 John Kitchin
2015-12-02 10:05 ` Rasmus
0 siblings, 1 reply; 5+ messages in thread
From: John Kitchin @ 2015-12-02 0:50 UTC (permalink / raw)
To: Org Mode
Hi all,
I tried using org-export-before-parsing-hook to modify an org-file prior
to export to replace some regular expressions with html.
I ran into the following issue. For short substitutions,
@@html:replacement@@ worked fine. If the replacement text got too long,
this broke. I did wrap it in a #+begin_html: block, but that introduced
line breaks that were undesireable. The replacement text was long
because I had a large tool tip to put on some text.
I ended up doing a post-process like this:
(with-current-buffer (org-html-export-as-html)
(org-process-key-bindings 'html)
(org-process-emacs-commands 'html)
(write-file "blog.html")
(browse-url "blog.html"))
But, I wondered if there should be a post-export hook? I can see some
challenge for pdf export, for example. The hook should run after the
latex export, not after the pdf is made.
I could have used a filter on a paragraph, which is where most of the
things I was modifying were. Is there some other way I could have done
this?
--
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] 5+ messages in thread
* Re: a post-processing export hook?
2015-12-02 0:50 a post-processing export hook? John Kitchin
@ 2015-12-02 10:05 ` Rasmus
2015-12-02 11:04 ` John Kitchin
0 siblings, 1 reply; 5+ messages in thread
From: Rasmus @ 2015-12-02 10:05 UTC (permalink / raw)
To: emacs-orgmode
John Kitchin <jkitchin@andrew.cmu.edu> writes:
> Hi all,
>
> I tried using org-export-before-parsing-hook to modify an org-file prior
> to export to replace some regular expressions with html.
>
> I ran into the following issue. For short substitutions,
> @@html:replacement@@ worked fine. If the replacement text got too long,
> this broke. I did wrap it in a #+begin_html: block, but that introduced
> line breaks that were undesireable. The replacement text was long
> because I had a large tool tip to put on some text.
>
> I ended up doing a post-process like this:
>
> (with-current-buffer (org-html-export-as-html)
> (org-process-key-bindings 'html)
> (org-process-emacs-commands 'html)
> (write-file "blog.html")
> (browse-url "blog.html"))
>
> But, I wondered if there should be a post-export hook? I can see some
> challenge for pdf export, for example. The hook should run after the
> latex export, not after the pdf is made.
I don't think your example warrant an extra hook. Replacing strings is
something that org-export-filter-final-output-functions is perfectly
capable of doing IMO. It’s a bit of a hassle to work with transcoded
strings, but having a hook would not change this.
Rasmus
--
Tack, ni svenska vakttorn. Med plutonium tvingar vi dansken på knä!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: a post-processing export hook?
2015-12-02 10:05 ` Rasmus
@ 2015-12-02 11:04 ` John Kitchin
2015-12-02 11:33 ` Rasmus
0 siblings, 1 reply; 5+ messages in thread
From: John Kitchin @ 2015-12-02 11:04 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
Rasmus writes:
> John Kitchin <jkitchin@andrew.cmu.edu> writes:
>
>> Hi all,
>>
>> I tried using org-export-before-parsing-hook to modify an org-file prior
>> to export to replace some regular expressions with html.
>>
>> I ran into the following issue. For short substitutions,
>> @@html:replacement@@ worked fine. If the replacement text got too long,
>> this broke. I did wrap it in a #+begin_html: block, but that introduced
>> line breaks that were undesireable. The replacement text was long
>> because I had a large tool tip to put on some text.
>>
>> I ended up doing a post-process like this:
>>
>> (with-current-buffer (org-html-export-as-html)
>> (org-process-key-bindings 'html)
>> (org-process-emacs-commands 'html)
>> (write-file "blog.html")
>> (browse-url "blog.html"))
>>
>> But, I wondered if there should be a post-export hook? I can see some
>> challenge for pdf export, for example. The hook should run after the
>> latex export, not after the pdf is made.
>
> I don't think your example warrant an extra hook. Replacing strings is
> something that org-export-filter-final-output-functions is perfectly
> capable of doing IMO. It’s a bit of a hassle to work with transcoded
> strings, but having a hook would not change this.
True enough. I tried it with a paragraph filter and it worked fine. I
didn't know about the org-export-filter-final-output-functions, that is
pretty much the hook I was looking for. Thanks,
>
> Rasmus
--
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] 5+ messages in thread
* Re: a post-processing export hook?
2015-12-02 11:04 ` John Kitchin
@ 2015-12-02 11:33 ` Rasmus
2015-12-17 17:39 ` Grant Rettke
0 siblings, 1 reply; 5+ messages in thread
From: Rasmus @ 2015-12-02 11:33 UTC (permalink / raw)
To: emacs-orgmode
John Kitchin <jkitchin@andrew.cmu.edu> writes:
> Rasmus writes:
>
>> John Kitchin <jkitchin@andrew.cmu.edu> writes:
>>
>>> Hi all,
>>>
>>> I tried using org-export-before-parsing-hook to modify an org-file prior
>>> to export to replace some regular expressions with html.
>>>
>>> I ran into the following issue. For short substitutions,
>>> @@html:replacement@@ worked fine. If the replacement text got too long,
>>> this broke. I did wrap it in a #+begin_html: block, but that introduced
>>> line breaks that were undesireable. The replacement text was long
>>> because I had a large tool tip to put on some text.
>>>
>>> I ended up doing a post-process like this:
>>>
>>> (with-current-buffer (org-html-export-as-html)
>>> (org-process-key-bindings 'html)
>>> (org-process-emacs-commands 'html)
>>> (write-file "blog.html")
>>> (browse-url "blog.html"))
>>>
>>> But, I wondered if there should be a post-export hook? I can see some
>>> challenge for pdf export, for example. The hook should run after the
>>> latex export, not after the pdf is made.
>>
>> I don't think your example warrant an extra hook. Replacing strings is
>> something that org-export-filter-final-output-functions is perfectly
>> capable of doing IMO. It’s a bit of a hassle to work with transcoded
>> strings, but having a hook would not change this.
>
> True enough. I tried it with a paragraph filter and it worked fine. I
> didn't know about the org-export-filter-final-output-functions, that is
> pretty much the hook I was looking for. Thanks,
OK. Now OP makes more sense. All filters are listed in:
org-export-filters-alist
The documentation is mostly in the source of ox.el.
—Rasmus
--
Lasciate ogni speranza o voi che entrate: siete nella mani di'machellaio
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: a post-processing export hook?
2015-12-02 11:33 ` Rasmus
@ 2015-12-17 17:39 ` Grant Rettke
0 siblings, 0 replies; 5+ messages in thread
From: Grant Rettke @ 2015-12-17 17:39 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode@gnu.org
On Wed, Dec 2, 2015 at 5:33 AM, Rasmus <rasmus@gmx.us> wrote:
> The documentation is mostly in the source of ox.el.
Worg also has this:
http://orgmode.org/worg/doc.html
One cold and dreary evening I quickly browsed the list of hooks in
org-mode when I was curious about tangling hooks.
It is a pretty decent read and very educational; it gives you a
picture into the "eventspace" or org.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-12-17 17:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-02 0:50 a post-processing export hook? John Kitchin
2015-12-02 10:05 ` Rasmus
2015-12-02 11:04 ` John Kitchin
2015-12-02 11:33 ` Rasmus
2015-12-17 17:39 ` Grant Rettke
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).