Browse Source

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'.
Nicolas Goaziou 14 years ago
parent
commit
1f78cebdf4
1 changed files with 32 additions and 28 deletions
  1. 32 28
      lisp/org-latex.el

+ 32 - 28
lisp/org-latex.el

@@ -2461,34 +2461,38 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
 
 (defun org-export-latex-lists ()
   "Convert plain text lists in current buffer into LaTeX lists."
-  (mapc
-   (lambda (e)
-     ;; For each type of context allowed for list export (E), find
-     ;; every list, parse it, delete it and insert resulting
-     ;; conversion to latex (RES).
-     (let (res)
-       (goto-char (point-min))
-       (while (re-search-forward (org-item-beginning-re) nil t)
-	 (when (and (eq (get-text-property (point) 'list-context) e)
-		    (not (get-text-property (point) 'org-example)))
-	   (beginning-of-line)
-	   (setq res
-		 (org-list-to-latex
-		  ;; Narrowing is needed because we're converting
-		  ;; from inner functions to outer ones.
-		  (save-restriction
-		    (narrow-to-region (point) (point-max))
-		    ;; `org-list-end-re' output has changed since
-		    ;; preprocess from org-exp.el.
-		    (let ((org-list-end-re "^ORG-LIST-END\n"))
-		      (org-list-parse-list t)))
-		  org-export-latex-list-parameters))
-	   ;; Extend previous value of original-indentation to the
-	   ;; whole string
-	   (insert (org-add-props res nil 'original-indentation
-				  (org-find-text-property-in-string
-				   'original-indentation res)))))))
-   (append org-list-export-context '(nil))))
+  ;; `org-list-end-re' output has changed since preprocess from
+  ;; org-exp.el. Make sure it is taken into account.
+  (let ((org-list-ending-method
+	 (if (eq org-list-ending-method 'regexp) 'regexp 'both))
+	(org-list-end-re "^ORG-LIST-END\n"))
+    (mapc
+     (lambda (e)
+       ;; For each type of context allowed for list export (E), find
+       ;; every list, parse it, delete it and insert resulting
+       ;; conversion to latex (RES), while keeping the same
+       ;; `original-indentation' property.
+       (let (res)
+	 (goto-char (point-min))
+	 (while (re-search-forward (org-item-beginning-re) nil t)
+	   (when (and (eq (get-text-property (point) 'list-context) e)
+		      (not (get-text-property (point) 'org-example)))
+	     (beginning-of-line)
+	     (setq res
+		   (org-list-to-latex
+		    ;; Narrowing is needed because we're converting
+		    ;; from inner functions to outer ones.
+		    (save-restriction
+		      (narrow-to-region (point) (point-max))
+		      (org-list-parse-list t))
+		    org-export-latex-list-parameters))
+	     ;; Extend previous value of original-indentation to the
+	     ;; whole string
+	     (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
  '("\\!"