forked from mirrors/org-mode
org-latex-preview: Split out entry construction
* lisp/org-latex-preview.el (org-latex-preview--place-from-elements, org-latex-preview--construct-entries): Split the entry construction code into its own function `org-latex-preview--construct-entries'. This change will make it easier to generate previews during export.
This commit is contained in:
parent
5d319e4339
commit
f592d7b3cc
|
@ -1005,12 +1005,16 @@ protection against placing doubled up overlays."
|
||||||
(error "Unknown conversion process %s for previewing LaTeX fragments"
|
(error "Unknown conversion process %s for previewing LaTeX fragments"
|
||||||
processing-type)))))
|
processing-type)))))
|
||||||
|
|
||||||
(defun org-latex-preview--place-from-elements (processing-type elements)
|
(defun org-latex-preview--construct-entries
|
||||||
"Preview LaTeX math fragments ELEMENTS using PROCESSING-TYPE."
|
(elements &optional construct-numbering-p parse-tree)
|
||||||
(let* ((numbering-table (and org-latex-preview-numbered
|
"Constuct a well formatted list of entries and (optinally) numbering offsets.
|
||||||
|
This operates by processing ELEMENTS. When CONSTRUCT-NUMBERING-P is non-nil,
|
||||||
|
the number offsets will also be calculated, using PARSE-TREE if given."
|
||||||
|
(let* ((numbering-table (and construct-numbering-p
|
||||||
(cl-find 'latex-environment elements
|
(cl-find 'latex-environment elements
|
||||||
:key #'org-element-type :test #'eq)
|
:key #'org-element-type :test #'eq)
|
||||||
(org-latex-preview--environment-numbering-table)))
|
(org-latex-preview--environment-numbering-table
|
||||||
|
parse-tree)))
|
||||||
(numbering-offsets
|
(numbering-offsets
|
||||||
(and numbering-table
|
(and numbering-table
|
||||||
(mapcar
|
(mapcar
|
||||||
|
@ -1031,7 +1035,13 @@ protection against placing doubled up overlays."
|
||||||
1 0))
|
1 0))
|
||||||
(org-element-property :value element)))
|
(org-element-property :value element)))
|
||||||
elements)))
|
elements)))
|
||||||
(org-latex-preview-place processing-type entries numbering-offsets)))
|
(list entries numbering-offsets)))
|
||||||
|
|
||||||
|
(defun org-latex-preview--place-from-elements (processing-type elements)
|
||||||
|
"Preview LaTeX math fragments ELEMENTS using PROCESSING-TYPE."
|
||||||
|
(apply #'org-latex-preview-place processing-type
|
||||||
|
(org-latex-preview--construct-entries
|
||||||
|
elements org-latex-preview-numbered)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun org-latex-preview-place (processing-type entries &optional numbering-offsets latex-preamble)
|
(defun org-latex-preview-place (processing-type entries &optional numbering-offsets latex-preamble)
|
||||||
|
|
Loading…
Reference in New Issue