Function: org-element-dynamic-block-parser
org-element-dynamic-block-parser is a byte-compiled function defined
in org-element.el.gz.
Signature
(org-element-dynamic-block-parser LIMIT AFFILIATED)
Documentation
Parse a dynamic block.
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 list whose CAR is dynamic-block and CDR is a plist
containing :block-name, :begin, :end, :contents-begin,
:contents-end, :arguments, :post-blank and
:post-affiliated keywords.
Assume point is at beginning of dynamic block.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-element.el.gz
;;;; Dynamic Block
(defun org-element-dynamic-block-parser (limit affiliated)
"Parse a dynamic block.
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 list whose CAR is `dynamic-block' and CDR is a plist
containing `:block-name', `:begin', `:end', `:contents-begin',
`:contents-end', `:arguments', `:post-blank' and
`:post-affiliated' keywords.
Assume point is at beginning of dynamic block."
(let ((case-fold-search t))
(if (not (save-excursion
(re-search-forward "^[ \t]*#\\+END:?[ \t]*$" limit t)))
;; Incomplete block: parse it as a paragraph.
(org-element-paragraph-parser limit affiliated)
(let ((block-end-line (match-beginning 0)))
(save-excursion
(let* ((name (progn
(looking-at org-element-dynamic-block-open-re)
(match-string-no-properties 1)))
(arguments (match-string-no-properties 2))
(begin (car affiliated))
(post-affiliated (point))
;; Empty blocks have no contents.
(contents-begin (progn (forward-line)
(and (< (point) block-end-line)
(point))))
(contents-end (and contents-begin block-end-line))
(pos-before-blank (progn (goto-char block-end-line)
(forward-line)
(point)))
(end (progn (skip-chars-forward " \r\t\n" limit)
(if (eobp) (point) (line-beginning-position)))))
(list 'dynamic-block
(nconc
(list :begin begin
:end end
:block-name name
:arguments arguments
:contents-begin contents-begin
:contents-end contents-end
:post-blank (count-lines pos-before-blank end)
:post-affiliated post-affiliated)
(cdr affiliated)))))))))