[report-utilities] can strify records

srfi-9 records can contain complex objects eg lists/vectors also
gnc:monetary or gnc:html-table objects. previously gnc:strify would
use the default printer; this commit modifies so that they are
prettified.

example output; a :col-datum record from balsheet-pnl. the record's
split-balance contains a $0 monetary object.

Rec::col-datum{last-split=#f, split-balance=[$0.00]}

this last pretty-printer must be the last one before object->string,
because we want previous printers which may be records too
eg. monetary->str etc to use their own printer.
This commit is contained in:
Christopher Lam
2019-11-25 22:52:36 +08:00
parent 0973d54d6c
commit 119fdc368b

View File

@@ -1284,6 +1284,13 @@ flawed. see report-utilities.scm. please update reports.")
(try owner->str)
(try invoice->str)
(try lot->str)
(and (record? d)
(let ((rtd (record-type-descriptor d)))
(define (fld->str fld)
(format #f "~a=~a" fld (gnc:strify ((record-accessor rtd fld) d))))
(format #f "Rec:~a{~a}"
(record-type-name rtd)
(string-join (map fld->str (record-type-fields rtd)) ", "))))
(object->string d)))
(define (pair->num pair)