[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] [PATCH] ox-confluence.el: Better list item support
From: |
Charles Durst |
Subject: |
[O] [PATCH] ox-confluence.el: Better list item support |
Date: |
Mon, 5 Dec 2016 18:44:25 -0500 |
One more. Hopefully more interesting than my last one.
--
Charles Durst
address@hidden
* contrib/lisp/ox-confluence.el (org-confluence--li-bullet,
org-confluence-item): Use "#" for ordered lists, include item
name in descriptive lists.
This correctly handles nested lists including mixes of ordered,
unordered and descriptive lists.
TINYCHANGE
---
contrib/lisp/ox-confluence.el | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/contrib/lisp/ox-confluence.el b/contrib/lisp/ox-confluence.el
index 48bc5ea..78dc7f4 100644
--- a/contrib/lisp/ox-confluence.el
+++ b/contrib/lisp/ox-confluence.el
@@ -79,7 +79,7 @@
(format "_%s_" contents))
(defun org-confluence-item (item contents info)
- (concat (make-string (1+ (org-confluence--li-depth item)) ?\-)
+ (concat (org-confluence--li-bullet item)
" "
(org-trim contents)))
@@ -161,21 +161,27 @@ a communication channel."
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
+(defun org-confluence--li-bullet (item)
+ "Return the bullet of a list item; \"\" means not a list item"
+ ;; FIXME check whether it's worth it to cache the bullet
;; (it gets recalculated quite a few times while
;; traversing a list)
- (let ((depth -1)
+ (let ((bullet "")
+ (list-type (org-element-property :type (org-export-get-parent item)))
(tag))
+ (if (eq list-type 'descriptive)
+ (setq bullet (concat " *"
+ (org-export-data (org-element-property :tag item) info)
+ "* - ")))
(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 list-type (org-element-property :type (org-export-get-parent item)))
+ (setq bullet (concat (if (eq list-type 'ordered) "#" "-") bullet)))
(setq item (org-export-get-parent item)))
- depth))
+ bullet))
;; main interactive entrypoint
(defun org-confluence-export-as-confluence
--
2.5.4 (Apple Git-61)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [O] [PATCH] ox-confluence.el: Better list item support,
Charles Durst <=