From mboxrd@z Thu Jan 1 00:00:00 1970 From: suvayu ali Subject: Re: backend specific preprocess hook Date: Fri, 19 Aug 2011 00:03:35 +0200 Message-ID: References: <8739gymyft.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from eggs.gnu.org ([140.186.70.92]:42925) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QuAgx-00073e-0s for emacs-orgmode@gnu.org; Thu, 18 Aug 2011 18:04:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QuAgv-0001aM-1z for emacs-orgmode@gnu.org; Thu, 18 Aug 2011 18:03:58 -0400 Received: from mail-bw0-f41.google.com ([209.85.214.41]:40432) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QuAgu-0001aF-Mc for emacs-orgmode@gnu.org; Thu, 18 Aug 2011 18:03:57 -0400 Received: by bkbzt4 with SMTP id zt4so2147801bkb.0 for ; Thu, 18 Aug 2011 15:03:55 -0700 (PDT) In-Reply-To: <8739gymyft.fsf@gnu.org> 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: Bastien Cc: org-mode mailing list Hi Bastien, On Thu, Aug 18, 2011 at 7:17 PM, Bastien wrote: >> [1] IIUC I have to customise the `org-export-preprocess-hook'? > > Yes, and test against `org-export-current-backend' to see whether you > are exporting to HTML or LaTeX. I have this working now. Works great. I should have reported back with my solution: (defun my-org-export-preprocess-hook () "My backend specific export preprocess hook." (save-excursion (if (eq org-export-current-backend 'latex) (let* ((tag "ignoreheading")) ; Thanks to Nick for this (org-map-entries (lambda () (delete-region (point-at-bol) (point-at-eol))) (concat ":" tag ":")))) (if (eq org-export-current-backend 'html) (let* ((match "Qn")) (org-map-entries (lambda () (org-set-property "HTML_CONTAINER_CLASS" "question")) match))))) (add-hook 'org-export-preprocess-hook 'my-org-export-preprocess-hook) The html customisation is incomplete for the moment (for the lack of time :-p). My goal is to have custom styles for headlines tagged with "Qn" (unanswered questions) and "QnA" (questions with complete answers). Actually I was also hoping to colour code my latex export based on a similar philosophy using \todo[inline] and PROPERTIES. But I haven't had the time to investigate the possibilities yet. I will put it on Worg if I do manage to figure it out. :) -- Suvayu Open source is the future. It sets us free.