From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marc Ihm Subject: [PATCH] contrib/lisp/ox-confluence.el: Export checkboxes; fix timestamps in headlines Date: Mon, 01 May 2017 17:29:47 +0200 Message-ID: <86r3087fys.fsf@ihm.name> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35263) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d5DH2-0006WH-L7 for emacs-orgmode@gnu.org; Mon, 01 May 2017 11:30:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d5DGx-0007Zt-Nr for emacs-orgmode@gnu.org; Mon, 01 May 2017 11:30:04 -0400 Received: from [195.159.176.226] (port=35694 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d5DGx-0007Zf-Ef for emacs-orgmode@gnu.org; Mon, 01 May 2017 11:29:59 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1d5DGo-0003gr-9o for emacs-orgmode@gnu.org; Mon, 01 May 2017 17:29:50 +0200 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 --=-=-= Content-Type: text/plain Hi, the attached patch changes ox-confluence.el: - Export checkboxes in lists to appear in the resulting confluence-markup (with some minor refactoring of org-confluence-item). - Fix spurious closing braces following timestamps in headlines. Please review and let me know, if you have any comments or questions. Thanks, Marc --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Export-checkboxes-fix-timestamps-in-headlines.patch Content-Description: Export checkboxes; fix timestamps in headlines >From 4e638796f39918ade4c8717569315d8b4ca61818 Mon Sep 17 00:00:00 2001 From: "U-IHM-NOTEBOOK\\Olli" Date: Mon, 1 May 2017 16:59:10 +0200 Subject: [PATCH 1/1] Export checkboxes; fix timestamps in headlines --- contrib/lisp/ox-confluence.el | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/contrib/lisp/ox-confluence.el b/contrib/lisp/ox-confluence.el index c70fe853b..8ee22f5b7 100644 --- a/contrib/lisp/ox-confluence.el +++ b/contrib/lisp/ox-confluence.el @@ -83,16 +83,19 @@ (format "_%s_" contents)) (defun org-confluence-item (item contents info) - (let* ((plain-list (org-export-get-parent item)) - (type (org-element-property :type plain-list)) - (bullet (if (eq type 'ordered) ?\# ?\-))) - (concat (make-string (1+ (org-confluence--li-depth item)) bullet) - " " - (if (eq type 'descriptive) - (concat "*" - (org-export-data (org-element-property :tag item) info) - "* - ")) - (org-trim contents)))) + (let ((list-type (org-element-property :type (org-export-get-parent item)))) + + (concat + (make-string (1+ (org-confluence--li-depth item)) + (if (eq list-type 'ordered) ?\# ?\-)) + " " + (cl-case (org-element-property :checkbox item) + ('on "*{{(X)}}* ") + ('off "*{{( )}}* ") + ('trans "*{{(\\-)}}* ")) + (when (eq list-type 'descriptive) + (concat "*" (org-export-data (org-element-property :tag item) info) "* - ")) + (org-trim contents)))) (defun org-confluence-fixed-width (fixed-width contents info) (org-confluence--block @@ -117,7 +120,7 @@ (string= todo "")) "" (format "*{{%s}}* " todo)))) - ;; Else: Standard headline. + (format "h%s. %s%s\n%s" level todo-text text (if (org-string-nw-p contents) contents "")))) @@ -181,7 +184,7 @@ a communication channel." (defun org-confluence-timestamp (timestamp _contents _info) "Transcode a TIMESTAMP object from Org to Confluence. CONTENTS and INFO are ignored." - (let ((translated (org-timestamp-translate timestamp))) + (let ((translated (org-trim (org-timestamp-translate timestamp)))) (if (string-prefix-p "[" translated) (concat "(" (substring translated 1 -1) ")") translated))) @@ -208,7 +211,7 @@ CONTENTS and INFO are ignored." (or (eq tag 'item) ; list items interleave with plain-list (eq tag 'plain-list))) (when (eq tag 'item) - (incf depth)) + (cl-incf depth)) (setq item (org-export-get-parent item))) depth)) -- 2.12.2 --=-=-=--