forked from mirrors/org-mode
ox: Fix next/previous element getters
* lisp/ox.el (org-export-get-previous-element, org-export-get-next-element): Fix return value for non plain text objects in a secondary string. * testing/lisp/test-ox.el: Add tests.
This commit is contained in:
parent
ede82ccf93
commit
6cc028bf74
26
lisp/ox.el
26
lisp/ox.el
|
@ -5151,14 +5151,11 @@ all of them."
|
|||
;; to a secondary string. We check the latter option
|
||||
;; first.
|
||||
(let ((parent (org-export-get-parent blob)))
|
||||
(or (and (not (memq (org-element-type blob)
|
||||
org-element-all-elements))
|
||||
(let ((sec-value
|
||||
(org-element-property
|
||||
(cdr (assq (org-element-type parent)
|
||||
org-element-secondary-value-alist))
|
||||
parent)))
|
||||
(and (memq blob sec-value) sec-value)))
|
||||
(or (let ((sec-value (org-element-property
|
||||
(cdr (assq (org-element-type parent)
|
||||
org-element-secondary-value-alist))
|
||||
parent)))
|
||||
(and (memq blob sec-value) sec-value))
|
||||
(org-element-contents parent))))
|
||||
prev)
|
||||
(catch 'exit
|
||||
|
@ -5186,14 +5183,11 @@ them."
|
|||
;; An object can belong to the contents of its parent or to
|
||||
;; a secondary string. We check the latter option first.
|
||||
(let ((parent (org-export-get-parent blob)))
|
||||
(or (and (not (memq (org-element-type blob)
|
||||
org-element-all-objects))
|
||||
(let ((sec-value
|
||||
(org-element-property
|
||||
(cdr (assq (org-element-type parent)
|
||||
org-element-secondary-value-alist))
|
||||
parent)))
|
||||
(cdr (memq blob sec-value))))
|
||||
(or (let ((sec-value (org-element-property
|
||||
(cdr (assq (org-element-type parent)
|
||||
org-element-secondary-value-alist))
|
||||
parent)))
|
||||
(cdr (memq blob sec-value)))
|
||||
(cdr (memq blob (org-element-contents parent))))))
|
||||
next)
|
||||
(catch 'exit
|
||||
|
|
|
@ -2723,6 +2723,12 @@ Another text. (ref:text)
|
|||
(org-element-type
|
||||
(org-export-get-next-element
|
||||
(org-element-map tree 'plain-text 'identity info t) info)))))
|
||||
(should
|
||||
(eq 'verbatim
|
||||
(org-test-with-parsed-data "* /italic/ =verb="
|
||||
(org-element-type
|
||||
(org-export-get-next-element
|
||||
(org-element-map tree 'italic 'identity info t) info)))))
|
||||
;; Find next element in document keywords.
|
||||
(should
|
||||
(eq 'verbatim
|
||||
|
@ -2783,6 +2789,12 @@ Another text. (ref:text)
|
|||
(org-element-type
|
||||
(org-export-get-previous-element
|
||||
(org-element-map tree 'plain-text 'identity info t) info)))))
|
||||
(should
|
||||
(eq 'verbatim
|
||||
(org-test-with-parsed-data "* =verb= /italic/"
|
||||
(org-element-type
|
||||
(org-export-get-previous-element
|
||||
(org-element-map tree 'italic 'identity info t) info)))))
|
||||
;; Find previous element in document keywords.
|
||||
(should
|
||||
(eq 'verbatim
|
||||
|
|
Loading…
Reference in New Issue