org-element: Fix export of LaTeX math in headlines

* lisp/org-element.el (org-element-class): Find pseudo-objects in
  secondary strings.
* testing/lisp/test-org-element.el (test-org-element/class): Add test.

This bug was introduced in 1a88cf920e.

Reported-by: Stefanos Carlström <stefanos.carlstrom@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/109922>
This commit is contained in:
Nicolas Goaziou 2016-10-28 15:46:22 +02:00
parent 33f8f8adaa
commit 4f9ec1adeb
2 changed files with 8 additions and 1 deletions

View File

@ -539,6 +539,7 @@ value of DATUM `:parent' property."
(let ((parent-type (org-element-type parent)))
(cond ((not parent-type) 'object)
((memq parent-type org-element-object-containers) 'object)
((org-element-secondary-p datum) 'object)
(t 'element)))))))
(defsubst org-element-adopt-elements (parent &rest children)

View File

@ -156,7 +156,13 @@ Some other text
;; Pseudo objects.
(should (eq 'object (org-element-class '(foo nil) '(bold nil))))
(should (eq 'object (org-element-class '(foo nil) '(paragraph nil))))
(should (eq 'object (org-element-class '(foo nil) '("secondary")))))
(should (eq 'object (org-element-class '(foo nil) '("secondary"))))
(should
(eq 'object
(let* ((datum '(foo nil))
(headline `(headline (:title (,datum)))))
(org-element-put-property datum :parent headline)
(org-element-class datum)))))
(ert-deftest test-org-element/adopt-elements ()
"Test `org-element-adopt-elements' specifications."