Function: org-element-footnote-definition-parser
org-element-footnote-definition-parser is a byte-compiled function
defined in org-element.el.gz.
Signature
(org-element-footnote-definition-parser LIMIT AFFILIATED)
Documentation
Parse a footnote definition.
LIMIT bounds the search. AFFILIATED is a list of which CAR is the buffer position at the beginning of the first affiliated keyword and CDR is a plist of affiliated keywords along with their value.
Return a new syntax node of footnote-definition type containing
:label, :begin :end, :contents-begin, :contents-end,
:pre-blank,:post-blank and :post-affiliated properties.
Assume point is at the beginning of the footnote definition.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-element.el.gz
(defun org-element-footnote-definition-parser (limit affiliated)
"Parse a footnote definition.
LIMIT bounds the search. AFFILIATED is a list of which CAR is
the buffer position at the beginning of the first affiliated
keyword and CDR is a plist of affiliated keywords along with
their value.
Return a new syntax node of `footnote-definition' type containing
`:label', `:begin' `:end', `:contents-begin', `:contents-end',
`:pre-blank',`:post-blank' and `:post-affiliated' properties.
Assume point is at the beginning of the footnote definition."
(save-excursion
(let* ((label (progn (looking-at org-footnote-definition-re)
(org-element--get-cached-string
(match-string-no-properties 1))))
(begin (car affiliated))
(post-affiliated (point))
(end
(save-excursion
(end-of-line)
(cond
((not
(re-search-forward org-element--footnote-separator limit t))
limit)
((eq ?\[ (char-after (match-beginning 0)))
;; At a new footnote definition, make sure we end
;; before any affiliated keyword above.
(forward-line -1)
(while (and (> (point) post-affiliated)
(looking-at-p org-element--affiliated-re))
(forward-line -1))
(line-beginning-position 2))
((eq ?* (char-after (match-beginning 0))) (match-beginning 0))
(t (skip-chars-forward " \r\t\n" limit)
(if (= limit (point)) limit (line-beginning-position))))))
(pre-blank 0)
(contents-begin
(progn (search-forward "]")
(skip-chars-forward " \r\t\n" end)
(cond ((= (point) end) nil)
((= (line-beginning-position) post-affiliated) (point))
(t
(setq pre-blank
(count-lines (line-beginning-position) begin))
(line-beginning-position)))))
(contents-end
(progn (goto-char end)
(skip-chars-backward " \r\t\n")
(line-beginning-position 2))))
(org-element-create
'footnote-definition
(nconc
(list :label label
:begin begin
:end end
:contents-begin contents-begin
:contents-end (and contents-begin contents-end)
:pre-blank pre-blank
:post-blank (count-lines contents-end end)
:post-affiliated post-affiliated)
(cdr affiliated))))))