summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Delafond <sdelafond@gmail.com>2013-10-27 18:20:46 +0100
committerSébastien Delafond <sdelafond@gmail.com>2013-10-27 18:28:53 +0100
commit3a65174f145ad54b08f001791531af8c38780407 (patch)
tree72986b4e1bd3d9e4a4ad939f280659859510b0c1
parent73f2ef866d059d8d05a9d68d7de5588b590ed6f6 (diff)
downloadorg-mode-3a65174f145ad54b08f001791531af8c38780407.tar.gz
ox-confluence: Handle lists
* contrib/lisp/ox-confluence.el (org-confluence-item, org-confluence--li-depth): New functions. Patch proposed by <tomas@tuxteam.de>.
-rw-r--r--contrib/lisp/ox-confluence.el22
1 files changed, 22 insertions, 0 deletions
diff --git a/contrib/lisp/ox-confluence.el b/contrib/lisp/ox-confluence.el
index f5bf247..0cef1d7 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)