ox-taskjuggler.el: Replace %title in default reports by document title

* ox-taskjuggler.el (org-taskjuggler-default-reports)
(org-taskjuggler-project-plan): If the default reports contain
%title it will be replaced with the document title.

This is based on a suggestion by John Hendy.
This commit is contained in:
Christian Egli 2013-04-26 11:50:13 +02:00
parent 9dfccd3f2b
commit 20fa3dc561
1 changed files with 15 additions and 7 deletions

View File

@ -214,7 +214,7 @@ marked with `org-taskjuggler-project-tag'"
(defcustom org-taskjuggler-default-reports (defcustom org-taskjuggler-default-reports
'("textreport report \"Plan\" { '("textreport report \"Plan\" {
formats html formats html
header '== <-query attribute=\"name\"-> ==' header '== %title =='
center -8<- center -8<-
[#Plan Plan] | [#Resource_Allocation Resource Allocation] [#Plan Plan] | [#Resource_Allocation Resource Allocation]
@ -246,10 +246,11 @@ resourcereport resourceGraph \"\" {
}") }")
"Default reports for the project. "Default reports for the project.
These are sensible default reports to give a good out-of-the-box These are sensible default reports to give a good out-of-the-box
result when exporting without defining any reports. If you want result when exporting without defining any reports. \"%title\"
to define your own reports you can change them here or simply anywhere in the reports will be replaced with the document title.
define the default reports so that they include an external If you want to define your own reports you can change them here
report definition as follows: or simply define the default reports so that they include an
external report definition as follows:
include reports.tji include reports.tji
@ -692,8 +693,15 @@ Return complete project plan as a string in TaskJuggler syntax."
(mapconcat (mapconcat
(lambda (report) (org-taskjuggler--build-report report info)) (lambda (report) (org-taskjuggler--build-report report info))
main-reports "") main-reports "")
(mapconcat 'org-element-normalize-string ;; insert title in default reports
org-taskjuggler-default-reports "")))))))) (let ((title (org-export-data (plist-get info :title) info)))
(mapconcat
'org-element-normalize-string
(mapcar
(function
(lambda (report)
(replace-regexp-in-string "%title" title report t t)))
org-taskjuggler-default-reports) "")))))))))
(defun org-taskjuggler--build-project (project info) (defun org-taskjuggler--build-project (project info)
"Return a project declaration. "Return a project declaration.