summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2021-04-13 09:55:29 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2021-04-13 09:55:29 +0200
commitbcc1b0f1bb8e7b468d2848c7e5216948bb1948a6 (patch)
tree1bc87e2ed1b38136caff095f57e5f869ab76431e
parent5d5d1022540b7553963e2c96b4b0460a382c90cf (diff)
downloadorg-mode-bcc1b0f1bb8e7b468d2848c7e5216948bb1948a6.tar.gz
ob-exp: Do not comma-escape inline source code
* lisp/ob-exp.el (org-babel-exp-code): Do not comma-escape inline source code. * testing/lisp/test-ob-exp.el (ob-exp/exports-inline-code): Add test.
-rw-r--r--lisp/ob-exp.el7
-rw-r--r--testing/lisp/test-ob-exp.el8
2 files changed, 13 insertions, 2 deletions
diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el
index c579080..e9b304b 100644
--- a/lisp/ob-exp.el
+++ b/lisp/ob-exp.el
@@ -360,9 +360,12 @@ replaced with its value."
(org-fill-template
(if (eq type 'inline)
org-babel-exp-inline-code-template
- org-babel-exp-code-template)
+ org-babel-exp-code-template)
`(("lang" . ,(nth 0 info))
- ("body" . ,(org-escape-code-in-string (nth 1 info)))
+ ;; Inline source code should not be escaped.
+ ("body" . ,(let ((body (nth 1 info)))
+ (if (eq type 'inline) body
+ (org-escape-code-in-string body))))
("switches" . ,(let ((f (nth 3 info)))
(and (org-string-nw-p f) (concat " " f))))
("flags" . ,(let ((f (assq :flags (nth 2 info))))
diff --git a/testing/lisp/test-ob-exp.el b/testing/lisp/test-ob-exp.el
index 9581f28..11ec1ed 100644
--- a/testing/lisp/test-ob-exp.el
+++ b/testing/lisp/test-ob-exp.el
@@ -213,6 +213,14 @@ Here is one at the end of a line. {{{results(=2=)}}}
(org-export-use-babel t))
(org-babel-exp-process-buffer))
(buffer-string))))
+ ;; Do not escape characters in inline source blocks.
+ (should
+ (equal "src_c[]{*a}"
+ (org-test-with-temp-text "src_c[ :exports code ]{*a}"
+ (let ((org-babel-inline-result-wrap "=%s=")
+ (org-export-use-babel t))
+ (org-babel-exp-process-buffer))
+ (buffer-string))))
(should
(equal "src_emacs-lisp[]{(+ 1 1)} {{{results(=2=)}}}"
(org-test-with-temp-text "src_emacs-lisp[:exports both]{(+ 1 1)}"