aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStig Brautaset <stig@brautaset.org>2016-02-26 08:26:51 +0000
committerStig Brautaset <stig@brautaset.org>2016-02-26 08:26:51 +0000
commitff66e33ca80cbedd8f2ce92e6f3026c370262747 (patch)
tree7500486f4bf1578c59469890d61e0c0850e379c0
parentcbd6b317980a63cdac8124499bab29dee8f0b0ae (diff)
Add support for simple checkboxes
-rw-r--r--ox-jira.el13
-rw-r--r--ox-jira.org13
-rw-r--r--test/ox-jira-test.el6
-rw-r--r--test/ox-jira-test.org10
4 files changed, 36 insertions, 6 deletions
diff --git a/ox-jira.el b/ox-jira.el
index 25ea6f8..d1e802b 100644
--- a/ox-jira.el
+++ b/ox-jira.el
@@ -147,9 +147,16 @@ contextual information."
CONTENTS is the text with item markup. INFO is a plist holding
contextual information."
(let* ((parent (org-element-property :parent item))
- (list-type (org-element-property :type parent)))
- (format "%s %s" (if (eq list-type 'ordered) "#" "-")
- contents)))
+ (list-type (org-element-property :type parent))
+ (checkbox (case (org-element-property :checkbox item)
+ (on "{{[X]}} ")
+ (off "{{[ ]}} ")
+ (trans "{{[-]}} "))))
+ (concat
+ (if (eq list-type 'ordered) "#" "-")
+ " "
+ checkbox
+ contents)))
(defun org-jira-underline (underline contents info)
"Transcode UNDERLINE from Org to JIRA.
diff --git a/ox-jira.org b/ox-jira.org
index 495fc2c..257ca88 100644
--- a/ox-jira.org
+++ b/ox-jira.org
@@ -292,9 +292,16 @@
CONTENTS is the text with item markup. INFO is a plist holding
contextual information."
(let* ((parent (org-element-property :parent item))
- (list-type (org-element-property :type parent)))
- (format "%s %s" (if (eq list-type 'ordered) "#" "-")
- contents)))
+ (list-type (org-element-property :type parent))
+ (checkbox (case (org-element-property :checkbox item)
+ (on "{{[X]}} ")
+ (off "{{[ ]}} ")
+ (trans "{{[-]}} "))))
+ (concat
+ (if (eq list-type 'ordered) "#" "-")
+ " "
+ checkbox
+ contents)))
#+END_SRC
*** Underline
diff --git a/test/ox-jira-test.el b/test/ox-jira-test.el
index a8d250a..0accb67 100644
--- a/test/ox-jira-test.el
+++ b/test/ox-jira-test.el
@@ -96,6 +96,12 @@ h3. third level
3. fa
3. fum" 'jira))))
+(ert-deftest ox-jira-test/unordered-list-with-checkboxes()
+ (should (equal "- {{[ ]}} fi
+- {{[X]}} fo
+" (org-export-string-as "- [ ] fi
+- [X] fo" 'jira))))
+
(ert-deftest ox-jira-test/src-blocks ()
(should (equal "{code:sh}
echo hello
diff --git a/test/ox-jira-test.org b/test/ox-jira-test.org
index f54f7c2..9d54f41 100644
--- a/test/ox-jira-test.org
+++ b/test/ox-jira-test.org
@@ -176,6 +176,16 @@
3. fum" 'jira))))
#+END_SRC
+ Right! That was simple enough. Let's add some checkboxes.
+
+ #+BEGIN_SRC emacs-lisp
+ (ert-deftest ox-jira-test/unordered-list-with-checkboxes()
+ (should (equal "- {{[ ]}} fi
+ - {{[X]}} fo
+ " (org-export-string-as "- [ ] fi
+ - [X] fo" 'jira))))
+ #+END_SRC
+
** Source code
I use Org mode for literate programming, and executable lab notes, so we