Merge branch 'maint'
This commit is contained in:
commit
47ca6c129c
|
@ -2698,22 +2698,23 @@ channel."
|
|||
DATA is a parse tree or a secondary string. INFO is a plist
|
||||
containing export options. Modify DATA by side-effect and return it."
|
||||
(let ((valid-object-p
|
||||
;; Non-nil when OBJ can be added to the latex math block.
|
||||
(lambda (obj)
|
||||
;; Non-nil when OBJ can be added to the latex math block B.
|
||||
(lambda (obj b)
|
||||
(pcase (org-element-type obj)
|
||||
(`entity (org-element-property :latex-math-p obj))
|
||||
(`latex-fragment
|
||||
(let ((value (org-element-property :value obj)))
|
||||
(or (string-prefix-p "\\(" value)
|
||||
(string-match-p "\\`\\$[^$]" value))))
|
||||
((or `subscript `superscript) t)))))
|
||||
((and type (or `subscript `superscript))
|
||||
(not (org-element-map b type #'identity info t)))))))
|
||||
(org-element-map data '(entity latex-fragment subscript superscript)
|
||||
(lambda (object)
|
||||
;; Skip objects already wrapped.
|
||||
(when (and (not (eq (org-element-type
|
||||
(org-element-property :parent object))
|
||||
'latex-math-block))
|
||||
(funcall valid-object-p object))
|
||||
(funcall valid-object-p object nil))
|
||||
(let ((math-block (list 'latex-math-block nil))
|
||||
(next-elements (org-export-get-next-element object info t))
|
||||
(last object))
|
||||
|
@ -2725,16 +2726,17 @@ containing export options. Modify DATA by side-effect and return it."
|
|||
;; MATH-BLOCK swallows consecutive math objects.
|
||||
(catch 'exit
|
||||
(dolist (next next-elements)
|
||||
(if (not (funcall valid-object-p next)) (throw 'exit nil)
|
||||
(org-element-extract-element next)
|
||||
(org-element-adopt-elements math-block next)
|
||||
;; Eschew the case: \beta$x$ -> \(\betax\).
|
||||
(unless (memq (org-element-type next)
|
||||
'(subscript superscript))
|
||||
(org-element-put-property last :post-blank 1))
|
||||
(setq last next)
|
||||
(when (> (or (org-element-property :post-blank next) 0) 0)
|
||||
(throw 'exit nil))))))
|
||||
(unless (funcall valid-object-p next math-block)
|
||||
(throw 'exit nil))
|
||||
(org-element-extract-element next)
|
||||
(org-element-adopt-elements math-block next)
|
||||
;; Eschew the case: \beta$x$ -> \(\betax\).
|
||||
(unless (memq (org-element-type next)
|
||||
'(subscript superscript))
|
||||
(org-element-put-property last :post-blank 1))
|
||||
(setq last next)
|
||||
(when (> (or (org-element-property :post-blank next) 0) 0)
|
||||
(throw 'exit nil)))))
|
||||
(org-element-put-property
|
||||
math-block :post-blank (org-element-property :post-blank last)))))
|
||||
info nil '(subscript superscript latex-math-block) t)
|
||||
|
|
Loading…
Reference in New Issue