ox: Change order of retured elements in `org-export-get-previous-element'

* lisp/ox.el (org-export-get-previous-element): Change order of
  retured elements in `org-export-get-previous-element'.
* testing/lisp/test-ox.el: Update test.
This commit is contained in:
Nicolas Goaziou 2013-02-25 23:16:14 +01:00
parent 7cd6fdcd34
commit 367e680582
2 changed files with 7 additions and 7 deletions

View File

@ -4800,8 +4800,8 @@ a communication channel. Return previous exportable element or
object, a string, or nil.
When optional argument N is a positive integer, return a list
containing up to N siblings before BLOB, from closest to
farthest. With any other non-nil value, return a list containing
containing up to N siblings before BLOB, from farthest to
closest. With any other non-nil value, return a list containing
all of them."
(let ((siblings
;; An object can belong to the contents of its parent or
@ -4823,10 +4823,10 @@ all of them."
(cond ((memq obj (plist-get info :ignore-list)))
((null n) (throw 'exit obj))
((not (wholenump n)) (push obj prev))
((zerop n) (throw 'exit (nreverse prev)))
((zerop n) (throw 'exit prev))
(t (decf n) (push obj prev))))
(cdr (memq blob (reverse siblings))))
(nreverse prev))))
prev)))
(defun org-export-get-next-element (blob info &optional n)
"Return next element or object.

View File

@ -2340,7 +2340,7 @@ Another text. (ref:text)
(org-element-type
(org-export-get-previous-element
(org-element-map
(plist-get info :title) 'plain-text 'identity info t) info)))))
(plist-get info :title) 'plain-text 'identity info t) info)))))
;; Find previous element in parsed affiliated keywords.
(should
(eq 'verbatim
@ -2351,7 +2351,7 @@ Another text. (ref:text)
;; With optional argument N, return a list containing up to
;; N previous elements.
(should
(equal '(bold italic underline)
(equal '(underline italic bold)
(org-test-with-parsed-data "_a_ /b/ *c* ~d~"
(mapcar 'car
(org-export-get-previous-element
@ -2359,7 +2359,7 @@ Another text. (ref:text)
;; When N is a positive integer, return a list containing up to
;; N previous elements.
(should
(equal '(bold italic)
(equal '(italic bold)
(org-test-with-parsed-data "_a_ /b/ *c* ~d~"
(mapcar 'car
(org-export-get-previous-element