Explorar el Código

Merge branch 'maint'

Nicolas Goaziou hace 12 años
padre
commit
90aae1e2e8
Se han modificado 2 ficheros con 21 adiciones y 16 borrados
  1. 14 15
      lisp/org-element.el
  2. 7 1
      testing/lisp/test-org-element.el

+ 14 - 15
lisp/org-element.el

@@ -1189,18 +1189,18 @@ and `:post-blank' keywords."
   (save-excursion
     ;; Beginning of section is the beginning of the first non-blank
     ;; line after previous headline.
-    (org-with-limited-levels
-     (let ((begin (point))
-	   (end (progn (goto-char limit) (point)))
-	   (pos-before-blank (progn (skip-chars-backward " \r\t\n")
-				    (forward-line)
-				    (point))))
-       (list 'section
-	     (list :begin begin
-		   :end end
-		   :contents-begin begin
-		   :contents-end pos-before-blank
-		   :post-blank (count-lines pos-before-blank end)))))))
+    (let ((begin (point))
+	  (end (progn (org-with-limited-levels (outline-next-heading))
+		      (point)))
+	  (pos-before-blank (progn (skip-chars-backward " \r\t\n")
+				   (forward-line)
+				   (point))))
+      (list 'section
+	    (list :begin begin
+		  :end end
+		  :contents-begin begin
+		  :contents-end pos-before-blank
+		  :post-blank (count-lines pos-before-blank end))))))
 
 (defun org-element-section-interpreter (section contents)
   "Interpret SECTION element as Org syntax.
@@ -3355,15 +3355,14 @@ element it has to parse."
        ;; Item.
        ((eq special 'item)
 	(org-element-item-parser limit structure raw-secondary-p))
-       ;; Quote Section.
-       ((eq special 'quote-section) (org-element-quote-section-parser limit))
        ;; Table Row.
        ((eq special 'table-row) (org-element-table-row-parser limit))
        ;; Headline.
        ((org-with-limited-levels (org-at-heading-p))
         (org-element-headline-parser limit raw-secondary-p))
-       ;; Section (must be checked after headline).
+       ;; Sections (must be checked after headline).
        ((eq special 'section) (org-element-section-parser limit))
+       ((eq special 'quote-section) (org-element-quote-section-parser limit))
        ((eq special 'first-section)
 	(org-element-section-parser
 	 (or (save-excursion (org-with-limited-levels (outline-next-heading)))

+ 7 - 1
testing/lisp/test-org-element.el

@@ -1345,7 +1345,13 @@ Outside list"
   ;; A section cannot be empty.
   (should-not
    (org-test-with-temp-text "* Headline 1\n* Headline 2"
-     (org-element-map (org-element-parse-buffer) 'section 'identity))))
+     (org-element-map (org-element-parse-buffer) 'section 'identity)))
+  ;; A section doesn't contain sub-trees.
+  (should-not
+   (org-test-with-temp-text "* Head\nText\n** Sub-Head"
+     (org-element-map
+      (org-element-map (org-element-parse-buffer) 'section 'identity nil t)
+      'headline 'identity))))
 
 
 ;;;; Special Block