emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH 3/8] ox-taskjuggler.el: :POST-INCLUDES lists files to include post-section
@ 2015-11-08 10:16 Kosyrev Serge
  0 siblings, 0 replies; only message in thread
From: Kosyrev Serge @ 2015-11-08 10:16 UTC (permalink / raw)
  To: emacs-orgmode

* 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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-11-09 22:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-08 10:16 [PATCH 3/8] ox-taskjuggler.el: :POST-INCLUDES lists files to include post-section Kosyrev Serge

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).