From mboxrd@z Thu Jan 1 00:00:00 1970 From: Charles Durst Subject: [PATCH] ox-confluence.el: Better list item support Date: Mon, 5 Dec 2016 18:44:25 -0500 Message-ID: Reply-To: cwdurst+orgmode@gmail.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35380) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cE2wB-0004Av-Rd for emacs-orgmode@gnu.org; Mon, 05 Dec 2016 18:44:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cE2wA-0003Kc-SV for emacs-orgmode@gnu.org; Mon, 05 Dec 2016 18:44:47 -0500 Received: from mail-qk0-x231.google.com ([2607:f8b0:400d:c09::231]:34045) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cE2wA-0003K7-NX for emacs-orgmode@gnu.org; Mon, 05 Dec 2016 18:44:46 -0500 Received: by mail-qk0-x231.google.com with SMTP id q130so176073085qke.1 for ; Mon, 05 Dec 2016 15:44:46 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org 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)