From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: new LaTeX exporter hook Date: Wed, 23 May 2012 14:32:02 +0200 Message-ID: <87wr43axj1.fsf@gmail.com> References: <87aa0zxpmy.fsf@med.uni-goettingen.de> <81ipfnb0dt.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:35373) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXAmT-00066q-Is for emacs-orgmode@gnu.org; Wed, 23 May 2012 08:35:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SXAmK-00018f-Us for emacs-orgmode@gnu.org; Wed, 23 May 2012 08:35:09 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:47674) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXAmK-00018T-ML for emacs-orgmode@gnu.org; Wed, 23 May 2012 08:35:00 -0400 Received: by wibhm14 with SMTP id hm14so3492924wib.12 for ; Wed, 23 May 2012 05:34:58 -0700 (PDT) In-Reply-To: <81ipfnb0dt.fsf@gmail.com> (Jambunathan K.'s message of "Wed, 23 May 2012 17:00:22 +0530") 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: Jambunathan K Cc: Andreas Leha , emacs-orgmode@gnu.org Hello, Jambunathan K writes: > Andreas Leha writes: > >> the new LaTeX exporter does not seem to "run" the >> org-export-latex-final-hook. Is there an equivalent? > > You are looking for `:filter-final-output' within > `org-export-filters-alist'. > > I have defcustom that runs indent-region on final html output. Here is > the relevant sections from org-e-html together with it's final section. > > Adopt this example to e-latex case. > > (defconst org-e-html-filters-alist > '((:filter-final-output . org-e-html-final-function)) > "Alist between filters keywords and back-end specific filters. > See `org-export-filters-alist' for more information.") > > (defun org-e-html-final-function (contents backend info) > (if (not org-e-html-pretty-output) contents > (with-temp-buffer > (nxml-mode) > (insert contents) > (indent-region (point-min) (point-max)) > (buffer-substring-no-properties (point-min) (point-max))))) > > (defcustom org-e-html-pretty-output nil > "Enable this to generate pretty HTML." > :group 'org-export-e-html > :type 'boolean) Jambunathan is right. Though, for completeness, I'll add that, as an end-user, you shouldn't mess with `org-e-html-filters-alist'. You can add your filter to `org-export-filter-final-output-functions' instead. Since this variable is back-end agnostic, your filter will probably have to check the back-end first. Also, remember this is the functional counterpart of hooks: the return value of your function will be used as the new output. Thus, be sure it doesn't return nil. Example follows: #+begin_src emacs-lisp (defun my-e-latex-final-filter (contents backend info) (if (not (eq backend 'e-latex)) contents ... modify contents ... new-contents)) #+end_src Regards, -- Nicolas Goaziou