summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2012-11-18 13:44:20 (GMT)
committer Nicolas Goaziou <n.goaziou@gmail.com>2012-11-18 13:44:20 (GMT)
commit5107ca3c9bfe0b64b6bd612b712c2a6700af6f7a (patch)
tree9c143da55caab5b51912861d50414fa95af2ddbc
parentc2223c8979c5510e01c0dd6cc2378b71484828fc (diff)
downloadorg-mode-5107ca3c9bfe0b64b6bd612b712c2a6700af6f7a.zip
org-mode-5107ca3c9bfe0b64b6bd612b712c2a6700af6f7a.tar.gz
org-export: Fix subtree option with `split' behaviour
* contrib/lisp/org-export.el (org-export--get-subtree-options): Store value of options with `split' behaviour as a list of strings, not simply as a string. Small refactoring. * testing/lisp/test-org-export.el: Add tests.
-rw-r--r--contrib/lisp/org-export.el19
-rw-r--r--testing/lisp/test-org-export.el26
2 files changed, 37 insertions, 8 deletions
diff --git a/contrib/lisp/org-export.el b/contrib/lisp/org-export.el
index c9f0edc..49d07e3 100644
--- a/contrib/lisp/org-export.el
+++ b/contrib/lisp/org-export.el
@@ -1396,9 +1396,8 @@ for export. Return options as a plist."
(unless (org-at-heading-p) (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 (progn (looking-at org-todo-line-regexp)
- (or (save-match-data
- (org-entry-get (point) "EXPORT_TITLE"))
+ (when (setq prop (or (org-entry-get (point) "EXPORT_TITLE")
+ (progn (looking-at org-todo-line-regexp)
(org-match-string-no-properties 3))))
(setq plist
(plist-put
@@ -1426,11 +1425,15 @@ for export. Return options as a plist."
(plist-put
plist
(car option)
- ;; Parse VALUE if required.
- (if (member property org-element-document-properties)
- (org-element-parse-secondary-string
- value (org-element-restriction 'keyword))
- value))))))))
+ (cond
+ ;; Parse VALUE if required.
+ ((member property org-element-document-properties)
+ (org-element-parse-secondary-string
+ value (org-element-restriction 'keyword)))
+ ;; If BEHAVIOUR is `split' expected value is
+ ;; a list of strings, not a string.
+ ((eq (nth 4 option) 'split) (org-split-string value))
+ (t value)))))))))
;; Also look for both general keywords and back-end specific
;; options if BACKEND is provided.
(append (and backend (org-export-backend-options backend))
diff --git a/testing/lisp/test-org-export.el b/testing/lisp/test-org-export.el
index 7eb9f99..e049406 100644
--- a/testing/lisp/test-org-export.el
+++ b/testing/lisp/test-org-export.el
@@ -185,6 +185,32 @@ Paragraph"
(forward-line)
(should (equal (plist-get (org-export-get-environment nil t) :date)
'("29-03-2012"))))
+ ;; Properties with `split' behaviour are stored as a list of
+ ;; strings.
+ (should
+ (equal '("a" "b")
+ (org-test-with-temp-text "#+EXCLUDE_TAGS: noexport
+* Headline
+ :PROPERTIES:
+ :EXPORT_EXCLUDE_TAGS: a b
+ :END:
+Paragraph"
+ (progn
+ (forward-line)
+ (plist-get (org-export-get-environment nil t) :exclude-tags)))))
+ ;; Handle :PROPERTY+: syntax.
+ (should
+ (equal '("a" "b")
+ (org-test-with-temp-text "#+EXCLUDE_TAGS: noexport
+* Headline
+ :PROPERTIES:
+ :EXPORT_EXCLUDE_TAGS: a
+ :EXPORT_EXCLUDE_TAGS+: b
+ :END:
+Paragraph"
+ (progn
+ (forward-line)
+ (plist-get (org-export-get-environment nil t) :exclude-tags)))))
;; Export properties are case-insensitive.
(org-test-with-temp-text "* Headline
:PROPERTIES: