mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[core-utils] modify gnc:format to accept -
this allows use of varnames such as ${report-title}
This commit is contained in:
@@ -111,7 +111,7 @@
|
||||
(set-exception-printer! 'unbound-variable print-unbound-variable-error)
|
||||
|
||||
;; format.
|
||||
(define %regex (make-regexp "[$][{]([[:alnum:]]+)[}]"))
|
||||
(define %regex (make-regexp "[$][{]([[:alnum:]\\-]+)[}]"))
|
||||
(define (gnc:format str . bindings)
|
||||
(define hash (make-hash-table))
|
||||
(define (substitute m)
|
||||
|
||||
@@ -30,6 +30,10 @@
|
||||
"basic test"
|
||||
(gnc:format "basic ${job}" 'job "test"))
|
||||
|
||||
(test-equal "one substitution with hyphen"
|
||||
"master chief"
|
||||
(gnc:format "master ${job-title}" 'job-title "chief"))
|
||||
|
||||
(test-equal "two substitutions out of order"
|
||||
"basic test"
|
||||
(gnc:format "${difficulty} ${job}" 'job "test" 'difficulty "basic"))
|
||||
|
||||
Reference in New Issue
Block a user