org-taskjuggler.el: Introduce a global header, for early macros

* org-taskjuggler.el (org-export-taskjuggler-default-global-header): Add
new option.
(org-export-as-taskjuggler): Insert global header before anything else.
This commit is contained in:
Yann Hodique 2012-08-16 21:02:03 +02:00 committed by Bastien Guerry
parent bc78b9941c
commit 9fef2fb032
1 changed files with 14 additions and 5 deletions

View File

@ -221,6 +221,14 @@ with `org-export-taskjuggler-project-tag'"
:version "24.1" :version "24.1"
:type '(repeat (string :tag "Report"))) :type '(repeat (string :tag "Report")))
(defcustom org-export-taskjuggler-default-global-header
""
"Default global header for the project. This goes before
project declaration, and might be useful for early macros"
:group 'org-export-taskjuggler
:version "24.1"
:type '(string :tag "Preamble"))
(defcustom org-export-taskjuggler-default-global-properties (defcustom org-export-taskjuggler-default-global-properties
"shift s40 \"Part time shift\" { "shift s40 \"Part time shift\" {
workinghours wed, thu, fri off workinghours wed, thu, fri off
@ -332,11 +340,6 @@ defined in `org-export-taskjuggler-default-reports'."
(setcar tasks (push (cons "version" version) task)))) (setcar tasks (push (cons "version" version) task))))
(with-current-buffer buffer (with-current-buffer buffer
(erase-buffer) (erase-buffer)
(org-clone-local-variables old-buffer "^org-")
(org-taskjuggler-open-project (car tasks))
(insert org-export-taskjuggler-default-global-properties)
(insert "\n")
(dolist (resource resources)
(org-install-letbind) (org-install-letbind)
;; create local variables for all options, to make sure all called ;; create local variables for all options, to make sure all called
;; functions get the correct information ;; functions get the correct information
@ -345,6 +348,12 @@ defined in `org-export-taskjuggler-default-reports'."
(plist-get opt-plist (car x)))) (plist-get opt-plist (car x))))
org-export-plist-vars) org-export-plist-vars)
(org-clone-local-variables old-buffer "^org-")
(insert org-export-taskjuggler-default-global-header)
(org-taskjuggler-open-project (car tasks))
(insert org-export-taskjuggler-default-global-properties)
(insert "\n")
(dolist (resource resources)
(let ((level (cdr (assoc "level" resource)))) (let ((level (cdr (assoc "level" resource))))
(org-taskjuggler-close-maybe level) (org-taskjuggler-close-maybe level)
(org-taskjuggler-open-resource resource) (org-taskjuggler-open-resource resource)