org-element-dynamic-block-open-re-nogroup: Demand block name

* lisp/org-element.el (org-element-dynamic-block-open-re-nogroup): Fix
inconsistency with `org-element-dynamic-block-open-re' - block name is
mandatory.
*
testing/lisp/test-org-element.el (test-org-element/dynamic-block-parser):
Add test.
This commit is contained in:
Ihor Radchenko 2023-09-12 11:15:17 +03:00
parent 1d585a1b38
commit 20162f5a5c
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
2 changed files with 6 additions and 2 deletions

View File

@ -189,7 +189,7 @@ Parameters are in match group 2.")
(defconst org-element-dynamic-block-open-re-nogroup
(rx line-start (0+ (any ?\s ?\t))
"#+BEGIN:" (0+ (any ?\s ?\t)))
"#+BEGIN:" (0+ (any ?\s ?\t)) word)
"Regexp matching the opening line of a dynamic block.")
(defconst org-element-headline-re

View File

@ -1282,7 +1282,11 @@ Some other text
;; Handle non-empty blank line at the end of buffer.
(should
(org-test-with-temp-text "#+BEGIN: myblock :param val1\nC\n#+END:\n "
(= (org-element-property :end (org-element-at-point)) (point-max)))))
(= (org-element-property :end (org-element-at-point)) (point-max))))
;; Block name is mandatory.
(should-not
(org-test-with-temp-text "#+BEGIN:\n\n#+END:\n"
(org-element-type-p (org-element-at-point) 'dynamic-block))))
;;;; Entity