forked from mirrors/org-mode
org-latex: fix export with various values for `org-list-ending-method'
* lisp/org-latex.el (org-export-latex-lists): make sure markers used for export are taken into account by temporarily setting an appropriate value for `org-list-ending-method'.
This commit is contained in:
parent
280d5826c3
commit
1f78cebdf4
|
@ -2461,34 +2461,38 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
|
||||||
|
|
||||||
(defun org-export-latex-lists ()
|
(defun org-export-latex-lists ()
|
||||||
"Convert plain text lists in current buffer into LaTeX lists."
|
"Convert plain text lists in current buffer into LaTeX lists."
|
||||||
(mapc
|
;; `org-list-end-re' output has changed since preprocess from
|
||||||
(lambda (e)
|
;; org-exp.el. Make sure it is taken into account.
|
||||||
;; For each type of context allowed for list export (E), find
|
(let ((org-list-ending-method
|
||||||
;; every list, parse it, delete it and insert resulting
|
(if (eq org-list-ending-method 'regexp) 'regexp 'both))
|
||||||
;; conversion to latex (RES).
|
(org-list-end-re "^ORG-LIST-END\n"))
|
||||||
(let (res)
|
(mapc
|
||||||
(goto-char (point-min))
|
(lambda (e)
|
||||||
(while (re-search-forward (org-item-beginning-re) nil t)
|
;; For each type of context allowed for list export (E), find
|
||||||
(when (and (eq (get-text-property (point) 'list-context) e)
|
;; every list, parse it, delete it and insert resulting
|
||||||
(not (get-text-property (point) 'org-example)))
|
;; conversion to latex (RES), while keeping the same
|
||||||
(beginning-of-line)
|
;; `original-indentation' property.
|
||||||
(setq res
|
(let (res)
|
||||||
(org-list-to-latex
|
(goto-char (point-min))
|
||||||
;; Narrowing is needed because we're converting
|
(while (re-search-forward (org-item-beginning-re) nil t)
|
||||||
;; from inner functions to outer ones.
|
(when (and (eq (get-text-property (point) 'list-context) e)
|
||||||
(save-restriction
|
(not (get-text-property (point) 'org-example)))
|
||||||
(narrow-to-region (point) (point-max))
|
(beginning-of-line)
|
||||||
;; `org-list-end-re' output has changed since
|
(setq res
|
||||||
;; preprocess from org-exp.el.
|
(org-list-to-latex
|
||||||
(let ((org-list-end-re "^ORG-LIST-END\n"))
|
;; Narrowing is needed because we're converting
|
||||||
(org-list-parse-list t)))
|
;; from inner functions to outer ones.
|
||||||
org-export-latex-list-parameters))
|
(save-restriction
|
||||||
;; Extend previous value of original-indentation to the
|
(narrow-to-region (point) (point-max))
|
||||||
;; whole string
|
(org-list-parse-list t))
|
||||||
(insert (org-add-props res nil 'original-indentation
|
org-export-latex-list-parameters))
|
||||||
(org-find-text-property-in-string
|
;; Extend previous value of original-indentation to the
|
||||||
'original-indentation res)))))))
|
;; whole string
|
||||||
(append org-list-export-context '(nil))))
|
(insert (org-add-props res nil 'original-indentation
|
||||||
|
(org-find-text-property-in-string
|
||||||
|
'original-indentation res)))))))
|
||||||
|
;; List of allowed contexts for export, and the default one.
|
||||||
|
(append org-list-export-context '(nil)))))
|
||||||
|
|
||||||
(defconst org-latex-entities
|
(defconst org-latex-entities
|
||||||
'("\\!"
|
'("\\!"
|
||||||
|
|
Loading…
Reference in New Issue