If a report defines style-text, that text will be added to the report header as css style info.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18196 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Phil Longstaff 2009-07-11 01:21:08 +00:00
parent 9ec94c8581
commit 33224441c8
2 changed files with 18 additions and 2 deletions

View File

@ -21,6 +21,7 @@
;; Boston, MA 02110-1301, USA gnu@gnu.org ;; Boston, MA 02110-1301, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(gnc:module-load "gnucash/html" 0)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; <html-document> class ;; <html-document> class
@ -29,7 +30,7 @@
(define <html-document> (define <html-document>
(make-record-type "<html-document>" (make-record-type "<html-document>"
'(style-sheet style-stack style title headline objects))) '(style-sheet style-stack style style-text title headline objects)))
(define gnc:html-document? (define gnc:html-document?
(record-predicate <html-document>)) (record-predicate <html-document>))
@ -42,6 +43,7 @@
#f ;; the stylesheet #f ;; the stylesheet
'() ;; style stack '() ;; style stack
(gnc:make-html-style-table) ;; document style info (gnc:make-html-style-table) ;; document style info
#f ;; style text
"" ;; document title "" ;; document title
#f ;; headline #f ;; headline
'() ;; subobjects '() ;; subobjects
@ -74,6 +76,12 @@
(define gnc:html-document-style-stack (define gnc:html-document-style-stack
(record-accessor <html-document> 'style-stack)) (record-accessor <html-document> 'style-stack))
(define gnc:html-document-set-style-text!
(record-modifier <html-document> 'style-text))
(define gnc:html-document-style-text
(record-accessor <html-document> 'style-text))
(define gnc:html-document-set-style-internal! (define gnc:html-document-set-style-internal!
(record-modifier <html-document> 'style)) (record-modifier <html-document> 'style))
@ -120,7 +128,9 @@
;; returns the html document as a string, I think. ;; returns the html document as a string, I think.
(define (gnc:html-document-render doc . rest) (define (gnc:html-document-render doc . rest)
(let ((stylesheet (gnc:html-document-style-sheet doc)) (let ((stylesheet (gnc:html-document-style-sheet doc))
(headers? (if (null? rest) #f (if (car rest) #t #f)))) (headers? (if (null? rest) #f (if (car rest) #t #f)))
(style-text (gnc:html-document-style-text doc))
)
(if stylesheet (if stylesheet
;; if there's a style sheet, let it do the rendering ;; if there's a style sheet, let it do the rendering
(gnc:html-style-sheet-render stylesheet doc headers?) (gnc:html-style-sheet-render stylesheet doc headers?)
@ -130,6 +140,7 @@
(push (lambda (l) (set! retval (cons l retval)))) (push (lambda (l) (set! retval (cons l retval))))
(objs (gnc:html-document-objects doc)) (objs (gnc:html-document-objects doc))
(work-to-do (length objs)) (work-to-do (length objs))
(css? (gnc-html-engine-supports-css))
(work-done 0) (work-done 0)
(title (gnc:html-document-title doc))) (title (gnc:html-document-title doc)))
;; compile the doc style ;; compile the doc style
@ -143,6 +154,9 @@
(begin (begin
(push "<html>\n") (push "<html>\n")
(push "<head>\n") (push "<head>\n")
(if css?
(if style-text
(push (list "</style>" style-text "<style type=\"text/css\">\n"))))
(let ((title (gnc:html-document-title doc))) (let ((title (gnc:html-document-title doc)))
(if title (if title
(push (list "</title>" title "<title>\n")))) (push (list "</title>" title "<title>\n"))))

View File

@ -228,6 +228,8 @@
(export gnc:html-document-title) (export gnc:html-document-title)
(export gnc:html-document-set-headline!) (export gnc:html-document-set-headline!)
(export gnc:html-document-headline) (export gnc:html-document-headline)
(export gnc:html-document-set-style-text!)
(export gnc:html-document-style-text)
(export gnc:html-document-set-style-sheet!) (export gnc:html-document-set-style-sheet!)
(export gnc:html-document-style-sheet) (export gnc:html-document-style-sheet)
(export gnc:html-document-set-style-stack!) (export gnc:html-document-set-style-stack!)