소스 검색

ox-confluence: Export checkboxes; fix timestamps in headlines

* contrib/lisp/ox-confluence.el (org-confluence-item): Export
  checkboxes.
(org-confluence-timestamp): Fix timestamps in headlines.  Silence
byte-compiler.
Marc Ihm 7 년 전
부모
커밋
cbe544edf3
1개의 변경된 파일16개의 추가작업 그리고 13개의 파일을 삭제
  1. 16 13
      contrib/lisp/ox-confluence.el

+ 16 - 13
contrib/lisp/ox-confluence.el

@@ -83,16 +83,20 @@
   (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) ?\# ?\-))
+     " "
+     (pcase (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 +121,6 @@
 			    (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))