Sfoglia il codice sorgente

LaTeX export: Respect example indentation when parsing plain lists

Carsten Dominik 16 anni fa
parent
commit
574f987670
3 ha cambiato i file con 20 aggiunte e 8 eliminazioni
  1. 8 0
      lisp/ChangeLog
  2. 8 6
      lisp/org-exp.el
  3. 4 2
      lisp/org-list.el

+ 8 - 0
lisp/ChangeLog

@@ -1,3 +1,11 @@
+2009-06-07  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-list.el (org-list-end): Respect the stored "original"
+	indentation when determining the end of the list.
+
+	* org-exp.el (org-export-replace-src-segments-and-examples):
+	Remember indentation correctly.
+
 2009-06-06  Carsten Dominik  <carsten.dominik@gmail.com>
 2009-06-06  Carsten Dominik  <carsten.dominik@gmail.com>
 
 
 	* org-clock.el (org-clock-update-mode-line): Apply face
 	* org-clock.el (org-clock-update-mode-line): Apply face

+ 8 - 6
lisp/org-exp.el

@@ -2121,22 +2121,24 @@ in the list) and remove property and value from the list in LISTVAR."
   "Replace source code segments with special code for export."
   "Replace source code segments with special code for export."
   (setq org-export-last-code-line-counter-value 0)
   (setq org-export-last-code-line-counter-value 0)
   (let ((case-fold-search t)
   (let ((case-fold-search t)
-	lang code trans opts)
+	lang code trans opts indent)
     (goto-char (point-min))
     (goto-char (point-min))
     (while (re-search-forward
     (while (re-search-forward
-	    "\\(^\\([ \t]*\\)#\\+BEGIN_SRC:?[ \t]+\\([^ \t\n]+\\)\\(.*\\)\n\\([^\000]+?\n\\)[ \t]*#\\+END_SRC.*\\)\\|\\(^[ \t]*#\\+BEGIN_EXAMPLE:?\\(?:[ \t]+\\(.*\\)\\)?\n\\([^\000]+?\n\\)[ \t]*#\\+END_EXAMPLE.*\\)"
+	    "\\(^\\([ \t]*\\)#\\+BEGIN_SRC:?[ \t]+\\([^ \t\n]+\\)\\(.*\\)\n\\([^\000]+?\n\\)[ \t]*#\\+END_SRC.*\\)\\|\\(^\\([ \t]*\\)#\\+BEGIN_EXAMPLE:?\\(?:[ \t]+\\(.*\\)\\)?\n\\([^\000]+?\n\\)[ \t]*#\\+END_EXAMPLE.*\\)"
 	    nil t)
 	    nil t)
       (if (match-end 1)
       (if (match-end 1)
 	  ;; src segments
 	  ;; src segments
 	  (setq lang (match-string 3)
 	  (setq lang (match-string 3)
 		opts (match-string 4)
 		opts (match-string 4)
-		code (match-string 5))
+		code (match-string 5)
+		indent (length (match-string 2)))
 	(setq lang nil
 	(setq lang nil
-	      opts (match-string 7)
-	      code (match-string 8)))
+	      opts (match-string 8)
+	      code (match-string 9)
+	      indent (length (match-string 7))))
 
 
       (setq trans (org-export-format-source-code-or-example
       (setq trans (org-export-format-source-code-or-example
-		   backend lang code opts (length (match-string 2))))
+		   backend lang code opts indent))
       (replace-match trans t t))))
       (replace-match trans t t))))
 
 
 (defvar htmlp)  ;; dynamically scoped
 (defvar htmlp)  ;; dynamically scoped

+ 4 - 2
lisp/org-list.el

@@ -1050,11 +1050,13 @@ cdr is the indentation string."
 
 
 (defun org-list-end (indent)
 (defun org-list-end (indent)
   "Return the position of the end of the list.
   "Return the position of the end of the list.
-INDENT is the indentation of the list."
+INDENT is the indentation of the list, as a string."
   (save-excursion
   (save-excursion
     (catch 'exit
     (catch 'exit
       (while (or (looking-at org-list-beginning-re)
       (while (or (looking-at org-list-beginning-re)
-		 (looking-at (concat "^" indent "[ \t]+\\|^$")))
+		 (looking-at (concat "^" indent "[ \t]+\\|^$"))
+		 (>= (or (get-text-property (point) 'original-indentation) -1)
+		     (length indent)))
 	(if (eq (point) (point-max))
 	(if (eq (point) (point-max))
 	    (throw 'exit (point-max)))
 	    (throw 'exit (point-max)))
 	(forward-line 1)))
 	(forward-line 1)))