From 3a65174f145ad54b08f001791531af8c38780407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Delafond?= Date: Sun, 27 Oct 2013 18:20:46 +0100 Subject: [PATCH] ox-confluence: Handle lists * contrib/lisp/ox-confluence.el (org-confluence-item, org-confluence--li-depth): New functions. Patch proposed by . --- contrib/lisp/ox-confluence.el | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/contrib/lisp/ox-confluence.el b/contrib/lisp/ox-confluence.el index f5bf2474a..0cef1d7b9 100644 --- a/contrib/lisp/ox-confluence.el +++ b/contrib/lisp/ox-confluence.el @@ -45,6 +45,7 @@ (footnote-reference . org-confluence-empty) (headline . org-confluence-headline) (italic . org-confluence-italic) + (item . org-confluence-item) (link . org-confluence-link) (property-drawer . org-confluence-property-drawer) (section . org-confluence-section) @@ -71,6 +72,11 @@ (defun org-confluence-italic (italic contents info) (format "_%s_" contents)) +(defun org-confluence-item (item contents info) + (concat (make-string (1+ (org-confluence--li-depth item)) ?\-) + " " + (org-trim contents))) + (defun org-confluence-fixed-width (fixed-width contents info) (format "\{\{%s\}\}" contents)) @@ -144,6 +150,22 @@ contents "\{code\}\n")) +(defun org-confluence--li-depth (item) + "Return depth of a list item; -1 means not a list item" + ;; FIXME check whether it's worth it to cache depth + ;; (it gets recalculated quite a few times while + ;; traversing a list) + (let ((depth -1) + (tag)) + (while (and item + (setq tag (car item)) + (or (eq tag 'item) ; list items interleave with plain-list + (eq tag 'plain-list))) + (when (eq tag 'item) + (incf depth)) + (setq item (org-export-get-parent item))) + depth)) + ;; main interactive entrypoint (defun org-confluence-export-as-confluence (&optional async subtreep visible-only body-only ext-plist)