emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Alan Schmitt <alan.schmitt@polytechnique.org>
Cc: emacs-orgmode@gnu.org, Rasmus <rasmus@gmx.us>
Subject: Re: [patch] ox-koma-letter
Date: Tue, 05 Mar 2013 10:52:12 +0100	[thread overview]
Message-ID: <87txoqtbqr.fsf@gmail.com> (raw)
In-Reply-To: <m2ppzez016.fsf@top.irisa.fr> (Alan Schmitt's message of "Tue, 05 Mar 2013 10:08:37 +0100")

Hello,

Alan Schmitt <alan.schmitt@polytechnique.org> 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

  reply	other threads:[~2013-03-05  9:52 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-25 20:25 [patch] ox-koma-letter Rasmus
2013-02-26  9:50 ` Bastien
2013-02-26 11:53   ` Rasmus
2013-02-26 12:38 ` Michael Strey
2013-02-26 21:14   ` Rasmus
2013-02-27 10:51     ` Michael Strey
2013-02-27 12:13       ` Rasmus
2013-02-27 13:41         ` Sebastien Vauban
2013-02-27 16:48           ` Rasmus
2013-02-28 15:19         ` Michael Strey
2013-03-02 17:53           ` Rasmus
2013-03-01 13:17 ` Alan Schmitt
2013-03-02 10:26   ` Bastien
2013-03-02 15:50     ` Alan Schmitt
2013-03-02 18:12       ` Bastien
2013-03-02 17:54   ` Rasmus
2013-03-02 17:57   ` Rasmus
2013-03-02 19:21     ` Alan Schmitt
2013-03-02 21:58       ` Rasmus
2013-03-03 16:00         ` Alan Schmitt
2013-03-03 17:25           ` Nicolas Goaziou
2013-03-04  7:19             ` Alan Schmitt
2013-03-04  8:33               ` Nicolas Goaziou
2013-03-04  8:56                 ` Alan Schmitt
2013-03-04 10:38                   ` Rasmus
2013-03-04 20:38                     ` Nicolas Goaziou
2013-03-05  9:08                       ` Alan Schmitt
2013-03-05  9:52                         ` Nicolas Goaziou [this message]
2013-03-05 10:51                       ` Michael Strey
2013-03-05 12:23                         ` Rasmus
2013-03-05 13:09                           ` Michael Strey
2013-03-06  9:03                         ` Alan Schmitt
2013-03-06  9:09                           ` Nicolas Goaziou
2013-03-04 10:46               ` Michael Strey
2013-03-04 13:48                 ` Alan Schmitt
2013-03-04 21:20                 ` Rasmus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87txoqtbqr.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=alan.schmitt@polytechnique.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=rasmus@gmx.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).