diff options
| author | Stig Brautaset <stig@brautaset.org> | 2017-06-07 23:03:26 +0100 |
|---|---|---|
| committer | Stig Brautaset <stig@brautaset.org> | 2017-06-07 23:13:46 +0100 |
| commit | a5e7c7166f5d4baf4b6487f44865f2636cda4698 (patch) | |
| tree | 117ab4161598eb86ac5fd104b3805f614a28ac9f | |
| parent | aa20e9922b9c22c2d689d8702a76925cab357a9a (diff) | |
Add support for TODOs and TAGs in headlines
| -rw-r--r-- | ox-jira.el | 18 | ||||
| -rw-r--r-- | test/ox-jira-test.el | 21 |
2 files changed, 37 insertions, 2 deletions
@@ -240,9 +240,23 @@ the plist used as a communication channel." (let* ((level (org-export-get-relative-level headline info)) (title (org-export-data-with-backend (org-element-property :title headline) - 'jira info))) + 'jira info)) + (todo (and (plist-get info :with-todo-keywords) + (let ((todo (org-element-property :todo-keyword headline))) + (and todo (org-export-data todo info))))) + (todo-type (and todo (org-element-property :todo-type headline))) + (todo-text (if todo + (format "{color:%s}{{%s}}{color} " + (if (eq todo-type 'done) "lightgreen" "red") + todo) + "")) + (tags (and (plist-get info :with-tags) + (org-export-get-tags headline info))) + (tags-text (if tags + (format " {color:blue}{{:%s:}}{color}" (string-join tags ":")) + ""))) (concat - (format "h%d. %s\n" level title) + (format "h%d. %s%s%s\n" level todo-text title tags-text) contents))) (defun ox-jira-horizontal-rule (horizontal-rule contents info) diff --git a/test/ox-jira-test.el b/test/ox-jira-test.el index 90716d5..d3f75ee 100644 --- a/test/ox-jira-test.el +++ b/test/ox-jira-test.el @@ -90,6 +90,27 @@ h3. third level ** second level *** third level")))) + +(ert-deftest ox-jira-test/todo-headlines () + (should + (equal "h1. {color:lightgreen}{{DONE}}{color} This is a headline +h1. {color:red}{{TODO}}{color} This is another headline +" (to-jira "* DONE This is a headline +* TODO This is another headline")))) + +(ert-deftest ox-jira-test/tag-headlines () + (should (equal "h1. This is a headline {color:blue}{{:TAG:XXX:}}{color} +h1. This is another headline {color:blue}{{:FOO:BAR:}}{color} +" (to-jira "* This is a headline :TAG:XXX: +* This is another headline :FOO:BAR:")))) + + +(ert-deftest ox-jira-test/full-headlines () + (should (equal "h1. {color:lightgreen}{{DONE}}{color} This is a headline {color:blue}{{:TAG:XXX:}}{color} +h1. {color:red}{{TODO}}{color} This is another headline {color:blue}{{:FOO:BAR:}}{color} +" (to-jira "* DONE This is a headline :TAG:XXX: +* TODO This is another headline :FOO:BAR:")))) + ;; As far as I understand these are not useful in JIRA output, so let's just ;; filter them out. ;; |
