feat: support PostScript names for fonts

This commit is contained in:
Erzbir
2026-08-22 14:22:35 +08:00
parent 922dc6ced6
commit fbc44b42fe
7 changed files with 272 additions and 225 deletions
+2 -2
View File
@@ -28,8 +28,8 @@
<li class="post-list" th:each="post : ${month.posts}">
<div class="post-meta">
<time class="post-time"
th:text="${#dates.format(post.spec.publishTime, '__${theme.config.style.time_style == 'custom' ?
theme.config.style.custom_time_style : theme.config.style.time_style}__')}">
th:text="${#dates.format(post.spec.publishTime, '__${theme.config.general.time_style == 'custom' ?
theme.config.general.custom_time_style : theme.config.general.time_style}__')}">
Publish
Time
</time>
+2 -2
View File
@@ -31,8 +31,8 @@
</h2>
<div class="post-meta">
<time class="post-date"
th:text="${#dates.format(post.spec.publishTime, '__${theme.config.style.time_style == 'custom' ?
theme.config.style.custom_time_style : theme.config.style.time_style}__')}">Publish Time</time>
th:text="${#dates.format(post.spec.publishTime, '__${theme.config.general.time_style == 'custom' ?
theme.config.general.custom_time_style : theme.config.general.time_style}__')}">Publish Time</time>
<span class="post-author"
th:with="contributor = ${post.contributors[0]}"
th:text="${contributor.displayName}">Author</span><th:block th:replace="~{modules/tag-list(post = ${post}, show = ${theme.config.index_page.show_tags})}"/>
+38 -38
View File
@@ -10,79 +10,79 @@
<th:block th:replace="~{modules/theme-preferences :: theme-preferences}"/>
<link data-no-pjax rel="stylesheet" th:href="@{/assets/dist/main.css?v={version}(version=${theme.spec.version})}"/>
<script data-no-pjax type="module" th:src="@{/assets/dist/main.js?v={version}(version=${theme.spec.version})}"></script>
<script data-no-pjax type="module" th:if="${theme.config.basic.pjax_enable}"
<script data-no-pjax type="module" th:if="${theme.config.general.pjax_enable}"
th:src="@{/assets/dist/libs/pjax.js?v={version}(version=${theme.spec.version})}"></script>
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.style.media_max_width)}" th:inline="css">
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.layout.media_max_width)}" th:inline="css">
:root {
--width-theme-media-max: [(${theme.config.style.media_max_width})];
--width-theme-media-max: [(${theme.config.layout.media_max_width})];
}
</style>
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.style.font_size)}" th:inline="css">
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.typography.font_size)}" th:inline="css">
:root {
--size-theme-font: [(${theme.config.style.font_size})];
--size-theme-font: [(${theme.config.typography.font_size})];
}
</style>
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.style.line_height)}" th:inline="css">
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.typography.line_height)}" th:inline="css">
:root {
--height-theme-line: [(${theme.config.style.line_height})];
--height-theme-line: [(${theme.config.typography.line_height})];
}
</style>
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.style.post_paragraph_spacing)}" th:inline="css">
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.typography.post_paragraph_spacing)}" th:inline="css">
:root {
--spacing-theme-post-paragraph: [(${theme.config.style.post_paragraph_spacing})];
--spacing-theme-post-paragraph: [(${theme.config.typography.post_paragraph_spacing})];
}
</style>
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.style.post_meta_divider)}" th:inline="css">
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.global_style.post_meta_divider)}" th:inline="css">
:root {
--content-theme-post-meta-divider: "[(${theme.config.style.post_meta_divider})]";
--content-theme-post-meta-divider: "[(${theme.config.global_style.post_meta_divider})]";
}
</style>
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.style.content_padding)}" th:inline="css">
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.layout.content_padding)}" th:inline="css">
:root {
--spacing-theme-container-padding: [(${theme.config.style.content_padding})];
--spacing-theme-container-padding-mobile: [(${theme.config.style.content_padding})];
--spacing-theme-container-padding: [(${theme.config.layout.content_padding})];
--spacing-theme-container-padding-mobile: [(${theme.config.layout.content_padding})];
}
</style>
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.style.list_style)}" th:inline="css">
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.global_style.list_style)}" th:inline="css">
:root {
--list-theme-style: [(${theme.config.style.list_style})];
--list-theme-style: [(${theme.config.global_style.list_style})];
}
</style>
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.style.border_width)}" th:inline="css">
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.global_style.border_width)}" th:inline="css">
:root {
--width-theme-border: [(${theme.config.style.border_width})];
--width-theme-border: [(${theme.config.global_style.border_width})];
}
</style>
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.style.border_style)}" th:inline="css">
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.global_style.border_style)}" th:inline="css">
:root {
--style-theme-border: [(${theme.config.style.border_style})];
--style-theme-border: [(${theme.config.global_style.border_style})];
}
</style>
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.style.table_border_width)}" th:inline="css">
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.global_style.table_border_width)}" th:inline="css">
:root {
--width-theme-table-border: [(${theme.config.style.table_border_width})];
--width-theme-table-border: [(${theme.config.global_style.table_border_width})];
}
</style>
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.style.table_border_style)}" th:inline="css">
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.global_style.table_border_style)}" th:inline="css">
:root {
--style-theme-table-border: [(${theme.config.style.table_border_style})];
--style-theme-table-border: [(${theme.config.global_style.table_border_style})];
}
</style>
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.style.title_divider_style)}" th:inline="css">
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.global_style.title_divider_style)}" th:inline="css">
:root {
--style-theme-title-divider: [(${theme.config.style.title_divider_style})];
--style-theme-title-divider: [(${theme.config.global_style.title_divider_style})];
}
</style>
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.style.default_font)}" th:inline="css">
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.typography.default_font)}" th:inline="css">
:root {
--family-theme-font: [(${theme.config.style.default_font})];
--family-theme-font: [(${theme.config.typography.default_font})];
}
</style>
<script data-no-pjax>
window.TerminalTheme?.applyCustomCss?.();
</script>
<style th:inline="css">
[# th:each="scheme : ${theme.config.style.custom_color_schemes}"]
[# th:each="scheme : ${theme.config.color_scheme.custom_color_schemes}"]
html[data-theme-color-scheme="[(${scheme.id})]"] {
--color-theme-background: [(${scheme.background})];
--color-theme-text: [(${#strings.isEmpty(scheme.text) ? scheme.foreground : scheme.text})];
@@ -151,12 +151,12 @@
[/]
</style>
<th:block
th:if="${theme.config?.style?.custom_font_enable
and theme.config?.style?.custom_fonts != null
and not #lists.isEmpty(theme.config.style.custom_fonts)}">
th:if="${theme.config?.typography?.custom_font_enable
and theme.config?.typography?.custom_fonts != null
and not #lists.isEmpty(theme.config.typography.custom_fonts)}">
<!-- Preload primary font -->
<th:block th:with="font=${theme.config.style.custom_fonts[0]}">
<th:block th:with="font=${theme.config.typography.custom_fonts[0]}">
<link th:href="${font.file}"
as="font"
th:type="${font.format == 'woff2' ? 'font/woff2' :
@@ -168,7 +168,7 @@
<!--/*/
<style th:inline="css">
[# th:each="font : ${theme.config.style.custom_fonts}"]
[# th:each="font : ${theme.config.typography.custom_fonts}"]
@font-face {
font-display: swap;
font-family: "[(${font.family_name})]";
@@ -206,7 +206,7 @@
:root {
--family-theme-font:
[# th:each="font, stat : ${theme.config.style.custom_fonts}"]
[# th:each="font, stat : ${theme.config.typography.custom_fonts}"]
"[(${font.family_name})]"[# th:if="${!stat.last}"],[/]
[/];
}
@@ -218,11 +218,11 @@
</th:block>
</head>
<body th:attr="data-layout-mode=${theme.config.style.fullscreen_layout ? 'fullscreen' : 'normal'},
data-table-full-width=${theme.config.style.table_full_width ? 'true' : 'false'}">
<body th:attr="data-layout-mode=${theme.config.layout.fullscreen_layout ? 'fullscreen' : 'normal'},
data-table-full-width=${theme.config.layout.table_full_width ? 'true' : 'false'}">
<div class="wrapper">
<div class="container"
th:attr="style=${theme.config.style.fullscreen_layout or #strings.isEmpty(theme.config.style.max_width) ? null : 'max-width:' + theme.config.style.max_width}">
th:attr="style=${theme.config.layout.fullscreen_layout or #strings.isEmpty(theme.config.layout.max_width) ? null : 'max-width:' + theme.config.layout.max_width}">
<header class="header">
<th:block th:replace="~{modules/header :: header}"/>
</header>
+5 -5
View File
@@ -3,7 +3,7 @@
<div class="header-logo">
<a data-pjax th:href="@{/}">
<div class="logo"
th:text="${#strings.isEmpty(theme.config.basic.logo) ? site.title : theme.config.basic.logo}">
th:text="${#strings.isEmpty(theme.config.header.logo) ? site.title : theme.config.header.logo}">
Blog Title
</div>
</a>
@@ -13,7 +13,7 @@
th:attr="aria-label=#{header.search.open}"
type="button"
data-header-action="open-search"
th:if="${theme.config.style.search_button_enable != false and pluginFinder.available('PluginSearchWidget')}">
th:if="${theme.config.header.search_button_enable != false and pluginFinder.available('PluginSearchWidget')}">
<svg class="icon-regular button-icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path
fill="currentColor"
@@ -28,7 +28,7 @@
<div
id="color-scheme-picker"
class="color-scheme-picker"
th:if="${theme.config.style.color_scheme_switcher_enable != false}">
th:if="${theme.config.header.color_scheme_switcher_enable != false}">
<button
id="color-scheme-trigger"
class="color-scheme-trigger"
@@ -64,7 +64,7 @@
<button
id="appearance-toggle"
th:attr="aria-label=#{header.appearance.current}"
th:if="${theme.config.style.appearance_switcher_enable != false}"
th:if="${theme.config.header.appearance_switcher_enable != false}"
type="button">
<svg class="appearance-icon icon-regular button-icon" data-appearance-mode="light" aria-hidden="true"
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
@@ -99,7 +99,7 @@
<button
id="pixel-toggle"
th:attr="aria-label=#{header.pixel_style.toggle}"
th:if="${theme.config.style.pixel_style_switcher_enable != false}"
th:if="${theme.config.header.pixel_style_switcher_enable != false}"
type="button">
<svg class="icon-pixel button-icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path fill="currentColor"
+8 -8
View File
@@ -1,15 +1,15 @@
<th:block th:fragment="theme-preferences">
<script data-no-pjax th:inline="javascript">
window.TerminalThemeConfig = {
darkTheme: /*[[${theme.config.style.dark_color_scheme}]]*/ "dark",
lightTheme: /*[[${theme.config.style.light_color_scheme}]]*/ "light",
customDarkTheme: /*[[${theme.config.style.custom_dark_scheme}]]*/ "",
customLightTheme: /*[[${theme.config.style.custom_light_scheme}]]*/ "",
defaultMode: /*[[${theme.config.style.default_scheme_mode}]]*/ "system",
preferTTL: /*[[${theme.config.style.prefer_ttl ?: 24}]]*/ 24,
pixelStyle: /*[[${theme.config.style.pixel_style}]]*/ false,
darkTheme: /*[[${theme.config.color_scheme.dark_color_scheme}]]*/ "dark",
lightTheme: /*[[${theme.config.color_scheme.light_color_scheme}]]*/ "light",
customDarkTheme: /*[[${theme.config.color_scheme.custom_dark_scheme}]]*/ "",
customLightTheme: /*[[${theme.config.color_scheme.custom_light_scheme}]]*/ "",
defaultMode: /*[[${theme.config.color_scheme.default_scheme_mode}]]*/ "system",
preferTTL: /*[[${theme.config.general.prefer_ttl ?: 24}]]*/ 24,
pixelStyle: /*[[${theme.config.global_style.pixel_style}]]*/ false,
pixelCssHref: /*[[@{/assets/dist/pixel.css?v={version}(version=${theme.spec.version})}]]*/ "",
customCss: /*[[${theme.config.style.custom}]]*/ "",
customCss: /*[[${theme.config.advanced.custom}]]*/ "",
messages: {
currentColorScheme: /*[[#{header.color_scheme.current}]]*/ "Current color scheme",
currentAppearance: /*[[#{header.appearance.current}]]*/ "Current appearance",
+3 -3
View File
@@ -12,8 +12,8 @@
<h1 class="post-title" th:text="${post.spec.title}">Post Title</h1>
<div class="post-meta">
<time class="post-time"
th:text="${#dates.format(post.spec.publishTime, '__${theme.config.style.time_style == 'custom' ?
theme.config.style.custom_time_style : theme.config.style.time_style}__')}">Publish Time
th:text="${#dates.format(post.spec.publishTime, '__${theme.config.general.time_style == 'custom' ?
theme.config.general.custom_time_style : theme.config.general.time_style}__')}">Publish Time
</time>
<span class="post-author" th:text="${post.owner.displayName}">Author</span><th:block th:replace="~{modules/tag-list(post = ${post}, show = ${theme.config.post_page.show_tags})}"/>
</div>
@@ -24,7 +24,7 @@
</article>
<nav id="toc" th:if="${theme.config.post_page.show_toc}" class="toc"
th:with="tocDefaultOpen=${theme.config.post_page.toc_default_open ?: 'auto'}"
th:attr="data-default-open=${tocDefaultOpen == 'open' ? 'true' : (tocDefaultOpen == 'closed' ? 'false' : (theme.config.style.fullscreen_layout ? 'false' : 'true'))}">
th:attr="data-default-open=${tocDefaultOpen == 'open' ? 'true' : (tocDefaultOpen == 'closed' ? 'false' : (theme.config.layout.fullscreen_layout ? 'false' : 'true'))}">
<button id="toc-toggle" class="toc-toggle" th:attr="aria-label=#{toc.hide}"></button>
<div id="toc-content" class="toc-content"></div>
</nav>