emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] ox-koma-letter.el: Add support for section
@ 2016-01-02 11:10 Daniele Pizzolli
  2016-01-02 20:29 ` Rasmus
  0 siblings, 1 reply; 7+ messages in thread
From: Daniele Pizzolli @ 2016-01-02 11:10 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 439 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-ox-koma-letter.el-Add-support-for-section.patch --]
[-- Type: text/x-diff, Size: 1902 bytes --]

From 390d93afc95f6151e1bde43ef91b4e31f91ecd01 Mon Sep 17 00:00:00 2001
From: Daniele Pizzolli <dan@toel.it>
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


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH] ox-koma-letter.el: Add support for section
@ 2016-01-02 11:10 Daniele Pizzolli
  0 siblings, 0 replies; 7+ messages in thread
From: Daniele Pizzolli @ 2016-01-02 11:10 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 439 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-ox-koma-letter.el-Add-support-for-section.patch --]
[-- Type: text/x-diff, Size: 1902 bytes --]

From 390d93afc95f6151e1bde43ef91b4e31f91ecd01 Mon Sep 17 00:00:00 2001
From: Daniele Pizzolli <dan@toel.it>
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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-01-05 18:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-02 11:10 [PATCH] ox-koma-letter.el: Add support for section Daniele Pizzolli
2016-01-02 20:29 ` Rasmus
2016-01-04 10:27   ` Daniele Pizzolli
2016-01-04 19:41     ` Rasmus
2016-01-05 17:12       ` Daniele Pizzolli
2016-01-05 18:39         ` Rasmus
  -- strict thread matches above, loose matches on Subject: below --
2016-01-02 11:10 Daniele Pizzolli

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).