mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-27 18:02:51 +00:00
org-element: Small modification to `org-element-block-name-alist'
* contrib/lisp/org-element.el (org-element-block-name-alist): Directly store parser's name in CDR.
This commit is contained in:
parent
761add3580
commit
5cbc56a175
|
@ -2841,20 +2841,20 @@ regexp matching one object can also match the other object.")
|
||||||
"List of recursive object types.")
|
"List of recursive object types.")
|
||||||
|
|
||||||
(defconst org-element-block-name-alist
|
(defconst org-element-block-name-alist
|
||||||
'(("ASCII" . export-block)
|
'(("ASCII" . org-element-export-block-parser)
|
||||||
("CENTER" . center-block)
|
("CENTER" . org-element-center-block-parser)
|
||||||
("COMMENT" . comment-block)
|
("COMMENT" . org-element-comment-block-parser)
|
||||||
("DOCBOOK" . export-block)
|
("DOCBOOK" . org-element-export-block-parser)
|
||||||
("EXAMPLE" . example-block)
|
("EXAMPLE" . org-element-example-block-parser)
|
||||||
("HTML" . export-block)
|
("HTML" . org-element-export-block-parser)
|
||||||
("LATEX" . export-block)
|
("LATEX" . org-element-export-block-parser)
|
||||||
("ODT" . export-block)
|
("ODT" . org-element-export-block-parser)
|
||||||
("QUOTE" . quote-block)
|
("QUOTE" . org-element-quote-block-parser)
|
||||||
("SRC" . src-block)
|
("SRC" . org-element-src-block-parser)
|
||||||
("VERSE" . verse-block))
|
("VERSE" . org-element-verse-block-parser))
|
||||||
"Alist between block names and their element type.
|
"Alist between block names and the associated parsing function.
|
||||||
Any block whose name has no association in the current list has
|
Names must be uppercase. Any block whose name has no association
|
||||||
a `special-block' type.")
|
is parsed with `org-element-special-block-parser'.")
|
||||||
|
|
||||||
(defconst org-element-affiliated-keywords
|
(defconst org-element-affiliated-keywords
|
||||||
'("ATTR_ASCII" "ATTR_DOCBOOK" "ATTR_HTML" "ATTR_LATEX" "ATTR_ODT" "CAPTION"
|
'("ATTR_ASCII" "ATTR_DOCBOOK" "ATTR_HTML" "ATTR_LATEX" "ATTR_ODT" "CAPTION"
|
||||||
|
@ -3064,14 +3064,14 @@ element it has to parse."
|
||||||
(org-element-planning-parser)))
|
(org-element-planning-parser)))
|
||||||
;; Blocks.
|
;; Blocks.
|
||||||
((when (looking-at "[ \t]*#\\+BEGIN_\\([-A-Za-z0-9]+\\)\\(?: \\|$\\)")
|
((when (looking-at "[ \t]*#\\+BEGIN_\\([-A-Za-z0-9]+\\)\\(?: \\|$\\)")
|
||||||
(let ((name (upcase (match-string 1))) type)
|
(let ((name (upcase (match-string 1))) parser)
|
||||||
(cond
|
(cond
|
||||||
((not (save-excursion
|
((not (save-excursion
|
||||||
(re-search-forward
|
(re-search-forward
|
||||||
(format "^[ \t]*#\\+END_%s\\(?: \\|$\\)" name) nil t)))
|
(format "^[ \t]*#\\+END_%s\\(?: \\|$\\)" name) nil t)))
|
||||||
(org-element-paragraph-parser))
|
(org-element-paragraph-parser))
|
||||||
((setq type (assoc name org-element-block-name-alist))
|
((setq parser (assoc name org-element-block-name-alist))
|
||||||
(funcall (intern (format "org-element-%s-parser" (cdr type)))))
|
(funcall (cdr parser)))
|
||||||
(t (org-element-special-block-parser))))))
|
(t (org-element-special-block-parser))))))
|
||||||
;; Inlinetask.
|
;; Inlinetask.
|
||||||
((org-at-heading-p) (org-element-inlinetask-parser raw-secondary-p))
|
((org-at-heading-p) (org-element-inlinetask-parser raw-secondary-p))
|
||||||
|
|
Loading…
Reference in a new issue