[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] [PATCH 3/8] ox-taskjuggler.el: :POST-INCLUDES lists files to include
From: |
Kosyrev Serge |
Subject: |
[O] [PATCH 3/8] ox-taskjuggler.el: :POST-INCLUDES lists files to include post-section |
Date: |
Sun, 8 Nov 2015 13:16:45 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
* ox-taskjuggler.el (org-taskjuggler-project-plan): allow for include
directives to be inserted after resource and task sections.
---
contrib/lisp/ox-taskjuggler.el | 48 ++++++++++++++++++++++++++++++------------
1 file changed, 34 insertions(+), 14 deletions(-)
diff --git a/contrib/lisp/ox-taskjuggler.el b/contrib/lisp/ox-taskjuggler.el
index 2cf2c78..427fb6e 100644
--- a/contrib/lisp/ox-taskjuggler.el
+++ b/contrib/lisp/ox-taskjuggler.el
@@ -665,19 +665,35 @@ Return complete project plan as a string in TaskJuggler
syntax."
main-resources info)))
(concat
(if main-resources
- (mapconcat
- (lambda (resource) (org-taskjuggler--build-resource resource
info))
- main-resources "")
+ (concat
+ (mapconcat
+ (lambda (resource) (org-taskjuggler--build-resource resource
info))
+ main-resources "")
+ ;; Allow resource-tagged node have a 'post-includes' property,
+ ;; that will instruct the exporter to insert an include directive
+ ;; after all the resource sections.
+ (let ((post-includes (apply 'concat
+ (org-taskjuggler-map-special-nodes
+ org-taskjuggler-resource-tag tree
+ (lambda (hl) (org-element-property
:POST-INCLUDES hl))))))
+ (when post-includes
+ (apply 'concat (mapcar (lambda (inc) (format "include '%s'\n"
inc))
+ (org-split-string post-includes))))))
(format "resource %s \"%s\" {\n}\n" (user-login-name)
user-full-name))
;; 5. Insert tasks.
- (let ((main-tasks
- ;; If `org-taskjuggler-keep-project-as-task' is
- ;; non-nil, there is only one task. Otherwise, every
- ;; direct children of PROJECT is a top level task.
- (if org-taskjuggler-keep-project-as-task (list project)
- (or (org-element-map (org-element-contents project) 'headline
- 'identity info nil 'headline)
- (error "No task specified")))))
+ (let* ((main-tasks
+ ;; If `org-taskjuggler-keep-project-as-task' is
+ ;; non-nil, there is only one task. Otherwise, every
+ ;; direct children of PROJECT is a top level task.
+ (if org-taskjuggler-keep-project-as-task (list project)
+ (or (org-element-map (org-element-contents project)
'headline
+ 'identity info nil 'headline)
+ (error "No task specified"))))
+ ;; Allow task-tagged node have a 'post-includes' property,
+ ;; that will instruct the exporter to insert an include directive
+ ;; after all the task sections.
+ (post-includes (mapconcat (lambda (hl) (org-element-property
:POST-INCLUDES hl))
+ main-tasks " ")))
;; Assign a unique ID to each task. Add it to
;; `:taskjuggler-unique-ids' property in INFO.
(setq info
@@ -694,9 +710,13 @@ Return complete project plan as a string in TaskJuggler
syntax."
(car main-tasks) :ALLOCATE
(or (org-taskjuggler-get-id (car main-resources) info)
(user-login-name))))
- (mapconcat
- (lambda (task) (org-taskjuggler--build-task task info))
- main-tasks ""))
+ (concat
+ (mapconcat
+ (lambda (task) (org-taskjuggler--build-task task info))
+ main-tasks "")
+ (when post-includes
+ (apply 'concat (mapcar (lambda (inc) (format "include '%s'\n" inc))
+ (org-split-string post-includes))))))
;; 6. Insert reports. If no report is defined, insert default
;; reports.
(let ((main-reports
--
2.5.0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [O] [PATCH 3/8] ox-taskjuggler.el: :POST-INCLUDES lists files to include post-section,
Kosyrev Serge <=