-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtemplates.py
More file actions
47 lines (41 loc) · 1.5 KB
/
templates.py
File metadata and controls
47 lines (41 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# SPDX-License-Identifier: MPL-2.0
# Copyright (c) 2026 Den Rozhnovskiy
"""Minimal HTML skeleton template for the report.
CSS and JS are injected via ${css} and ${js} placeholders.
Body content is injected via ${body}.
"""
from __future__ import annotations
from string import Template
FONT_CSS_URL = (
"https://fonts.googleapis.com/css2?"
# Inter Variable — single file, full weight axis (100..900), smoother
# rendering than static cuts. Used for body text AND display (KPI numbers,
# headings). Google Fonts' Inter Tight subset drops the `zero` OT feature,
# so we stick to a single Inter family and apply display weight/tracking
# via CSS instead of a sibling family.
"family=Inter:wght@100..900&"
# JetBrains Mono — code/monospace surfaces.
"family=JetBrains+Mono:wght@400;500&"
"display=swap"
)
REPORT_TEMPLATE = Template(
r"""<!doctype html>
<html lang="en" data-scan-root="${scan_root}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>${title}</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="${font_css_url}" rel="stylesheet">
<style>${css}</style>
</head>
<body>
${body}
<script>${js}</script>
</body>
</html>"""
)