org: Split org-format-latex into two functions
* lisp/org.el (org-place-formula-image, org-format-latex): Extract the overlay placement component of `org-format-latex' into a new function `org-place-formula-image`.
This commit is contained in:
parent
d0c87c762a
commit
18d2f871c2
35
lisp/org.el
35
lisp/org.el
|
@ -15801,21 +15801,7 @@ Some of the options can be changed using the variable
|
|||
(unless (file-exists-p movefile)
|
||||
(org-create-formula-image
|
||||
value movefile options forbuffer processing-type))
|
||||
(if overlays
|
||||
(progn
|
||||
(dolist (o (overlays-in beg end))
|
||||
(when (eq (overlay-get o 'org-overlay-type)
|
||||
'org-latex-overlay)
|
||||
(delete-overlay o)))
|
||||
(org--make-preview-overlay beg end movefile imagetype)
|
||||
(goto-char end))
|
||||
(delete-region beg end)
|
||||
(insert
|
||||
(org-add-props link
|
||||
(list 'org-latex-src
|
||||
(replace-regexp-in-string "\"" "" value)
|
||||
'org-latex-src-embed-type
|
||||
(if block-type 'paragraph 'character)))))))
|
||||
(org-place-formula-image link block-type beg end value overlays movefile imagetype)))
|
||||
((eq processing-type 'mathml)
|
||||
;; Process to MathML.
|
||||
(unless (org-format-latex-mathml-available-p)
|
||||
|
@ -15830,6 +15816,25 @@ Some of the options can be changed using the variable
|
|||
(error "Unknown conversion process %s for LaTeX fragments"
|
||||
processing-type)))))))))))
|
||||
|
||||
(defun org-place-formula-image (link block-type beg end value overlays movefile imagetype)
|
||||
"Place an overlay from BEG to END showing MOVEFILE.
|
||||
The overlay will be above BEG if OVERLAYS is non-nil."
|
||||
(if overlays
|
||||
(progn
|
||||
(dolist (o (overlays-in beg end))
|
||||
(when (eq (overlay-get o 'org-overlay-type)
|
||||
'org-latex-overlay)
|
||||
(delete-overlay o)))
|
||||
(org--make-preview-overlay beg end movefile imagetype)
|
||||
(goto-char end))
|
||||
(delete-region beg end)
|
||||
(insert
|
||||
(org-add-props link
|
||||
(list 'org-latex-src
|
||||
(replace-regexp-in-string "\"" "" value)
|
||||
'org-latex-src-embed-type
|
||||
(if block-type 'paragraph 'character))))))
|
||||
|
||||
(defun org-create-math-formula (latex-frag &optional mathml-file)
|
||||
"Convert LATEX-FRAG to MathML and store it in MATHML-FILE.
|
||||
Use `org-latex-to-mathml-convert-command'. If the conversion is
|
||||
|
|
Loading…
Reference in New Issue