From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [patch] ox-koma-letter Date: Tue, 05 Mar 2013 10:52:12 +0100 Message-ID: <87txoqtbqr.fsf@gmail.com> References: <87vc9gkund.fsf@pank.eu> <877glpptuj.fsf@pank.eu> <87obf1zcor.fsf@pank.eu> <876218wg2m.fsf@gmail.com> <87wqtntvi7.fsf@gmail.com> <87fw0bmoug.fsf@pank.eu> <877glmvr1t.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:34758) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCoXv-0004Y2-En for emacs-orgmode@gnu.org; Tue, 05 Mar 2013 04:52:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UCoXq-0006KE-Bg for emacs-orgmode@gnu.org; Tue, 05 Mar 2013 04:52:31 -0500 Received: from mail-we0-x233.google.com ([2a00:1450:400c:c03::233]:56665) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCoXq-0006K7-57 for emacs-orgmode@gnu.org; Tue, 05 Mar 2013 04:52:26 -0500 Received: by mail-we0-f179.google.com with SMTP id p43so5645624wea.38 for ; Tue, 05 Mar 2013 01:52:25 -0800 (PST) In-Reply-To: (Alan Schmitt's message of "Tue, 05 Mar 2013 10:08:37 +0100") 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: Alan Schmitt Cc: emacs-orgmode@gnu.org, Rasmus Hello, Alan Schmitt writes: > Nicolas Goaziou writes: > >> Headlines are also possible, with a :location: property, which could be >> set to, e.g. "closing". See also: >> >> http://orgmode.org/worg/org-tutorials/org-e-groff-documentation.html >> >> for a syntax based on headlines. >> >> Another possibility is to use a special block. E.g.: >> >> #+begin_closing >> ... >> #+end_closing >> >> The advantage of previous solutions is that it allows contents to be in >> Org syntax whereas "AFTER_CLOSING" keywords require it to be in LaTeX >> syntax. > > These two approaches look great. Do you have a pointer to some could I > should look at to try to integrate them in ox-koma? The principle is the same in both cases. You explicitly ignore the construct (i.e. return nil) in the transcoding function normally handling the same type of element. E.g.: #+begin_src emacs-lisp (defun org-koma-letter-headline (headline contents info) (unless (equal (org-element-property :LOCATION headline) "closing") (org-export-with-backend 'latex headline contents info))) #+end_src Then, when at the appropriate environment (i.e. template), you explicitly search for these constructs with `org-element-map' and insert them here: #+begin_src emacs-lisp (defun org-koma-letter-template (contents info) (concat ... ;; Letter body. contents ;; Closing. (format "\n\\closing{%s}\n\n" (plist-get info :closing)) ;; Add contents of all headlines with "closing" location. (mapconcat 'identity (delq nil (org-element-map (plist-get info :parse-buffer) 'headline (lambda (hl) (and (equal (org-element-property :LOCATION hl) "closing") ;; Ignore headline's title. Focus on contents. (org-export-data (org-element-contents hl) info))) info)) "\n") ;; Letter end. "\\end{letter}\n\\end{document}")) #+end_src This is untested, but should get you started. Regards, -- Nicolas Goaziou