From mboxrd@z Thu Jan 1 00:00:00 1970 From: suvayu ali Subject: Re: Filtering in export hooks Date: Tue, 6 Sep 2011 12:16:56 +0200 Message-ID: References: <62F4E48A-A0B3-48B0-8180-471EE93F187A@gmail.com> <74E04FF8-94AD-4A44-AEC1-9D5217317269@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:56110) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0siV-000133-4z for emacs-orgmode@gnu.org; Tue, 06 Sep 2011 06:17:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R0siU-0004eQ-53 for emacs-orgmode@gnu.org; Tue, 06 Sep 2011 06:17:19 -0400 Received: from mail-bw0-f41.google.com ([209.85.214.41]:48016) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0siT-0004eD-Pv for emacs-orgmode@gnu.org; Tue, 06 Sep 2011 06:17:18 -0400 Received: by bkbzt4 with SMTP id zt4so5468515bkb.0 for ; Tue, 06 Sep 2011 03:17:16 -0700 (PDT) In-Reply-To: <74E04FF8-94AD-4A44-AEC1-9D5217317269@gmail.com> 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: Carsten Dominik Cc: org-mode mailing list Hi Carsten, On Tue, Sep 6, 2011 at 11:49 AM, Carsten Dominik wrote: > Which of the preprocessing hooks are you using? =A0I am still confused > by your description, maybe you can make a small example and show exactly = what works and what does not work? > This is what I am using at the moment: (defun my-org-export-latex-wrap-todo () "Wrap heading with arbitrary latex environment." (interactive) (let* ((tags (org-get-tags-string)) (heading (org-get-heading t)) ; heading with todo (content (org-get-entry)) (color (cond ((string-match ":QnA:" tags) "color=3Dblue!40") ((string-match ":Qn:" tags) "color=3Dyellow!40")))) (when color (org-mark-subtree) (delete-region (region-beginning) (region-end)) (insert (concat (format "\\todo[inline,%s]{\\textbf{%s}%%\n" color heading) (format "%s\n}%%\n" content)))))) (add-hook 'org-export-preprocess-after-blockquote-hook (lambda () (let ((match "QnA|Qn")) (org-map-entries (lambda () (my-org-export-latex-wrap-todo)) match)))) This works great as long as the tags: option is non-nil (t or not-in-toc). Setting it to nil just ignores it and everything gets like a regular headline. I am not using org-export-preprocess-hook because some of the latex gets escaped during the export (e.g. {..} becomes \{..}). I hope this is clearer. --=20 Suvayu Open source is the future. It sets us free.