Toggle navigation
Toggle navigation
This project
Loading...
Sign in
万朱浩
/
Venue-Ops
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
马一丁
2025-11-17 17:40:22 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f6714a35e07d608ab486d12e81d9d5658e4d64b6
f6714a35
1 parent
a5f3964a
Fix 'fonts' Fype Matching Issues
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
4 deletions
ReportEngine/renderers/html_renderer.py
ReportEngine/renderers/html_renderer.py
View file @
f6714a3
...
...
@@ -1602,10 +1602,28 @@ class HTMLRenderer:
def
_build_css
(
self
,
tokens
:
Dict
[
str
,
Any
])
->
str
:
"""根据主题token拼接整页CSS,包括响应式与打印样式"""
colors
=
tokens
.
get
(
"colors"
)
or
{}
typography
=
tokens
.
get
(
"typography"
)
or
{}
fonts
=
tokens
.
get
(
"fonts"
)
or
typography
.
get
(
"fontFamily"
)
or
{}
spacing
=
tokens
.
get
(
"spacing"
)
or
{}
# 安全获取各个配置项,确保都是字典类型
colors_raw
=
tokens
.
get
(
"colors"
)
colors
=
colors_raw
if
isinstance
(
colors_raw
,
dict
)
else
{}
typography_raw
=
tokens
.
get
(
"typography"
)
typography
=
typography_raw
if
isinstance
(
typography_raw
,
dict
)
else
{}
# 安全获取fonts,确保是字典类型
fonts_raw
=
tokens
.
get
(
"fonts"
)
or
typography
.
get
(
"fonts"
)
if
isinstance
(
fonts_raw
,
dict
):
fonts
=
fonts_raw
else
:
# 如果fonts是字符串或None,构造一个字典
font_family
=
typography
.
get
(
"fontFamily"
)
if
isinstance
(
font_family
,
str
):
fonts
=
{
"body"
:
font_family
,
"heading"
:
font_family
}
else
:
fonts
=
{}
spacing_raw
=
tokens
.
get
(
"spacing"
)
spacing
=
spacing_raw
if
isinstance
(
spacing_raw
,
dict
)
else
{}
primary_palette
=
self
.
_resolve_color_family
(
colors
.
get
(
"primary"
),
{
"main"
:
"#1a365d"
,
"light"
:
"#2d3748"
,
"dark"
:
"#0f1a2d"
},
...
...
Please
register
or
login
to post a comment