forked from mirrors/org-mode
org-element: Recognize LaTeX environments with options
* lisp/org-element.el (org-element--current-element): Allow the opening string of a LaTeX environment to contain additional arguments. * testing/lisp/test-org-element.el: Add tests.
This commit is contained in:
parent
cf48a620e9
commit
41bd891d48
|
@ -3775,7 +3775,7 @@ element it has to parse."
|
||||||
(goto-char (car affiliated))
|
(goto-char (car affiliated))
|
||||||
(org-element-keyword-parser limit nil))
|
(org-element-keyword-parser limit nil))
|
||||||
;; LaTeX Environment.
|
;; LaTeX Environment.
|
||||||
((looking-at "[ \t]*\\\\begin{\\([A-Za-z0-9*]+\\)}[ \t]*$")
|
((looking-at "[ \t]*\\\\begin{\\([A-Za-z0-9*]+\\)}")
|
||||||
(org-element-latex-environment-parser limit affiliated))
|
(org-element-latex-environment-parser limit affiliated))
|
||||||
;; Drawer and Property Drawer.
|
;; Drawer and Property Drawer.
|
||||||
((looking-at org-drawer-regexp)
|
((looking-at org-drawer-regexp)
|
||||||
|
|
|
@ -1117,8 +1117,7 @@ Paragraph"
|
||||||
"Test `latex-environment' parser."
|
"Test `latex-environment' parser."
|
||||||
(should
|
(should
|
||||||
(org-test-with-temp-text "\\begin{equation}\ne^{i\\pi}+1=0\n\\end{equation}"
|
(org-test-with-temp-text "\\begin{equation}\ne^{i\\pi}+1=0\n\\end{equation}"
|
||||||
(org-element-map
|
(org-element-map (org-element-parse-buffer) 'latex-environment 'identity)))
|
||||||
(org-element-parse-buffer) 'latex-environment 'identity)))
|
|
||||||
;; Allow nested environments.
|
;; Allow nested environments.
|
||||||
(should
|
(should
|
||||||
(equal
|
(equal
|
||||||
|
@ -1136,7 +1135,13 @@ e^{i\\pi}+1=0
|
||||||
(org-element-property
|
(org-element-property
|
||||||
:value
|
:value
|
||||||
(org-element-map
|
(org-element-map
|
||||||
(org-element-parse-buffer) 'latex-environment 'identity nil t))))))
|
(org-element-parse-buffer) 'latex-environment 'identity nil t)))))
|
||||||
|
;; Allow environments with options.
|
||||||
|
(should
|
||||||
|
(eq 'latex-environment
|
||||||
|
(org-test-with-temp-text
|
||||||
|
"\\begin{theorem}[Euler]\ne^{i\\pi}+1=0\n\\end{theorem}"
|
||||||
|
(org-element-type (org-element-at-point))))))
|
||||||
|
|
||||||
|
|
||||||
;;;; Latex Fragment
|
;;;; Latex Fragment
|
||||||
|
@ -2218,7 +2223,10 @@ CLOCK: [2012-01-01 sun. 00:01]--[2012-01-01 sun. 00:02] => 0:01"))
|
||||||
"Test latex environment interpreter."
|
"Test latex environment interpreter."
|
||||||
(should (equal (org-test-parse-and-interpret
|
(should (equal (org-test-parse-and-interpret
|
||||||
"\\begin{equation}\n1+1=2\n\\end{equation}")
|
"\\begin{equation}\n1+1=2\n\\end{equation}")
|
||||||
"\\begin{equation}\n1+1=2\n\\end{equation}\n")))
|
"\\begin{equation}\n1+1=2\n\\end{equation}\n"))
|
||||||
|
(should (equal (org-test-parse-and-interpret
|
||||||
|
"\\begin{theorem}[me]\n1+1=2\n\\end{theorem}")
|
||||||
|
"\\begin{theorem}[me]\n1+1=2\n\\end{theorem}\n")))
|
||||||
|
|
||||||
(ert-deftest test-org-element/planning-interpreter ()
|
(ert-deftest test-org-element/planning-interpreter ()
|
||||||
"Test planning interpreter."
|
"Test planning interpreter."
|
||||||
|
|
Loading…
Reference in New Issue