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.
This commit is contained in:
Nicolas Goaziou 2012-05-05 01:38:11 +02:00
parent 2a6b7c87f4
commit b137cdb296
2 changed files with 12 additions and 3 deletions

View File

@ -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

View File

@ -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