emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] ox-koma-letter.el: Add support for section


From: Daniele Pizzolli
Subject: [O] [PATCH] ox-koma-letter.el: Add support for section
Date: Sat, 02 Jan 2016 12:10:34 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Hello,

I was really surprised that headlines, that are so common in org-mode
are discarded by default in ox-koma-letter.

This patch tries to add the support for them.  It works for me but
requires some work to fit the coding and documentation convention that
are still unknown to me.

I will be happy to follow your suggestion or if somebody take this code
as a minimal implementation to start to work with.

Thanks in advance,
Daniele

>From 390d93afc95f6151e1bde43ef91b4e31f91ecd01 Mon Sep 17 00:00:00 2001
From: Daniele Pizzolli <address@hidden>
Date: Sat, 2 Jan 2016 11:48:24 +0100
Subject: [PATCH] ox-koma-letter.el: Add support for section

* contrib/lisp/ox-koma-letter.el (org-koma-letter-headline): Add
  support for section using the text of headline.

TINYCHANGE
---
 contrib/lisp/ox-koma-letter.el | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 3231d34..aea5a9c 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -569,10 +569,34 @@ holding contextual information.
 Note that if a headline is tagged with a tag from
 `org-koma-letter-special-tags' it will not be exported, but
 stored in `org-koma-letter-special-contents' and included at the
-appropriate place."
+appropriate place.
+
+If the headline level is greater than one include the headline as
+section.  This allow to write letter with sections by using
+section.lco available at:
+<http://www.komascript.de/sections.lco>.
+
+Add [sections] to LATEX_CLASS_OPTIONS with:
+
+#+LATEX_CLASS_OPTIONS: [sections]
+
+If section.lco is unavaliable the section are exported in the tex
+source but not rendered in the final pdf.
+
+- TODO: add test
+- TODO: level n should become n-1, because there is no real
+        level 1 section
+- TODO: check if section are allowed inside other letter keywords
+"
   (let ((special-tag (org-koma-letter--special-tag headline info)))
     (if (not special-tag)
-       contents
+       (progn
+         (if (= 1 (org-element-property :level headline))
+             contents
+           (progn
+             ;; TODO find out how to decrease the level by one!
+             (org-latex-headline headline contents info)
+             )))
       (push (cons special-tag contents) org-koma-letter-special-contents)
       "")))
 
-- 
2.1.4


reply via email to

[Prev in Thread] Current Thread [Next in Thread]