mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[html-style-sheet] compact function using ice-9 match
This commit is contained in:
parent
5614cbbe42
commit
5688204118
@ -21,6 +21,7 @@
|
||||
;; Boston, MA 02110-1301, USA gnu@gnu.org
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(use-modules (ice-9 match))
|
||||
(use-modules (gnucash gettext))
|
||||
|
||||
(define *gnc:_style-sheet-templates_* (make-hash-table 23))
|
||||
@ -67,23 +68,15 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define (gnc:define-html-style-sheet . args)
|
||||
(let ((ss
|
||||
((record-constructor <html-style-sheet-template>) #f #f #f #f)))
|
||||
(let loop ((left args))
|
||||
(if (and (list? left)
|
||||
(not (null? left))
|
||||
(not (null? (cdr left))))
|
||||
(let* ((field (car left))
|
||||
(value (cadr left))
|
||||
(mod (record-modifier <html-style-sheet-template> field)))
|
||||
(mod ss value)
|
||||
(loop (cddr left)))))
|
||||
|
||||
;; store the style sheet template
|
||||
(hash-set! *gnc:_style-sheet-templates_*
|
||||
(gnc:html-style-sheet-template-name ss)
|
||||
ss)))
|
||||
|
||||
(let loop ((args args)
|
||||
(ss ((record-constructor <html-style-sheet-template>) #f #f #f #f)))
|
||||
(match args
|
||||
((field value . rest)
|
||||
((record-modifier <html-style-sheet-template> field) ss value)
|
||||
(loop rest ss))
|
||||
(else ;; store the style sheet template
|
||||
(hash-set! *gnc:_style-sheet-templates_*
|
||||
(gnc:html-style-sheet-template-name ss) ss)))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; <html-style-sheet> methods
|
||||
|
Loading…
Reference in New Issue
Block a user