summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2019-07-09 12:43:29 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2019-07-09 12:43:29 +0200
commit1ff9cab0a335f7694764c66f00a709caa25990ec (patch)
tree34df4b18addb962e046f8c31da3b283ddb5ace45
parentc2ef61ffcf0ad2f7617746e4a3f599ab0a3fbba4 (diff)
parent63e851ddbd8573a221343c6fdec7e62109b9f2dc (diff)
downloadorg-mode-1ff9cab0a335f7694764c66f00a709caa25990ec.tar.gz
Merge branch 'maint'
-rw-r--r--lisp/ox.el91
-rw-r--r--testing/lisp/test-ox.el9
2 files changed, 50 insertions, 50 deletions
diff --git a/lisp/ox.el b/lisp/ox.el
index 078efaf..1b579f5 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -2920,56 +2920,47 @@ returned by the function."
'(entity bold italic latex-environment latex-fragment strike-through
subscript superscript underline)
(lambda (datum)
- (let ((new
- (cl-case (org-element-type datum)
- ;; ... entities...
- (entity
- (and (not (plist-get info :with-entities))
- (list (concat
- (org-export-expand datum nil)
- (make-string
- (or (org-element-property :post-blank datum) 0)
- ?\s)))))
- ;; ... emphasis...
- ((bold italic strike-through underline)
- (and (not (plist-get info :with-emphasize))
- (let ((marker (cl-case (org-element-type datum)
- (bold "*")
- (italic "/")
- (strike-through "+")
- (underline "_"))))
- (append
- (list marker)
- (org-element-contents datum)
- (list (concat
- marker
- (make-string
- (or (org-element-property :post-blank datum)
- 0)
- ?\s)))))))
- ;; ... LaTeX environments and fragments...
- ((latex-environment latex-fragment)
- (and (eq (plist-get info :with-latex) 'verbatim)
- (list (org-export-expand datum nil))))
- ;; ... sub/superscripts...
- ((subscript superscript)
- (let ((sub/super-p (plist-get info :with-sub-superscript))
- (bracketp (org-element-property :use-brackets-p datum)))
- (and (or (not sub/super-p)
- (and (eq sub/super-p '{}) (not bracketp)))
- (append
- (list (concat
- (if (eq (org-element-type datum) 'subscript)
- "_"
- "^")
- (and bracketp "{")))
- (org-element-contents datum)
- (list (concat
- (and bracketp "}")
- (and (org-element-property :post-blank datum)
- (make-string
- (org-element-property :post-blank datum)
- ?\s)))))))))))
+ (let* ((type (org-element-type datum))
+ (post-blank
+ (pcase (org-element-property :post-blank datum)
+ (`nil nil)
+ (n (make-string n (if (eq type 'latex-environment) ?\n ?\s)))))
+ (new
+ (cl-case type
+ ;; ... entities...
+ (entity
+ (and (not (plist-get info :with-entities))
+ (list (concat (org-export-expand datum nil)
+ post-blank))))
+ ;; ... emphasis...
+ ((bold italic strike-through underline)
+ (and (not (plist-get info :with-emphasize))
+ (let ((marker (cl-case type
+ (bold "*")
+ (italic "/")
+ (strike-through "+")
+ (underline "_"))))
+ (append
+ (list marker)
+ (org-element-contents datum)
+ (list (concat marker post-blank))))))
+ ;; ... LaTeX environments and fragments...
+ ((latex-environment latex-fragment)
+ (and (eq (plist-get info :with-latex) 'verbatim)
+ (list (concat (org-export-expand datum nil)
+ post-blank))))
+ ;; ... sub/superscripts...
+ ((subscript superscript)
+ (let ((sub/super-p (plist-get info :with-sub-superscript))
+ (bracketp (org-element-property :use-brackets-p datum)))
+ (and (or (not sub/super-p)
+ (and (eq sub/super-p '{}) (not bracketp)))
+ (append
+ (list (concat (if (eq type 'subscript) "_" "^")
+ (and bracketp "{")))
+ (org-element-contents datum)
+ (list (concat (and bracketp "}")
+ post-blank)))))))))
(when new
;; Splice NEW at DATUM location in parse tree.
(dolist (e new (org-element-extract-element datum))
diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el
index b8c507e..81f557a 100644
--- a/testing/lisp/test-ox.el
+++ b/testing/lisp/test-ox.el
@@ -847,6 +847,15 @@ Paragraph <2012-03-29 Thu>[2012-03-29 Thu]"
(paragraph . (lambda (p c i) c))
(section . (lambda (s c i) c))))
nil nil nil '(:with-latex verbatim)))))
+ (should
+ (equal "$1$ \n"
+ (org-test-with-temp-text "$1$ "
+ (org-export-as
+ (org-export-create-backend
+ :transcoders '((latex-fragment . (lambda (l c i) "dummy"))
+ (paragraph . (lambda (p c i) c))
+ (section . (lambda (s c i) c))))
+ nil nil nil '(:with-latex verbatim)))))
;; Sub/superscript.
(should
(equal "adummy\n"