From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kosyrev Serge <_deepfire@feelingofgreen.ru> Subject: [PATCH 3/8] ox-taskjuggler.el: :POST-INCLUDES lists files to include post-section Date: Sun, 8 Nov 2015 13:16:45 +0300 Message-ID: <87pozilrpj.fsf@feelingofgreen.ru> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56470) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <_deepfire@feelingofgreen.ru>) id 1Zvv9Z-0008MQ-2r for emacs-orgmode@gnu.org; Mon, 09 Nov 2015 17:43:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <_deepfire@feelingofgreen.ru>) id 1Zvv9V-0006I1-Rc for emacs-orgmode@gnu.org; Mon, 09 Nov 2015 17:43:08 -0500 Received: from [80.92.100.69] (port=45593 helo=mail.feelingofgreen.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <_deepfire@feelingofgreen.ru>) id 1Zvv9V-0006HZ-Ek for emacs-orgmode@gnu.org; Mon, 09 Nov 2015 17:43:05 -0500 Received: from andromedae (andromedae.feelingofgreen.ru [10.128.0.213]) by mail.feelingofgreen.ru (Postfix) with ESMTPA id 7800132764588 for ; Tue, 10 Nov 2015 02:06:11 +0300 (MSK) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org * 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