gnucash stable: [reports] modernisation - use define* for optional arguments

Christopher Lam clam at code.gnucash.org
Sun Jun 25 11:43:12 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/683c7f61 (commit)
	from  https://github.com/Gnucash/gnucash/commit/bba1842e (commit)



commit 683c7f614d73977ad82e5a33928ce521488529ad
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jun 24 22:49:25 2023 +0800

    [reports] modernisation - use define* for optional arguments

diff --git a/gnucash/report/html-document.scm b/gnucash/report/html-document.scm
index e115c9bbc1..a888b005de 100644
--- a/gnucash/report/html-document.scm
+++ b/gnucash/report/html-document.scm
@@ -150,11 +150,9 @@
           ((string? e) (cons e accum))
           (else (cons (object->string e) accum)))))
 
-;; first optional argument is "headers?"
 ;; returns the html document as a string, I think.
-(define (gnc:html-document-render doc . rest)
+(define* (gnc:html-document-render doc #:optional (headers? #t))
   (let ((stylesheet (gnc:html-document-style-sheet doc))
-        (headers? (or (null? rest) (car rest)))
         (style-text (gnc:html-document-style-text doc)))
 
     (if stylesheet
diff --git a/gnucash/report/html-style-sheet.scm b/gnucash/report/html-style-sheet.scm
index a08cad143a..f74df01f61 100644
--- a/gnucash/report/html-style-sheet.scm
+++ b/gnucash/report/html-style-sheet.scm
@@ -205,12 +205,11 @@
 ;;  html-style-sheet-render 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(define (gnc:html-style-sheet-render sheet doc . rest)
+(define* (gnc:html-style-sheet-render sheet doc #:optional headers?)
   ;; render the document (returns an <html-document>)
   (let ((newdoc ((gnc:html-style-sheet-renderer sheet) 
                  (gnc:html-style-sheet-options sheet)
-                 doc))
-        (headers? (and (pair? rest) (car rest))))
+                 doc)))
 
     ;; Copy values over to stylesheet-produced document.  note that this is a
     ;; bug that should probably better be fixed by having the stylesheets



Summary of changes:
 gnucash/report/html-document.scm    | 4 +---
 gnucash/report/html-style-sheet.scm | 5 ++---
 2 files changed, 3 insertions(+), 6 deletions(-)



More information about the gnucash-changes mailing list