[html-text] use srfi-9 records for <html-text>

This commit is contained in:
Christopher Lam 2020-07-12 11:35:27 +08:00
parent f9b3b105db
commit 353cdd45cf

View File

@ -21,6 +21,7 @@
;; Boston, MA 02110-1301, USA gnu@gnu.org ;; Boston, MA 02110-1301, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-modules (srfi srfi-9))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; <html-text> class ;; <html-text> class
@ -30,35 +31,25 @@
;; doc as arg to get the string out. ;; doc as arg to get the string out.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define <html-text> (define-record-type <html-text>
(make-record-type "<html-text>" (make-html-text body style)
'(body style))) html-text?
(define gnc:html-text? (body html-text-body html-text-set-body!)
(record-predicate <html-text>)) (style html-text-style html-text-set-style!))
(define gnc:make-html-text-internal (define gnc:html-text? html-text?)
(record-constructor <html-text>)) (define gnc:make-html-text-internal make-html-text)
(define gnc:html-text-body html-text-body)
(define gnc:html-text-set-body-internal! html-text-set-body!)
(define gnc:html-text-style html-text-style)
(define gnc:html-text-set-style-internal! html-text-set-style!)
(define (gnc:make-html-text . body) (define (gnc:make-html-text . body)
(gnc:make-html-text-internal (gnc:make-html-text-internal body (gnc:make-html-style-table)))
body
(gnc:make-html-style-table)))
(define gnc:html-text-body
(record-accessor <html-text> 'body))
(define gnc:html-text-set-body-internal!
(record-modifier <html-text> 'body))
(define (gnc:html-text-set-body! txt . rest) (define (gnc:html-text-set-body! txt . rest)
(gnc:html-text-set-body-internal! txt rest)) (gnc:html-text-set-body-internal! txt rest))
(define gnc:html-text-style
(record-accessor <html-text> 'style))
(define gnc:html-text-set-style-internal!
(record-modifier <html-text> 'style))
(define (gnc:html-text-set-style! text tag . rest) (define (gnc:html-text-set-style! text tag . rest)
(let ((newstyle (if (and (= (length rest) 2) (procedure? (car rest))) (let ((newstyle (if (and (= (length rest) 2) (procedure? (car rest)))
(apply gnc:make-html-data-style-info rest) (apply gnc:make-html-data-style-info rest)