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

View File

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