Function: org-element-entity-parser

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

Signature

(org-element-entity-parser)

Documentation

Parse entity at point, if any.

When at an entity, return a new syntax node of entity type containing :begin, :end, :latex, :latex-math-p, :html,
:latin1, :utf-8, :ascii, :use-brackets-p and :post-blank as
properties. Otherwise, return nil.

Assume point is at the beginning of the entity.

Source Code

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

(defun org-element-entity-parser ()
  "Parse entity at point, if any.

When at an entity, return a new syntax node of `entity' type
containing `:begin', `:end', `:latex', `:latex-math-p', `:html',
`:latin1', `:utf-8', `:ascii', `:use-brackets-p' and `:post-blank' as
properties.  Otherwise, return nil.

Assume point is at the beginning of the entity."
  (catch 'no-object
    (when (looking-at
           (rx "\\"
               (or
                ;; Special case: whitespace entities are matched by
                ;; name only.
                (group-n 1 (seq "_" (1+ " ")))
                (seq
                 (group-n 1
                   (or "there4"
                       (seq "sup" (in "123"))
                       (seq "frac" (in "13") (in "24"))
                       (1+ (in "a-zA-Z"))))
                 (group-n 2 (or eol "{}" (not letter)))))))
      (save-excursion
	(let* ((value (or (org-entity-get (match-string 1))
			  (throw 'no-object nil)))
	       (begin (match-beginning 0))
	       (bracketsp (string= (match-string 2) "{}"))
	       (post-blank (progn (goto-char (match-end 1))
				  (when bracketsp (forward-char 2))
				  (skip-chars-forward " \t")))
	       (end (point)))
	  (org-element-create
           'entity
	   (list :name (car value)
		 :latex (nth 1 value)
		 :latex-math-p (nth 2 value)
		 :html (nth 3 value)
		 :ascii (nth 4 value)
		 :latin1 (nth 5 value)
		 :utf-8 (nth 6 value)
		 :begin begin
		 :end end
		 :use-brackets-p bracketsp
		 :post-blank post-blank)))))))