mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2025-02-02 20:55:13 +00:00
org-element: Fix block parsing
* contrib/lisp/org-element.el (org-element-current-element): Fix regexp for block boundaries. * testing/lisp/test-org-element.el (test-org-element/block-switches): Fix test.
This commit is contained in:
parent
676846cd85
commit
fd5f561a3e
@ -3020,7 +3020,7 @@ it is quicker than its counterpart, albeit more restrictive."
|
||||
(let ((type (upcase (match-string 1))))
|
||||
(if (save-excursion
|
||||
(re-search-forward
|
||||
(format "[ \t]*#\\+END_%s\\(?: \\|$\\)" type) nil t))
|
||||
(format "^[ \t]*#\\+END_%s\\(?: \\|$\\)" type) nil t))
|
||||
(funcall
|
||||
(intern
|
||||
(format
|
||||
@ -3030,9 +3030,9 @@ it is quicker than its counterpart, albeit more restrictive."
|
||||
;; Inlinetask.
|
||||
((org-at-heading-p) (org-element-inlinetask-parser raw-secondary-p))
|
||||
;; LaTeX Environment or Paragraph if incomplete.
|
||||
((looking-at "^[ \t]*\\\\begin{")
|
||||
((looking-at "[ \t]*\\\\begin{")
|
||||
(if (save-excursion
|
||||
(re-search-forward "^[ \t]*\\\\end{[^}]*}[ \t]*" nil t))
|
||||
(re-search-forward "[ \t]*\\\\end{[^}]*}[ \t]*" nil t))
|
||||
(org-element-latex-environment-parser)
|
||||
(org-element-paragraph-parser)))
|
||||
;; Property Drawer.
|
||||
@ -3046,7 +3046,7 @@ it is quicker than its counterpart, albeit more restrictive."
|
||||
(cond
|
||||
((not (save-excursion
|
||||
(re-search-forward
|
||||
(format "[ \t]*#\\+END_%s\\(?: \\|$\\)" type) nil t)))
|
||||
(format "^[ \t]*#\\+END_%s\\(?: \\|$\\)" type) nil t)))
|
||||
(org-element-paragraph-parser))
|
||||
((string= type "CENTER") (org-element-center-block-parser))
|
||||
((string= type "QUOTE") (org-element-quote-block-parser))
|
||||
|
@ -128,7 +128,7 @@ Return interpreted string."
|
||||
(should (org-element-property :preserve-indent element))))
|
||||
;; 2. "-n -r -k" combination should number lines, retain labels but
|
||||
;; not use them in coderefs.
|
||||
(org-test-with-temp-text "#+BEGIN_EXAMPLE -n -r -k\nText.\N#+END_EXAMPLE"
|
||||
(org-test-with-temp-text "#+BEGIN_EXAMPLE -n -r -k\nText.\n#+END_EXAMPLE"
|
||||
(let ((element (org-element-current-element)))
|
||||
(should (and (org-element-property :number-lines element)
|
||||
(org-element-property :retain-labels element)
|
||||
|
Loading…
x
Reference in New Issue
Block a user