Head section

merge-requests/8/head
Bob Mottram 2020-07-12 19:53:58 +01:00
parent b0bb73c5be
commit 950bda0039
1 changed files with 5 additions and 3 deletions

View File

@ -2255,12 +2255,14 @@ def getFontFromCss(css: str) -> (str, str):
def htmlHeader(cssFilename: str, css: str, lang='en') -> str:
htmlStr = '<!DOCTYPE html>\n'
htmlStr += '<html lang="' + lang + '">\n'
htmlStr += ' <meta charset="utf-8">\n'
htmlStr += ' <head>\n'
htmlStr += ' <meta charset="utf-8">\n'
fontName, fontFormat = getFontFromCss(css)
if fontName:
htmlStr += ' <link rel="preload" as="font" type="' + \
htmlStr += ' <link rel="preload" as="font" type="' + \
fontFormat + '" href="' + fontName + '" crossorigin>\n'
htmlStr += ' <style>\n' + css + '</style>\n'
htmlStr += ' <style>\n' + css + '</style>\n'
htmlStr += ' </head>\n'
htmlStr += ' <body>\n'
return htmlStr