emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kosyrev Serge <_deepfire@feelingofgreen.ru>
To: emacs-orgmode@gnu.org
Subject: [PATCH 3/8] ox-taskjuggler.el: :POST-INCLUDES lists files to include post-section
Date: Sun, 8 Nov 2015 13:16:45 +0300	[thread overview]
Message-ID: <87pozilrpj.fsf@feelingofgreen.ru> (raw)

* 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

                 reply	other threads:[~2015-11-09 22:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pozilrpj.fsf@feelingofgreen.ru \
    --to=_deepfire@feelingofgreen.ru \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).