summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-12-02 12:23:02 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-12-02 12:23:02 +0100
commit0ace32b045cb70c7889eece0cb351217b7fd652a (patch)
treec9273a829e01b386f32477e1ef46b77a91c42973
parent7a3cae65a705f0559d890c6e11f8317ba8dbe42d (diff)
parentf53d1e2005a26a52427b7514f2d3e7cfa3ff2562 (diff)
downloadorg-mode-0ace32b045cb70c7889eece0cb351217b7fd652a.tar.gz
Merge branch 'maint'
-rw-r--r--lisp/ox.el12
-rw-r--r--testing/lisp/test-ox.el8
2 files changed, 15 insertions, 5 deletions
diff --git a/lisp/ox.el b/lisp/ox.el
index db5594f..00aba6f 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -4031,11 +4031,15 @@ used as a communication channel."
(memq (org-element-type (org-export-get-previous-element blob info))
'(nil section)))
-(defun org-export-last-sibling-p (blob info)
- "Non-nil when BLOB is the last sibling in its parent.
-BLOB is an element or an object. INFO is a plist used as
+(defun org-export-last-sibling-p (datum info)
+ "Non-nil when DATUM is the last sibling in its parent.
+DATUM is an element or an object. INFO is a plist used as
a communication channel."
- (not (org-export-get-next-element blob info)))
+ (let ((next (org-export-get-next-element datum info)))
+ (or (not next)
+ (and (eq 'headline (org-element-type datum))
+ (> (org-element-property :level datum)
+ (org-element-property :level next))))))
;;;; For Keywords
diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el
index d88d7e3..25ef8a5 100644
--- a/testing/lisp/test-ox.el
+++ b/testing/lisp/test-ox.el
@@ -2677,7 +2677,13 @@ Para2"
(org-test-with-parsed-data "* Headline\n* Headline 2 :ignore:"
(org-element-map tree 'headline
(lambda (h) (if (org-export-last-sibling-p h info) 'yes 'no))
- info))))))
+ info)))))
+ ;; Handle gracefully discontinuous headings.
+ (should
+ (equal '(yes yes)
+ (org-test-with-parsed-data "** S\n* H"
+ (org-element-map tree 'headline
+ (lambda (h) (if (org-export-last-sibling-p h info) 'yes 'no)))))))
(ert-deftest test-org-export/handle-inlinetasks ()
"Test inlinetask export."