emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Daniele Pizzolli <daniele.pizzolli@toel.it>
To: emacs-orgmode@gnu.org
Subject: [PATCH] ox-koma-letter.el: Add support for section
Date: Sat, 02 Jan 2016 12:10:34 +0100	[thread overview]
Message-ID: <87a8oozzzz1bkl@me.localhost.invalid> (raw)

[-- 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


             reply	other threads:[~2016-01-02 11:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-02 11:10 Daniele Pizzolli [this message]
  -- strict thread matches above, loose matches on Subject: below --
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

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=87a8oozzzz1bkl@me.localhost.invalid \
    --to=daniele.pizzolli@toel.it \
    --cc=emacs-orgmode@gnu.org \
    /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).