Browse Source

org-element: Fix to footnote-definition parsing

* contrib/lisp/org-element.el (org-element-footnote-definition-parser):
Fix bug when parsing a footnote definition at end of buffer.
* testing/lisp/test-org-element.el: Add test.
Nicolas Goaziou 13 năm trước cách đây
mục cha
commit
b137cdb296
2 tập tin đã thay đổi với 12 bổ sung3 xóa
  1. 2 2
      contrib/lisp/org-element.el
  2. 10 1
      testing/lisp/test-org-element.el

+ 2 - 2
contrib/lisp/org-element.el

@@ -294,9 +294,9 @@ Assume point is at the beginning of the footnote definition."
 			       (re-search-forward
 				(concat org-outline-regexp-bol "\\|"
 					org-footnote-definition-re "\\|"
-					"^[ \t]*$") nil t))
+					"^[ \t]*$") nil 'move))
 			     (match-beginning 0)
-			   (point-max)))
+			   (point)))
 	   (end (progn (org-skip-whitespace)
 		       (if (eobp) (point) (point-at-bol)))))
       `(footnote-definition

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

@@ -519,7 +519,16 @@ CLOCK: [2012-01-01 sun. 00:01]--[2012-01-01 sun. 00:02] =>  0:01"
 	      :post-blank 0)
       (paragraph
        (:begin 8 :end 18 :contents-begin 8 :contents-end 18 :post-blank 0)
-       "Definition")))))
+       "Definition"))))
+  ;; Footnote with more contents
+  (should
+   (= 28
+      (org-element-property
+       :end
+       (org-test-with-temp-text "[fn:1] Definition\n| a | b |"
+	 (org-element-map
+	  (org-element-parse-buffer)
+	  'footnote-definition 'identity nil t))))))
 
 
 ;;;; Footnotes Reference