Function: org-element-section-parser

org-element-section-parser is a byte-compiled function defined in org-element.el.gz.

Signature

(org-element-section-parser _)

Documentation

Parse a section.

Return a list whose CAR is section and CDR is a plist containing :begin, :end, :contents-begin, contents-end,
:post-blank and :post-affiliated keywords.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-element.el.gz
;;;; Section

(defun org-element-section-parser (_)
  "Parse a section.

Return a list whose CAR is `section' and CDR is a plist
containing `:begin', `:end', `:contents-begin', `contents-end',
`:post-blank' and `:post-affiliated' keywords."
  (save-excursion
    ;; Beginning of section is the beginning of the first non-blank
    ;; line after previous headline.
    (let* ((begin (point))
	   (end (progn (org-with-limited-levels (outline-next-heading))
		       (point)))
	   (pos-before-blank (progn (skip-chars-backward " \r\t\n")
				    (line-beginning-position 2)))
           (robust-end (when (> (- pos-before-blank 2) begin)
                         (- pos-before-blank 2)))
           (robust-begin (when robust-end begin))
           )
      (list 'section
	    (list :begin begin
		  :end end
		  :contents-begin begin
		  :contents-end pos-before-blank
                  :robust-begin robust-begin
                  :robust-end robust-end
		  :post-blank (count-lines pos-before-blank end)
		  :post-affiliated begin)))))