summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2013-01-26 18:05:56 +0100
committerNicolas Goaziou <n.goaziou@gmail.com>2013-01-26 18:05:56 +0100
commitbb40d29b45e091f3a4226c890e1130299c4dffd4 (patch)
tree6d2059e27a05fc3f1e9c2711ba36b11c79c848a4
parent5e11659e66845e918a047f4a89d171f599729174 (diff)
downloadorg-mode-bb40d29b45e091f3a4226c890e1130299c4dffd4.tar.gz
org-export: Fix subtree export when parent section is empty
* contrib/lisp/org-export.el (org-export--get-subtree-options): When point is at an headline and subtree export is called, make sure export properties are extracted from parent headline. * testing/lisp/test-org-export.el: Add test.
-rw-r--r--contrib/lisp/org-export.el2
-rw-r--r--testing/lisp/test-org-export.el8
2 files changed, 8 insertions, 2 deletions
diff --git a/contrib/lisp/org-export.el b/contrib/lisp/org-export.el
index 8702e41..c54805d 100644
--- a/contrib/lisp/org-export.el
+++ b/contrib/lisp/org-export.el
@@ -1447,7 +1447,7 @@ for export. Return options as a plist."
(org-with-wide-buffer
(let (prop plist)
;; Make sure point is at an heading.
- (unless (org-at-heading-p) (org-back-to-heading t))
+ (if (org-at-heading-p) (org-up-heading-safe) (org-back-to-heading t))
;; Take care of EXPORT_TITLE. If it isn't defined, use headline's
;; title as its fallback value.
(when (setq prop (or (org-entry-get (point) "EXPORT_TITLE")
diff --git a/testing/lisp/test-org-export.el b/testing/lisp/test-org-export.el
index 1152940..858ccda 100644
--- a/testing/lisp/test-org-export.el
+++ b/testing/lisp/test-org-export.el
@@ -226,7 +226,13 @@ Paragraph"
:END:
Paragraph"
(should (equal (plist-get (org-export-get-environment nil t) :date)
- '("29-03-2012")))))
+ '("29-03-2012"))))
+ ;; Still grab correct options when section above is empty.
+ (should
+ (equal '("H1")
+ (org-test-with-temp-text "* H1\n** H11\n** H12"
+ (progn (forward-line 2)
+ (plist-get (org-export-get-environment nil t) :title))))))
(ert-deftest test-org-export/handle-options ()
"Test if export options have an impact on output."