Function: org-element-export-snippet-parser

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

Signature

(org-element-export-snippet-parser)

Documentation

Parse export snippet at point.

When at an export snippet, return a list whose car is export-snippet and cdr a plist with :begin, :end,
:back-end, :value and :post-blank as keywords. Otherwise,
return nil.

Assume point is at the beginning of the snippet.

Source Code

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

(defun org-element-export-snippet-parser ()
  "Parse export snippet at point.

When at an export snippet, return a list whose car is
`export-snippet' and cdr a plist with `:begin', `:end',
`:back-end', `:value' and `:post-blank' as keywords.  Otherwise,
return nil.

Assume point is at the beginning of the snippet."
  (save-excursion
    (let (contents-end)
      (when (and (looking-at "@@\\([-A-Za-z0-9]+\\):")
		 (setq contents-end
		       (save-match-data (goto-char (match-end 0))
                                        (when
					    (re-search-forward "@@" nil t)
					  (match-beginning 0)))))
	(let* ((begin (match-beginning 0))
	       (back-end (match-string-no-properties 1))
	       (value (buffer-substring-no-properties
		       (match-end 0) contents-end))
	       (post-blank (skip-chars-forward " \t"))
	       (end (point)))
	  (list 'export-snippet
		(list :back-end back-end
		      :value value
		      :begin begin
		      :end end
		      :post-blank post-blank)))))))