* [PATCH] ox-confluence.el: Better list item support
@ 2016-12-05 23:44 Charles Durst
0 siblings, 0 replies; only message in thread
From: Charles Durst @ 2016-12-05 23:44 UTC (permalink / raw)
To: emacs-orgmode
One more. Hopefully more interesting than my last one.
--
Charles Durst
cwdurst+orgmode@gmail.com
* 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)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-12-05 23:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-05 23:44 [PATCH] ox-confluence.el: Better list item support Charles Durst
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.