Browse Source

ox-taskjuggler.el: Handle the case of an empty document title

* ox-taskjuggler.el (org-taskjuggler-project-plan): Use the
project name as the title of the (default) report if the
document title is empty.

Thanks to Eric S Fraga for reporting this bug.
Christian Egli 4 years ago
parent
commit
40635b2b4c
1 changed files with 5 additions and 2 deletions
  1. 5 2
      contrib/lisp/ox-taskjuggler.el

+ 5 - 2
contrib/lisp/ox-taskjuggler.el

@@ -695,13 +695,16 @@ Return complete project plan as a string in TaskJuggler syntax."
                (lambda (report) (org-taskjuggler--build-report report info))
                main-reports "")
 	    ;; insert title in default reports
-	    (let ((title (org-export-data (plist-get info :title) info)))
+	    (let* ((title (org-export-data (plist-get info :title) info))
+		   (report-title (if (string= title "")
+				     (org-taskjuggler-get-name project)
+				   title)))
 	      (mapconcat
 	       'org-element-normalize-string
 	       (mapcar
 		(function
 		 (lambda (report)
-		   (replace-regexp-in-string "%title" title report t t)))
+		   (replace-regexp-in-string "%title" report-title  report t t)))
 		org-taskjuggler-default-reports) "")))))))))
 
 (defun org-taskjuggler--build-project (project info)