From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: a post-processing export hook? Date: Wed, 02 Dec 2015 06:04:58 -0500 Message-ID: References: <87wpsx17zn.fsf@gmx.us> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46584) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a45Dd-0005s8-VL for emacs-orgmode@gnu.org; Wed, 02 Dec 2015 06:05:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a45DY-0006eW-T4 for emacs-orgmode@gnu.org; Wed, 02 Dec 2015 06:05:05 -0500 Received: from mail-qg0-x236.google.com ([2607:f8b0:400d:c04::236]:35186) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a45DY-0006eL-O4 for emacs-orgmode@gnu.org; Wed, 02 Dec 2015 06:05:00 -0500 Received: by qgec40 with SMTP id c40so29415316qge.2 for ; Wed, 02 Dec 2015 03:05:00 -0800 (PST) In-reply-to: <87wpsx17zn.fsf@gmx.us> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rasmus Cc: emacs-orgmode@gnu.org Rasmus writes: > John Kitchin 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