From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: [PATCH] org-taskjuggler.el - add valid project attributes Date: Wed, 25 Jun 2014 17:26:32 +0200 Message-ID: <87ha3980yf.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wzp67-0004jB-S4 for emacs-orgmode@gnu.org; Wed, 25 Jun 2014 11:27:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wzp60-0006K1-PZ for emacs-orgmode@gnu.org; Wed, 25 Jun 2014 11:26:55 -0400 Received: from plane.gmane.org ([80.91.229.3]:55451) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wzp60-0006IK-GU for emacs-orgmode@gnu.org; Wed, 25 Jun 2014 11:26:48 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Wzp5w-0007g5-Pi for emacs-orgmode@gnu.org; Wed, 25 Jun 2014 17:26:44 +0200 Received: from g231234191.adsl.alicedsl.de ([92.231.234.191]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 25 Jun 2014 17:26:44 +0200 Received: from tj by g231234191.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 25 Jun 2014 17:26:44 +0200 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 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Taskjuggler-Add-valid-project-attributes.patch Content-Description: Taskjuggler Patch >From bc21dacd0bb400c5bb92acff9bbf2d00560f1c92 Mon Sep 17 00:00:00 2001 From: tj Date: Wed, 25 Jun 2014 16:27:42 +0200 Subject: [PATCH] Taskjuggler: Add valid project attributes * ox-taskjuggler.el (org-taskjuggler--build-project): Insert all valid attributes from project. * ox-taskjuggler.el (org-taskjuggler--build-attributes): Add project as possible ITEM to docstring. * ox-taskjuggler.el (org-taskjuggler-valid-project-attributes): New defcustom. As reported by Nick Garber, project attributes like 'timingresolution' could not be changed via Org-mode properties. This patch makes the exporter treat project-attributes just like it treats task-, resource- and report-attributes. --- contrib/lisp/ox-taskjuggler.el | 52 ++++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/contrib/lisp/ox-taskjuggler.el b/contrib/lisp/ox-taskjuggler.el index 761e180..b3a691a 100644 --- a/contrib/lisp/ox-taskjuggler.el +++ b/contrib/lisp/ox-taskjuggler.el @@ -310,6 +310,19 @@ If one of these appears as a property for a headline, it will be exported with the corresponding task." :group 'org-export-taskjuggler) +(defcustom org-taskjuggler-valid-project-attributes + '(timingresolution timezone alertlevels currency currencyformat + dailyworkinghours extend includejournalentry now numberformat + outputdir scenario shorttimeformat timeformat trackingscenario + weekstartsmonday weekstartssunday workinghours + yearlyworkingdays) + "Valid attributes for Taskjuggler project. +If one of these appears as a property for a headline that is a +project definition, it will be exported with the corresponding +task. Attribute 'timingresolution' should be the first in the +list." + :group 'org-export-taskjuggler) + (defcustom org-taskjuggler-valid-resource-attributes '(limits vacation shift booking efficiency journalentry rate workinghours flags) @@ -483,9 +496,9 @@ Return new string. If S is the empty string, return it." (if (equal "" s) s (replace-regexp-in-string "^ *\\S-" " \\&" s))) (defun org-taskjuggler--build-attributes (item attributes) - "Return attributes string for task, resource or report ITEM. -ITEM is a headline. ATTRIBUTES is a list of symbols -representing valid attributes for ITEM." + "Return attributes string for ITEM. +ITEM is a project, task, resource or report headline. ATTRIBUTES +is a list of symbols representing valid attributes for ITEM." (mapconcat (lambda (attribute) (let ((value (org-element-property @@ -715,18 +728,27 @@ PROJECT is a headline. INFO is a plist used as a communication channel. If no start date is specified, start today. If no end date is specified, end `org-taskjuggler-default-project-duration' days from now." - (format "project %s \"%s\" \"%s\" %s %s {\n}\n" - (org-taskjuggler-get-id project info) - (org-taskjuggler-get-name project) - ;; Version is obtained through :TASKJUGGLER_VERSION: - ;; property or `org-taskjuggler-default-project-version'. - (or (org-element-property :VERSION project) - org-taskjuggler-default-project-version) - (or (org-taskjuggler-get-start project) - (format-time-string "%Y-%m-%d")) - (let ((end (org-taskjuggler-get-end project))) - (or (and end (format "- %s" end)) - (format "+%sd" org-taskjuggler-default-project-duration))))) + (concat + ;; Opening project. + (format "project %s \"%s\" \"%s\" %s %s {\n" + (org-taskjuggler-get-id project info) + (org-taskjuggler-get-name project) + ;; Version is obtained through :TASKJUGGLER_VERSION: + ;; property or `org-taskjuggler-default-project-version'. + (or (org-element-property :VERSION project) + org-taskjuggler-default-project-version) + (or (org-taskjuggler-get-start project) + (format-time-string "%Y-%m-%d")) + (let ((end (org-taskjuggler-get-end project))) + (or (and end (format "- %s" end)) + (format "+%sd" + org-taskjuggler-default-project-duration)))) + ;; Add attributes. + (org-taskjuggler--indent-string + (org-taskjuggler--build-attributes + project org-taskjuggler-valid-project-attributes)) + ;; Closing project. + "}\n")) (defun org-taskjuggler--build-resource (resource info) "Return a resource declaration. -- 2.0.0 --=-=-= Content-Type: text/plain -- cheers, Thorsten --=-=-=--