From 8cc6901da2f84b39ef027250ad18afda69bfc4b3 Mon Sep 17 00:00:00 2001 From: Stig Brautaset Date: Wed, 13 Apr 2016 11:02:24 +0100 Subject: Remove language when it is not known Rather than use {code:none}, just use {code} --- ox-jira.el | 12 +++++++----- ox-jira.org | 12 +++++++----- test/ox-jira-test.org | 6 ++---- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/ox-jira.el b/ox-jira.el index a28a7d4..e11ca1e 100644 --- a/ox-jira.el +++ b/ox-jira.el @@ -305,12 +305,14 @@ CONTENTS holds the contents of the src-block. 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")) + (lang (if (member lang '("actionscript" "html" "java" "javascript" "sql" "xhtml" "xml")) lang)) (code (org-export-format-code-default src-block info))) - (format "{code:%s}\n%s{code}" - lang - code)))) + (concat + (if lang + (format "{code:%s}" lang) + "{code}") + code + "{code}")))) (defun ox-jira-subscript (subscript contents info) "Transcode SUBSCRIPT from Org to JIRA. diff --git a/ox-jira.org b/ox-jira.org index 5b6f44b..1d66afb 100644 --- a/ox-jira.org +++ b/ox-jira.org @@ -550,12 +550,14 @@ 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")) + (lang (if (member lang '("actionscript" "html" "java" "javascript" "sql" "xhtml" "xml")) lang)) (code (org-export-format-code-default src-block info))) - (format "{code:%s}\n%s{code}" - lang - code)))) + (concat + (if lang + (format "{code:%s}" lang) + "{code}") + code + "{code}")))) #+END_SRC *** Subscript diff --git a/test/ox-jira-test.org b/test/ox-jira-test.org index af9c12e..1778b80 100644 --- a/test/ox-jira-test.org +++ b/test/ox-jira-test.org @@ -295,8 +295,7 @@ #+BEGIN_SRC emacs-lisp (ert-deftest ox-jira-test/src-blocks () - (should (equal "{code:none} - echo hello + (should (equal "{code}echo hello # echo world {code} " (org-export-string-as "#+begin_src sh @@ -304,8 +303,7 @@ # echo world ,#+end_src " 'jira))) - (should (equal "{code:sql} - BEGIN; + (should (equal "{code:sql}BEGIN; SELECT NOW(); END; {code} -- cgit v1.2.3