diff options
| author | Stig Brautaset <sbrautaset@laterpay.net> | 2016-02-26 11:01:31 +0000 |
|---|---|---|
| committer | Stig Brautaset <sbrautaset@laterpay.net> | 2016-02-26 11:01:31 +0000 |
| commit | a09dc42bb46cd3e6509713931e52a8394590a6f0 (patch) | |
| tree | a2bfadad85ccf7298797a20a57b0408f8f2e27cf | |
| parent | 9dfb5a213e515fadca0b013e743f2be262538703 (diff) | |
Make code block use language "none" if not in JIRA's supported set
| -rw-r--r-- | ox-jira.el | 6 | ||||
| -rw-r--r-- | ox-jira.org | 10 | ||||
| -rw-r--r-- | test/ox-jira-test.el | 13 | ||||
| -rw-r--r-- | test/ox-jira-test.org | 13 |
4 files changed, 38 insertions, 4 deletions
@@ -212,8 +212,12 @@ CONTENTS holds the contents of the item. INFO is a plist holding contextual information." (when (org-string-nw-p (org-element-property :value src-block)) (let* ((lang (org-element-property :language src-block)) + (lang (if (member lang '("actionscript" "html" "java" "javascript" "sql" "xhtml" "xml")) + lang "none")) (code (org-export-format-code-default src-block info))) - (format "{code:%s}\n%s{code}" lang code)))) + (format "{code:%s}\n%s{code}" + lang + code)))) (defun org-jira-quote-block (quote-block contents info) "Transcode a QUOTE-BLOCK element from Org to Jira. diff --git a/ox-jira.org b/ox-jira.org index 5d8224b..4a742f3 100644 --- a/ox-jira.org +++ b/ox-jira.org @@ -399,6 +399,10 @@ *** Source code block + JIRA supports formatting for these languages: actionscript, html, java, + javascript, sql, xhtml, xml. If none of them fits, we can use 'none', + which I imagine will be a bit like ={noformat}=. + #+BEGIN_SRC emacs-lisp (defun org-jira-src-block (src-block contents info) "Transcode a SRC-BLOCK element from Org to Jira. @@ -406,8 +410,12 @@ contextual information." (when (org-string-nw-p (org-element-property :value src-block)) (let* ((lang (org-element-property :language src-block)) + (lang (if (member lang '("actionscript" "html" "java" "javascript" "sql" "xhtml" "xml")) + lang "none")) (code (org-export-format-code-default src-block info))) - (format "{code:%s}\n%s{code}" lang code)))) + (format "{code:%s}\n%s{code}" + lang + code)))) #+END_SRC *** Quote block diff --git a/test/ox-jira-test.el b/test/ox-jira-test.el index dd435d0..c83a9df 100644 --- a/test/ox-jira-test.el +++ b/test/ox-jira-test.el @@ -104,7 +104,7 @@ fum" 'jira)))) - [X] fo" 'jira)))) (ert-deftest ox-jira-test/src-blocks () - (should (equal "{code:sh} + (should (equal "{code:none} echo hello # echo world {code} @@ -112,6 +112,17 @@ echo hello echo hello # echo world #+end_src +" 'jira))) + (should (equal "{code:sql} +BEGIN; +SELECT NOW(); +END; +{code} +" (org-export-string-as "#+begin_src sql + BEGIN; + SELECT NOW(); + END; + #+end_src " 'jira)))) (ert-deftest ox-jira-test/example-blocks () diff --git a/test/ox-jira-test.org b/test/ox-jira-test.org index 39264d6..f11f3c9 100644 --- a/test/ox-jira-test.org +++ b/test/ox-jira-test.org @@ -202,7 +202,7 @@ #+BEGIN_SRC emacs-lisp (ert-deftest ox-jira-test/src-blocks () - (should (equal "{code:sh} + (should (equal "{code:none} echo hello # echo world {code} @@ -210,6 +210,17 @@ echo hello # echo world ,#+end_src + " 'jira))) + (should (equal "{code:sql} + BEGIN; + SELECT NOW(); + END; + {code} + " (org-export-string-as "#+begin_src sql + BEGIN; + SELECT NOW(); + END; + ,#+end_src " 'jira)))) #+END_SRC |
