[html-document] if headers? is #f, do not add <body> tag

This is a step towards creating valid html in multiple-charts reports.
This commit is contained in:
Christopher Lam 2019-02-12 09:01:40 +08:00
parent 25f2abb011
commit b334366f63
2 changed files with 21 additions and 24 deletions

View File

@ -146,8 +146,7 @@
;; push it ;; push it
(gnc:html-document-push-style doc (gnc:html-document-style doc)) (gnc:html-document-push-style doc (gnc:html-document-style doc))
(gnc:report-render-starting (gnc:html-document-title doc)) (gnc:report-render-starting (gnc:html-document-title doc))
(if headers? (when headers?
(begin
;;This is the only place where <html> appears ;;This is the only place where <html> appears
;;with the exception of 2 reports: ;;with the exception of 2 reports:
;;./share/gnucash/scm/gnucash/report/taxinvoice.eguile.scm:<html> ;;./share/gnucash/scm/gnucash/report/taxinvoice.eguile.scm:<html>
@ -160,11 +159,11 @@
(push (list "</style>" style-text "<style type=\"text/css\">\n"))) (push (list "</style>" style-text "<style type=\"text/css\">\n")))
(if (not (string-null? title)) (if (not (string-null? title))
(push (list "</title>" title "<title>\n"))) (push (list "</title>" title "<title>\n")))
(push "</head>"))) (push "</head>")
;; this lovely little number just makes sure that <body> ;; this lovely little number just makes sure that <body>
;; attributes like bgcolor get included ;; attributes like bgcolor get included
(push ((gnc:html-markup/open-tag-only "body") doc)) (push ((gnc:html-markup/open-tag-only "body") doc)))
;; now render the children ;; now render the children
(for-each (for-each
@ -174,9 +173,8 @@
(gnc:report-percent-done (* 100 (/ work-done work-to-do)))) (gnc:report-percent-done (* 100 (/ work-done work-to-do))))
objs) objs)
(when headers?
(push "</body>\n") (push "</body>\n")
(if headers?
(push "</html>\n")) (push "</html>\n"))
(gnc:report-finished) (gnc:report-finished)

View File

@ -26,8 +26,7 @@
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n\ <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n\
</head><body>") </head><body>")
(define html-doc-no-header-empty-body (define html-doc-no-header-empty-body "")
"<body></body>\n")
(define html-doc-tail (define html-doc-tail
"</body>\n\ "</body>\n\