mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-30 18:22:40 +00:00
Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a85a665530 | |||
| 35413d613f | |||
| d1d3ed2954 | |||
| 9c8c0b6dee | |||
| 0cf0d4f4e7 | |||
| e663ebbd45 | |||
| 6eb582fef7 | |||
| 3053d889e2 | |||
| f7a9c52aac | |||
| 78971cdedb | |||
| d41e53bba4 | |||
| cb0d63717b | |||
| b45ab833d5 | |||
| 450e774d3c | |||
| a93f67762f | |||
| c21914dd49 | |||
| 1360438540 | |||
| 669f836488 | |||
| e62c0f2409 | |||
| de72a8c802 | |||
| f5b867d717 | |||
| 5ba4a8145b | |||
| 80e4d07294 | |||
| c2dc17e9e0 | |||
| b7edbf3e49 | |||
| adeecfb69d |
@@ -25,7 +25,7 @@
|
||||
> It is based on the original [LoveIt](https://github.com/dillonzq/LoveIt) Theme, [KeepIt](https://github.com/Fastbyte01/KeepIt) Theme and [LeaveIt](https://github.com/liuzc/LeaveIt) Theme.
|
||||
|
||||
[](https://github.com/hugo-fixit/FixIt/releases)
|
||||
[](https://gohugo.io/)
|
||||
[](https://gohugo.io/)
|
||||
[](/LICENSE)
|
||||
[](https://github.com/hugo-fixit/FixIt)
|
||||
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
> 它的原型基于 [LoveIt](https://github.com/dillonzq/LoveIt) 主题,[KeepIt](https://github.com/Fastbyte01/KeepIt) 主题和 [LeaveIt](https://github.com/liuzc/LeaveIt) 主题。
|
||||
|
||||
[](https://github.com/hugo-fixit/FixIt/releases)
|
||||
[](https://gohugo.io/)
|
||||
[](https://gohugo.io/)
|
||||
[](/LICENSE)
|
||||
[](https://github.com/hugo-fixit/FixIt)
|
||||
|
||||
|
||||
@@ -109,8 +109,7 @@
|
||||
}
|
||||
|
||||
.page {
|
||||
.categories-card,
|
||||
.collections-card {
|
||||
.taxonomy-cards {
|
||||
.card-item {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -129,6 +128,23 @@
|
||||
}
|
||||
|
||||
@media only print {
|
||||
|
||||
// 确保打印时没有 scrollbar
|
||||
:root {
|
||||
--fi-scrollbar-width: none !important;
|
||||
}
|
||||
|
||||
*::-webkit-scrollbar {
|
||||
display: none !important;
|
||||
width: 0 !important;
|
||||
height: 0 !important;
|
||||
}
|
||||
|
||||
.scrollbar-thin {
|
||||
scrollbar-width: none !important;
|
||||
-ms-overflow-style: none !important;
|
||||
}
|
||||
|
||||
@page {
|
||||
size: A4 portrait;
|
||||
margin: 1.27cm;
|
||||
|
||||
@@ -16,9 +16,10 @@
|
||||
// Set breadcrumb height to 0px if breadcrumb is disabled
|
||||
--#{$prefix}breadcrumb-height: 0px;
|
||||
|
||||
// hr style
|
||||
// hr / divider style
|
||||
--#{$prefix}hr-background-color: #{darken($global-border-color, 5%)};
|
||||
--#{$prefix}hr-before-color: #{lighten($single-link-hover-color, 4%)};
|
||||
--#{$prefix}divider-edge-weak: linear-gradient(to right, transparent, var(--#{$prefix}divider-bg, #d0d0d5), transparent);
|
||||
|
||||
// Scrollbar related variables
|
||||
--#{$prefix}scrollbar-thumb-color: #{$scrollbar-color};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
@import '../_partials/_single/toc';
|
||||
@import '../_partials/_single/fixit-decryptor';
|
||||
@import '../_partials/_single/collections';
|
||||
@import '../_partials/_single/related';
|
||||
|
||||
.single {
|
||||
.single-title {
|
||||
@@ -366,7 +367,10 @@
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
min-height: 1em;
|
||||
// SVG performs differently in Safari compared to other browsers
|
||||
&:not([src*='.svg']) {
|
||||
min-height: 1em;
|
||||
}
|
||||
|
||||
&.version {
|
||||
height: 1.25em;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
.categories-card,
|
||||
.collections-card {
|
||||
.taxonomy-cards {
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
// Related Content List (aside)
|
||||
.related-details {
|
||||
&:not(:first-of-type)::before {
|
||||
content: '';
|
||||
display: block;
|
||||
border: 0;
|
||||
padding-top: 1px;
|
||||
background: var(--#{$prefix}divider-edge-weak);
|
||||
margin-block: 1rem 0.5rem;
|
||||
}
|
||||
|
||||
&:not(:last-of-type) {
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.related-summary {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 0.25em;
|
||||
padding: 0.2em 0.5em;
|
||||
|
||||
> i.fa-layer-group {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.related-title {
|
||||
font-weight: bold;
|
||||
font-size: $related-title-font-size;
|
||||
}
|
||||
|
||||
.related-count {
|
||||
flex-shrink: 0;
|
||||
color: var(--#{$prefix}secondary);
|
||||
}
|
||||
|
||||
.details-icon {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@include user-select(none);
|
||||
}
|
||||
|
||||
.related-content {
|
||||
font-size: $related-list-font-size;
|
||||
|
||||
.related-list {
|
||||
margin: 0;
|
||||
padding-inline: 1.6em 0.8em;
|
||||
padding-block: 0.4em;
|
||||
text-indent: -0.8em;
|
||||
list-style: none;
|
||||
overflow-y: scroll;
|
||||
max-height: 60vh;
|
||||
@include scrollbar-width(none, 0);
|
||||
|
||||
.related-item > a::before,
|
||||
.related-item > span::before {
|
||||
content: '|';
|
||||
font-weight: 600;
|
||||
margin-right: 0.5em;
|
||||
position: relative;
|
||||
bottom: 2px;
|
||||
color: $single-link-color;
|
||||
|
||||
[data-theme='dark'] & {
|
||||
color: $single-link-color-dark;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
@import '_widgets/fixed-button';
|
||||
@import '_widgets/github-corner';
|
||||
@import '_widgets/noscript-warning';
|
||||
@import '_widgets/post-chat';
|
||||
@import '_widgets/reading-progress';
|
||||
@import '_widgets/typeit';
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#postChat_button,
|
||||
.post-TianliGPT {
|
||||
@extend .print-d-none;
|
||||
}
|
||||
@@ -103,6 +103,10 @@ $toc-content-font-size: 0.875rem !default;
|
||||
$collection-title-font-size: 1rem !default;
|
||||
$collection-list-font-size: 0.875rem !default;
|
||||
|
||||
// Font size of the Related Content List
|
||||
$related-title-font-size: 1rem !default;
|
||||
$related-list-font-size: 0.875rem !default;
|
||||
|
||||
// Color of the single link
|
||||
$single-link-color: #2376b7 !default; // 花青
|
||||
$single-link-color-dark: #1781b5 !default; // 釉蓝
|
||||
|
||||
+47
-5
@@ -1,3 +1,4 @@
|
||||
// TODO use ESLint to check the code style
|
||||
import Util from './util';
|
||||
|
||||
class FixIt {
|
||||
@@ -683,12 +684,53 @@ class FixIt {
|
||||
this._echartsArr = [];
|
||||
const stagingDOM = this.util.getStagingDOM()
|
||||
this.util.forEach(document.getElementsByClassName('echarts'), ($echarts) => {
|
||||
if ($echarts.nextElementSibling.tagName === 'TEMPLATE') {
|
||||
const chart = echarts.init($echarts, this.isDark ? 'dark' : 'light', { renderer: 'svg' });
|
||||
stagingDOM.stage($echarts.nextElementSibling.content.cloneNode(true));
|
||||
chart.setOption(stagingDOM.contentAsJson());
|
||||
this._echartsArr.push(chart);
|
||||
const $dataEl = $echarts.nextElementSibling;
|
||||
if ($dataEl.tagName !== 'TEMPLATE') {
|
||||
return;
|
||||
}
|
||||
const chart = echarts.init($echarts, this.isDark ? 'dark' : 'light', { renderer: 'svg' });
|
||||
chart.showLoading();
|
||||
stagingDOM.stage($dataEl.content.cloneNode(true));
|
||||
const _setOption = (option) => {
|
||||
if (!option) {
|
||||
chart.hideLoading();
|
||||
console.warn('ECharts option is missing or invalid. Chart disposed.', {
|
||||
element: $echarts,
|
||||
option: $dataEl,
|
||||
});
|
||||
chart.dispose();
|
||||
$echarts.removeAttribute('style');
|
||||
return;
|
||||
}
|
||||
chart.hideLoading();
|
||||
chart.setOption(option);
|
||||
this._echartsArr.push(chart);
|
||||
};
|
||||
// support JS object literal or JS code
|
||||
if ($dataEl.dataset.fmt === 'js') {
|
||||
try {
|
||||
const jsCodes = stagingDOM.contentAsText();
|
||||
/**
|
||||
* Get ECharts option
|
||||
* @param {Object} fixit FixIt instance
|
||||
* @param {Object} chart ECharts instance
|
||||
* @returns {Object|Promise} ECharts option or Promise
|
||||
*/
|
||||
const _getOption = new Function('fixit', 'chart',
|
||||
this.util.isObjectLiteral(jsCodes) ? `return ${jsCodes}` : jsCodes
|
||||
);
|
||||
if ($dataEl.dataset.async === 'true') {
|
||||
return Promise.resolve(_getOption(this, chart)).then(option => {
|
||||
_setOption(option);
|
||||
});
|
||||
}
|
||||
return _setOption(_getOption(this, chart));
|
||||
} catch (err) {
|
||||
return console.error(err);
|
||||
}
|
||||
}
|
||||
// support JSON
|
||||
_setOption(stagingDOM.contentAsJson());
|
||||
});
|
||||
stagingDOM.destroy();
|
||||
});
|
||||
|
||||
+19
-2
@@ -42,7 +42,7 @@ export default class Util {
|
||||
isValidDate(date) {
|
||||
return date instanceof Date && !isNaN(date.getTime());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* scroll some element into view
|
||||
* @param {String} selector element to scroll
|
||||
@@ -109,6 +109,23 @@ export default class Util {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
return this.copyText(text);
|
||||
return this.copyText(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* check if a string is a JS object string
|
||||
* @example isObjectLiteral("{a:1,b:2}") // true
|
||||
* @param {String} str string to check
|
||||
* @returns {Boolean} whether the string is a JS object string
|
||||
*/
|
||||
isObjectLiteral(str) {
|
||||
if (typeof str !== 'string') {
|
||||
return false;
|
||||
}
|
||||
str = str.replace(/\s+/g, ' ').trim().replace(/;$/, '')
|
||||
if (str.startsWith('{') && str.endsWith('}')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@ enableRobotsTXT = true
|
||||
enableGitInfo = true
|
||||
# whether to use emoji code
|
||||
enableEmoji = true
|
||||
# the main sections of a site
|
||||
mainSections = []
|
||||
|
||||
# -------------------------------------------------------------------------------------
|
||||
# Menu Configuration
|
||||
@@ -135,7 +137,7 @@ enableEmoji = true
|
||||
[module]
|
||||
[module.hugoVersion]
|
||||
extended = true
|
||||
min = "0.141.0"
|
||||
min = "0.146.0"
|
||||
|
||||
# -------------------------------------------------------------------------------------
|
||||
# Markup related configuration in Hugo
|
||||
@@ -1013,6 +1015,8 @@ enableEmoji = true
|
||||
linkToEdit = true
|
||||
# FixIt 0.3.0 | NEW whether to show link to report issue for the post
|
||||
linkToReport = true
|
||||
# FixIt 0.3.20 | NEW whether to show link to view the post in VSCode
|
||||
linkToVscode = true
|
||||
# FixIt 0.3.10 | CHANGED Page style ["narrow", "normal", "wide", ...]
|
||||
pageStyle = "normal"
|
||||
# FixIt 0.2.17 | CHANGED Auto Bookmark Support
|
||||
@@ -1118,6 +1122,8 @@ enableEmoji = true
|
||||
[params.page.related]
|
||||
enable = false
|
||||
count = 5
|
||||
# FixIt 0.3.20 | NEW position of related content, optional values: ["aside", "footer"]
|
||||
position = ["aside", "footer"]
|
||||
# FixIt 0.2.17 | NEW Donate (Sponsor) settings
|
||||
[params.page.reward]
|
||||
enable = false
|
||||
|
||||
@@ -123,6 +123,7 @@ readMarkdown = "Markdown anzeigen"
|
||||
viewSource = "Quelle anzeigen"
|
||||
editThisPage = "Diese Seite bearbeiten"
|
||||
reportIssue = "Problem melden"
|
||||
openInEditor = "Im Editor öffnen"
|
||||
back = "Zurück"
|
||||
home = "Startseite"
|
||||
readMore = "Mehr lesen"
|
||||
|
||||
@@ -123,6 +123,7 @@ readMarkdown = "Read Markdown"
|
||||
viewSource = "View source"
|
||||
editThisPage = "Edit this page"
|
||||
reportIssue = "Report issue"
|
||||
openInEditor = "Open in editor"
|
||||
back = "Back"
|
||||
home = "Home"
|
||||
readMore = "Read More"
|
||||
|
||||
@@ -123,6 +123,7 @@ readMarkdown = "Leer Markdown"
|
||||
viewSource = "Ver fuente"
|
||||
editThisPage = "Editar esta página"
|
||||
reportIssue = "Reportar problema"
|
||||
openInEditor = "Abrir en el editor"
|
||||
back = "Regresar"
|
||||
home = "Inicio"
|
||||
readMore = "Leer más"
|
||||
|
||||
@@ -123,6 +123,7 @@ readMarkdown = "Ouvrir le Markdown"
|
||||
viewSource = "Voir la source"
|
||||
editThisPage = "Modifier cette page"
|
||||
reportIssue = "Signaler un problème"
|
||||
openInEditor = "Ouvrir dans l'éditeur"
|
||||
back = "Retour"
|
||||
home = "Accueil"
|
||||
readMore = "En savoir plus"
|
||||
|
||||
@@ -124,6 +124,7 @@ readMarkdown = "मार्कडाउन पढ़ें"
|
||||
viewSource = "स्रोत देखें"
|
||||
editThisPage = "इस पृष्ठ को संपादित करें"
|
||||
reportIssue = "समस्या की रिपोर्ट करें"
|
||||
openInEditor = "संपादक में खोलें"
|
||||
back = "पीछे"
|
||||
home = "घर"
|
||||
readMore = "और पढ़ें"
|
||||
|
||||
@@ -123,6 +123,7 @@ readMarkdown = "Leggi Markdown"
|
||||
viewSource = "Visualizza sorgente"
|
||||
editThisPage = "Modifica questa pagina"
|
||||
reportIssue = "Segnala un problema"
|
||||
openInEditor = "Apri nell'editor"
|
||||
back = "Indietro"
|
||||
home = "Home"
|
||||
readMore = "Leggi di più"
|
||||
|
||||
@@ -123,6 +123,7 @@ readMarkdown = "Zobacz Markdown"
|
||||
viewSource = "Zobacz źródło"
|
||||
editThisPage = "Edytuj tą stronę"
|
||||
reportIssue = "Zgłoś problem"
|
||||
openInEditor = "Otwórz w edytorze"
|
||||
back = "Wstecz"
|
||||
home = "Strona główna"
|
||||
readMore = "Czytaj więcej"
|
||||
|
||||
@@ -124,6 +124,7 @@ readMarkdown = "Leia em Markdown"
|
||||
viewSource = "Ver a fonte"
|
||||
editThisPage = "Editar esta página"
|
||||
reportIssue = "Reportar problema"
|
||||
openInEditor = "Abrir no editor"
|
||||
back = "Voltar"
|
||||
home = "Home"
|
||||
readMore = "Leia mais"
|
||||
|
||||
@@ -123,6 +123,7 @@ readMarkdown = "Citire Markdown"
|
||||
viewSource = "Vezi sursa"
|
||||
editThisPage = "Editați această pagină"
|
||||
reportIssue = "Raportează o problemă"
|
||||
openInEditor = "Deschide în editor"
|
||||
back = "Înapoi"
|
||||
home = "Acasă"
|
||||
readMore = "Citește mai mult"
|
||||
|
||||
@@ -123,6 +123,7 @@ readMarkdown = "Читать Markdown"
|
||||
viewSource = "Просмотреть источник"
|
||||
editThisPage = "Редактировать эту страницу"
|
||||
reportIssue = "Сообщить о проблеме"
|
||||
openInEditor = "Открыть в редакторе"
|
||||
back = "Назад"
|
||||
home = "Домой"
|
||||
readMore = "Читать больше"
|
||||
|
||||
@@ -123,6 +123,7 @@ readMarkdown = "Читај Markdown"
|
||||
viewSource = "Погледај извор"
|
||||
editThisPage = "Уреди ову страницу"
|
||||
reportIssue = "Пријави проблем"
|
||||
openInEditor = "Отвори у уреднику"
|
||||
back = "Назад"
|
||||
home = "Почетна"
|
||||
readMore = "Прочитај више"
|
||||
|
||||
@@ -122,6 +122,7 @@ readMarkdown = "Đọc với định dạng Markdown"
|
||||
viewSource = "Xem mã nguồn"
|
||||
editThisPage = "Chỉnh sửa trang này"
|
||||
reportIssue = "Báo cáo lỗi"
|
||||
openInEditor = "Mở trong trình chỉnh sửa"
|
||||
back = "Quay lại"
|
||||
home = "Trang chủ"
|
||||
readMore = "Đọc thêm"
|
||||
|
||||
@@ -121,6 +121,7 @@ readMarkdown = "阅读原始文档"
|
||||
viewSource = "查看源码"
|
||||
editThisPage = "编辑此页"
|
||||
reportIssue = "报告问题"
|
||||
openInEditor = "在编辑器中打开"
|
||||
back = "返回"
|
||||
home = "主页"
|
||||
readMore = "阅读全文"
|
||||
|
||||
@@ -121,6 +121,7 @@ readMarkdown = "閱讀原始文檔"
|
||||
viewSource = "查看原始碼"
|
||||
editThisPage = "編輯此頁"
|
||||
reportIssue = "報告問題"
|
||||
openInEditor = "在編輯器中打開"
|
||||
back = "返回"
|
||||
home = "主頁"
|
||||
readMore = "閱讀全文"
|
||||
|
||||
@@ -1,2 +1,8 @@
|
||||
{{- dict "Options" .Attributes "Inner" .Inner | partial "plugin/echarts.html" -}}
|
||||
{{- dict
|
||||
"Options" .Attributes
|
||||
"Inner" .Inner
|
||||
"Resources" .Page.Resources
|
||||
"Position" .Position
|
||||
| partial "plugin/echarts.html"
|
||||
-}}
|
||||
{{- .Page.Store.Set "hasEcharts" true -}}
|
||||
|
||||
@@ -1 +1,7 @@
|
||||
{{- dict "Options" .Attributes "Inner" .Inner | partial "plugin/timeline.html" -}}
|
||||
{{- dict
|
||||
"Options" .Attributes
|
||||
"Inner" .Inner
|
||||
"Resources" .Page.Resources
|
||||
"Position" .Position
|
||||
| partial "plugin/timeline.html"
|
||||
-}}
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
{{- end -}}
|
||||
{{- $headingConfig := $params.heading -}}
|
||||
{{- /* Only enable in main section pages */ -}}
|
||||
{{- $onlyMainSection := cond $headingConfig.number.onlyMainSection (eq .Page.Type "posts") true -}}
|
||||
{{- $intersect := (slice .Page.Section .Page.Type) | intersect site.MainSections -}}
|
||||
{{- $onlyMainSection := cond $headingConfig.number.onlyMainSection ((gt (len $intersect) 0) | and (eq .Page.Kind "page")) true -}}
|
||||
{{- $ordered := $toc.ordered | and $headingConfig.number.enable | and $onlyMainSection -}}
|
||||
{{- $h1Format := $headingConfig.number.format.h1 | default "{title}" -}}
|
||||
{{- $h2Format := $headingConfig.number.format.h2 | default "{h2} {title}" -}}
|
||||
@@ -31,9 +32,21 @@
|
||||
{{- .Page.Scratch.SetInMap "heading-counter" (string (add $level 1)) 0 -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $attrs := "" }}
|
||||
{{- range $key, $value := .Attributes }}
|
||||
{{- $attrs = printf "%s %s=%q" $attrs $key $value }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Attributes.class }}
|
||||
{{- $attrs = replace $attrs . (printf "heading-element %s" .) }}
|
||||
{{- else }}
|
||||
{{- $attrs = printf "class=%q %s" "heading-element" $attrs }}
|
||||
{{- end }}
|
||||
{{- $attrs = partial "function/trim.html" $attrs -}}
|
||||
|
||||
{{- /* Force decrease the markup level to avoid multiple h1 */ -}}
|
||||
{{- $markupLevel := cond (gt $maxMarkupLevel $level) $maxMarkupLevel $level -}}
|
||||
<h{{ $markupLevel }} id="{{ .Anchor | safeURL }}" class="heading-element">
|
||||
<h{{ $markupLevel }} {{ $attrs | safeHTMLAttr }}>
|
||||
{{- $title := .Text -}}
|
||||
{{- if $ordered -}}
|
||||
{{- /* Add 1 to the current level */ -}}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
{{- /* Collections Page */ -}}
|
||||
|
||||
<div class="collections-card">
|
||||
{{- range .Data.Terms.ByCount -}}
|
||||
{{- $term := .Term -}}
|
||||
{{- $pages := .Pages -}}
|
||||
{{- with $.Site.GetPage "taxonomy" (printf "%v/%v" $.Type $term) -}}
|
||||
<div class="card-item">
|
||||
<div class="card-item-wrapper">
|
||||
<h2 class="card-item-title">
|
||||
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}'>
|
||||
{{- dict "Class" "fa-solid fa-layer-group fa-fw me-1" | partial "plugin/icon.html" -}}
|
||||
{{- .Page.Title }} <sup>{{ len $pages }}</sup>
|
||||
</a>
|
||||
</h2>
|
||||
{{- range first 5 $pages -}}
|
||||
<article class="archive-item">
|
||||
<a href="{{ .RelPermalink }}" class="archive-item-link">
|
||||
{{- $repost := .Params.repost | default dict -}}
|
||||
{{- if eq $repost.enable true -}}
|
||||
{{- dict "Class" "fa-solid fa-share fa-fw text-success me-1" | partial "plugin/icon.html" -}}
|
||||
{{- end -}}
|
||||
{{- cond (.Param "capitalizeTitles") (title .LinkTitle) .LinkTitle -}}
|
||||
</a>
|
||||
</article>
|
||||
{{- end -}}
|
||||
{{- if gt (len $pages) 5 -}}
|
||||
<span class="more-post">
|
||||
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}' class="more-single-link">{{ T "pagination.more" }} >></a>
|
||||
</span>
|
||||
{{- end -}}
|
||||
</div>
|
||||
</div>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
@@ -17,7 +17,7 @@
|
||||
<script src="//at.alicdn.com/t/font_578712_g26jo2kbzd5qm2t9.js" async defer></script>
|
||||
<div class="friend-links">
|
||||
{{ range $index, $friend := .Site.Data.friends }}
|
||||
<a class="friend-link" title="{{ $friend.description }}" href="{{ $friend.url | safeURL }}" rel="external noopener" target="_blank">
|
||||
<a class="friend-link" title="{{ $friend.description | safeHTML }}" href="{{ $friend.url | safeURL }}" rel="external noopener" target="_blank">
|
||||
{{ if $friend.avatar }}
|
||||
{{- dict "Src" $friend.avatar "Alt" $friend.nickname "Title" $friend.description "Class" "friend-avatar" | partial "plugin/image.html" -}}
|
||||
{{ else }}
|
||||
@@ -1,6 +1,11 @@
|
||||
{{- /* Categories Page */ -}}
|
||||
{{- /* Taxonomies Page */ -}}
|
||||
{{- $iconMap := dict
|
||||
"category" "fa-regular fa-folder"
|
||||
"collection" "fa-solid fa-layer-group"
|
||||
-}}
|
||||
{{- $icon := index $iconMap .Data.Singular | default $iconMap.category -}}
|
||||
|
||||
<div class="categories-card">
|
||||
<div class="taxonomy-cards {{ .Data.Plural }}">
|
||||
{{- range .Data.Terms.ByCount -}}
|
||||
{{- $term := .Term -}}
|
||||
{{- $pages := .Pages -}}
|
||||
@@ -9,7 +14,7 @@
|
||||
<div class="card-item-wrapper">
|
||||
<h2 class="card-item-title">
|
||||
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}'>
|
||||
{{- dict "Class" "fa-regular fa-folder fa-fw me-1" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" (add $icon " fa-fw me-1") | partial "plugin/icon.html" -}}
|
||||
{{- .Page.Title }} <sup>{{ len $pages }}</sup>
|
||||
</a>
|
||||
</h2>
|
||||
@@ -34,3 +39,4 @@
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- /* EOF */ -}}
|
||||
@@ -5,24 +5,21 @@
|
||||
|
||||
{{- define "content" -}}
|
||||
{{- $taxonomies := .Data.Plural -}}
|
||||
{{- $iconMap := dict
|
||||
"categories" "fa-solid fa-folder-tree"
|
||||
"collections" "fa-solid fa-layer-group"
|
||||
"tags" "fa-solid fa-tags"
|
||||
-}}
|
||||
{{- $icon := index $iconMap $taxonomies | default $iconMap.categories -}}
|
||||
|
||||
<div class="page archive">
|
||||
{{- $termsIcon := "" -}}
|
||||
{{- if eq $taxonomies "categories" -}}
|
||||
{{- $termsIcon = "fa-solid fa-folder-tree" -}}
|
||||
{{- else if eq $taxonomies "tags" -}}
|
||||
{{- $termsIcon = "fa-solid fa-tags" -}}
|
||||
{{- else if eq $taxonomies "collections" -}}
|
||||
{{- $termsIcon = "fa-solid fa-layer-group" -}}
|
||||
{{- end -}}
|
||||
{{- /* Title */ -}}
|
||||
<h1 class="single-title animate__animated animate__pulse animate__faster">
|
||||
{{- with $termsIcon -}}
|
||||
{{- dict "Class" (add . " fa-fw me-1") | partial "plugin/icon.html" -}}
|
||||
{{- end -}}
|
||||
{{- dict "Class" (add $icon " fa-fw me-1") | partial "plugin/icon.html" -}}
|
||||
{{- .Params.Title | default (T $taxonomies) | default $taxonomies | dict "Some" | T "allSome" }} <sup>{{ len .Data.Terms.ByCount }}</sup>
|
||||
</h1>
|
||||
{{- /* Render miscellaneous terms */ -}}
|
||||
{{- .Render $taxonomies -}}
|
||||
{{- /* Render different taxonomies */ -}}
|
||||
{{- $template := cond ( eq $taxonomies "tags") "tags" "taxonomies" -}}
|
||||
{{- .Render $template -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- /* Trim whitespace from the beginning and end of a string */ -}}
|
||||
{{- return (. | replaceRE `[\s]+` " " | strings.TrimSpace) -}}
|
||||
@@ -4,8 +4,9 @@
|
||||
{{- $homeRelPermalink = strings.TrimSuffix "offline/" $homeRelPermalink -}}
|
||||
{{- .Scratch.Set "homeRelPermalink" $homeRelPermalink -}}
|
||||
|
||||
{{- /* Set pages of main section */ -}}
|
||||
{{- $pages := where .Site.RegularPages "Type" "posts" -}}
|
||||
{{- /* Set pages of main sections */ -}}
|
||||
{{- $pages := where .Site.RegularPages "Section" "in" .Site.MainSections -}}
|
||||
{{- $pages = $pages | union (where .Site.RegularPages "Type" "in" .Site.MainSections) -}}
|
||||
{{- .Scratch.Set "mainSectionPages" $pages -}}
|
||||
|
||||
{{- /* Select the scope named `public_repo` to generate personal access token */ -}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- .Scratch.Set "version" "v0.3.17" -}}
|
||||
{{- .Scratch.Set "version" "v0.3.20" -}}
|
||||
{{- .Scratch.Set "this" dict -}}
|
||||
|
||||
{{- partial "init/detection-env.html" . -}}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
{{- else }}
|
||||
{{- $attrs = printf "class=%q %s" (printf "alert alert-%s" $.Type) $attrs }}
|
||||
{{- end }}
|
||||
{{- $attrs = trim $attrs " " -}}
|
||||
{{- $attrs = partial "function/trim.html" $attrs -}}
|
||||
|
||||
<div {{ $attrs | safeHTMLAttr }}>
|
||||
{{- $icon := index $iconMap .Type -}}
|
||||
|
||||
@@ -1,7 +1,40 @@
|
||||
{{- /* Echarts support for code fences extended and shortcodes. */ -}}
|
||||
{{- $width := .Options.width | default "100%" -}}
|
||||
{{- $height := .Options.height | default "30rem" -}}
|
||||
{{- $js := .Options.js | default false -}}
|
||||
{{- $async := .Options.async | default false -}}
|
||||
{{- $data := .Options.data -}}
|
||||
{{- $file := .Options.file -}}
|
||||
{{- $attrs := printf `style="width: %v; height: %v;"` $width $height -}}
|
||||
<div class="echarts" {{ $attrs | safeHTMLAttr }}></div>
|
||||
<template>{{ .Inner | transform.Unmarshal | jsonify }}</template>
|
||||
{{- /* EOF */ -}}
|
||||
{{- $content := strings.TrimSpace .Inner -}}
|
||||
{{- if $js | or (hasSuffix $file ".js") -}}
|
||||
{{- with dict "Path" $file "Resources" .Resources | partial "function/resource.html" }}
|
||||
{{- $content = .Content -}}
|
||||
{{- end }}
|
||||
{{- if hugo.IsProduction -}}
|
||||
{{- $content = replaceRE `[\s]+` " " $content -}}
|
||||
{{- end -}}
|
||||
{{- if not $content -}}
|
||||
{{- warnf "ECharts: JS Code is empty, executing in file %s" $.Position -}}
|
||||
{{- end -}}
|
||||
<template data-fmt="js" data-async="{{ $async }}">{{ $content | safeJS }}</template>
|
||||
{{- else -}}
|
||||
{{ with $data }}
|
||||
{{- $content = index site.Data.echarts (printf "%v.%v" . page.Language) | default (index site.Data.echarts .) -}}
|
||||
{{- if not $content -}}
|
||||
{{- warnf "ECharts: data not found, please ensure the data file \"data/echarts/%s.{json|yml|yaml|toml}\" exists." . -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- with dict "Path" $file "Resources" .Resources | partial "function/resource.html" }}
|
||||
{{- $content = .Content -}}
|
||||
{{- else with $file -}}
|
||||
{{- warnf "ECharts: no such data file: %s" . -}}
|
||||
{{- end -}}
|
||||
{{- $content = $content | transform.Unmarshal -}}
|
||||
{{- end -}}
|
||||
{{- if not $content -}}
|
||||
{{- warnf "ECharts: option is empty, executing in file %s" $.Position -}}
|
||||
{{- end -}}
|
||||
<template>{{ $content | jsonify }}</template>
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
{{- /*
|
||||
deprecated: image-legacy.html
|
||||
TODO delete this file in the next minor release
|
||||
*/ -}}
|
||||
{{- warnf "Deprecated image-legacy.html and will be removed in the next minor release, please use image.html instead." -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
{{- $class := .Class | default "" -}}
|
||||
{{- $style := "" -}}
|
||||
|
||||
@@ -4,16 +4,32 @@
|
||||
{{- $animation := .Options.animation | default false -}}
|
||||
{{- $size := .Options.size | default "medium" -}}
|
||||
{{- $node := .Options.node | default "circle" -}}
|
||||
{{- $data := .Options.data -}}
|
||||
{{- $file := .Options.file -}}
|
||||
|
||||
{{- /* Get Timeline events */ -}}
|
||||
{{- $events := slice -}}
|
||||
{{- with .Inner -}}
|
||||
{{- $events = (. | transform.Unmarshal).events -}}
|
||||
{{- $content := .Inner -}}
|
||||
{{ with $data }}
|
||||
{{- $content = index site.Data.timeline (printf "%v.%v" . page.Language) | default (index site.Data.timeline .) -}}
|
||||
{{- if not $content -}}
|
||||
{{- warnf "Timeline: data not found, please ensure the data file \"data/timeline/%s.{json|yml|yaml|toml}\" exists." . -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- with dict "Path" $file "Resources" .Resources | partial "function/resource.html" }}
|
||||
{{- $content = .Content -}}
|
||||
{{- else with $file -}}
|
||||
{{- warnf "Timeline: no such data file: %s" . -}}
|
||||
{{- end -}}
|
||||
{{- $content = $content | transform.Unmarshal -}}
|
||||
{{- end -}}
|
||||
{{- $events := $content.events | default slice -}}
|
||||
{{- with .Events -}}
|
||||
{{- $events = . -}}
|
||||
{{- end -}}
|
||||
{{- $events = sort $events "timestamp" (cond $reverse "desc" "asc") -}}
|
||||
{{- if not $events -}}
|
||||
{{- warnf "Timeline: events is empty, executing in file %s" $.Position -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Set Timeline style */ -}}
|
||||
{{- $style := "" -}}
|
||||
|
||||
@@ -24,8 +24,11 @@
|
||||
{{- dict "Date" . | T "single.updatedOnDate" -}}
|
||||
{{- if $gitRepo -}}
|
||||
{{- with $.GitInfo -}}
|
||||
{{/* TODO add Git .Body */}}
|
||||
<a class="git-hash" href="{{ printf `%v/commit/%v` $gitRepo .Hash }}" rel="external nofollow noopener noreferrer" target="_blank" title="commit by {{ .AuthorName }}({{ .AuthorEmail }}) {{ .Hash }}: {{ .Subject }}">
|
||||
{{- $title := printf "%v
%v
Commit: %v [%v]
Author: %v<%v>
Date: %v" .Subject .Body .Hash .AbbreviatedHash .AuthorName .AuthorEmail (.AuthorDate | dateFormat "2006-01-02 15:04:05") -}}
|
||||
{{- if ne .AuthorDate .CommitDate -}}
|
||||
{{- $title = printf "%s
Commit Date: %v" $title (.CommitDate | dateFormat "2006-01-02 15:04:05") -}}
|
||||
{{- end -}}
|
||||
<a class="git-hash" href="{{ printf `%v/commit/%v` $gitRepo .Hash }}" rel="external nofollow noopener noreferrer" target="_blank" title="{{ $title | safeHTML }}">
|
||||
{{- dict "Class" "fa-solid fa-hashtag fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- .AbbreviatedHash -}}
|
||||
</a>
|
||||
@@ -48,27 +51,32 @@
|
||||
{{- $linkOptions := slice -}}
|
||||
{{- if $params.LinkToMarkdown -}}
|
||||
{{- with .OutputFormats.Get "markdown" -}}
|
||||
{{- $options := dict "Class" "link-to-markdown" "Destination" .RelPermalink "Title" (T "single.readMarkdown") "Content" (T "single.readMarkdown") "externalIcon" false -}}
|
||||
{{- $options := dict "Class" "link-to-markdown" "Destination" .RelPermalink "Title" (T "single.readMarkdown") "Content" (T "single.readMarkdown") -}}
|
||||
{{- $linkOptions = $linkOptions | append $options -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if $params.LinkToSource | and $gitRepo -}}
|
||||
{{- $link := replace $blobURL "{path}" $.File.Path -}}
|
||||
{{- $sourceURL = $params.sourceURL | default (add $link "?plain=1") -}}
|
||||
{{- $options := dict "Class" "link-to-source" "Destination" $sourceURL "Title" (T "single.viewSource") "Content" (T "single.viewSource") "externalIcon" false -}}
|
||||
{{- $options := dict "Class" "link-to-source" "Destination" $sourceURL "Title" (T "single.viewSource") "Content" (T "single.viewSource") -}}
|
||||
{{- $linkOptions = $linkOptions | append $options -}}
|
||||
{{- end -}}
|
||||
{{- if $params.LinkToEdit | and $gitRepo -}}
|
||||
{{- $link := replace $editURL "{path}" $.File.Path -}}
|
||||
{{- $editURL = $params.editURL | default $link -}}
|
||||
{{- $options := dict "Class" "link-to-edit" "Destination" $editURL "Title" (T "single.editThisPage") "Content" (T "single.editThisPage") "externalIcon" false -}}
|
||||
{{- $options := dict "Class" "link-to-edit" "Destination" $editURL "Title" (T "single.editThisPage") "Content" (T "single.editThisPage") -}}
|
||||
{{- $linkOptions = $linkOptions | append $options -}}
|
||||
{{- end -}}
|
||||
{{- if $params.LinkToReport | and $gitRepo -}}
|
||||
{{- $link := replace $reportURL "{title}" ($.Title | urlquery) -}}
|
||||
{{- $link = replace $link "{URL}" $.Permalink -}}
|
||||
{{- $link = replace $link "{sourceURL}" $sourceURL -}}
|
||||
{{- $options := dict "Class" "link-to-report" "Destination" $link "Title" (T "single.reportIssue") "Content" (T "single.reportIssue") "externalIcon" false -}}
|
||||
{{- $options := dict "Class" "link-to-report" "Destination" $link "Title" (T "single.reportIssue") "Content" (T "single.reportIssue") -}}
|
||||
{{- $linkOptions = $linkOptions | append $options -}}
|
||||
{{- end -}}
|
||||
{{- if $params.LinkToVscode | and hugo.IsServer | and (not $.File.IsContentAdapter) -}}
|
||||
{{- $link := printf "vscode://file/%v" $.File.Filename -}}
|
||||
{{- $options := dict "Class" "link-to-vscode" "Destination" $link "Title" (T "single.openInEditor") "Content" (T "single.openInEditor") -}}
|
||||
{{- $linkOptions = $linkOptions | append $options -}}
|
||||
{{- end -}}
|
||||
{{- range $linkOptions -}}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
{{- /* Related Content */ -}}
|
||||
{{- /* https://gohugo.io/content-management/related/ */ -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
|
||||
{{- if $params.related.enable | and ("aside" | in $params.related.position) | and (not $params.password) -}}
|
||||
{{- $posts := .Scratch.Get "mainSectionPages" -}}
|
||||
{{- if .Site.Params.page.hiddenFromRelated -}}
|
||||
{{- $posts = where $posts "Params.hiddenfromrelated" false -}}
|
||||
{{- else -}}
|
||||
{{- $posts = where $posts "Params.hiddenfromrelated" "!=" true -}}
|
||||
{{- end -}}
|
||||
{{- $related := $posts.Related . | first ($params.related.count | default 5) -}}
|
||||
{{- with $related -}}
|
||||
<div class="details related-details open">
|
||||
<div class="details-summary related-summary">
|
||||
{{ dict "Class" "fa-solid fa-fire fa-fade text-danger fa-fw" | partial "plugin/icon.html" }}
|
||||
<span class="related-title">{{ T "single.relatedContent" }}</span>
|
||||
{{- dict "Class" "details-icon fa-solid fa-angle-right fa-fw" | partial "plugin/icon.html" -}}
|
||||
</div>
|
||||
<div class="details-content related-content">
|
||||
<ul class="related-list">
|
||||
{{- range $i, $p := . -}}
|
||||
{{- $title := cond (.Param "capitalizeTitles") (title .LinkTitle) .LinkTitle -}}
|
||||
<li class="related-item">
|
||||
<a href="{{ .RelPermalink }}" title="{{ $title }}">{{ $title }}</a>
|
||||
{{- with .HeadingsFiltered -}}
|
||||
<ul>
|
||||
{{- range . -}}
|
||||
{{- $link := printf "%s#%s" $p.RelPermalink .ID | safeURL -}}
|
||||
<li>
|
||||
<a href="{{ $link }}" title="{{ .Title }}">{{ .Title }}</a>
|
||||
</li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
{{- end -}}
|
||||
</li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -2,7 +2,7 @@
|
||||
{{- /* https://gohugo.io/content-management/related/ */ -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
|
||||
{{- if $params.related.enable | and (not $params.password) -}}
|
||||
{{- if $params.related.enable | and ("footer" | in $params.related.position) | and (not $params.password) -}}
|
||||
{{- $posts := .Scratch.Get "mainSectionPages" -}}
|
||||
{{- if .Site.Params.page.hiddenFromRelated -}}
|
||||
{{- $posts = where $posts "Params.hiddenfromrelated" false -}}
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
{{- /* Collection List */ -}}
|
||||
{{- partial "single/collection-list.html" . -}}
|
||||
|
||||
{{- /* TODO Related Content */ -}}
|
||||
{{/* {{- partial "single/related.html" . -}} */}}
|
||||
{{- /* Related Content */ -}}
|
||||
{{- partial "single/related-aside.html" . -}}
|
||||
|
||||
{{- /* Custom Aside */ -}}
|
||||
{{- block "custom-aside" . }}{{ end -}}
|
||||
|
||||
@@ -1,4 +1,14 @@
|
||||
{{- $options := .Get "width" | default (.Get 0) | dict "width" -}}
|
||||
{{- $options = .Get "height" | default (.Get 1) | dict "height" | merge $options -}}
|
||||
{{- dict "Options" $options "Inner" .Inner | partial "plugin/echarts.html" -}}
|
||||
{{- $options = .Get "js" | default false | dict "js" | merge $options -}}
|
||||
{{- $options = .Get "async" | default false | dict "async" | merge $options -}}
|
||||
{{- $options = .Get "data" | dict "data" | merge $options -}}
|
||||
{{- $options = .Get "file" | dict "file" | merge $options -}}
|
||||
{{- dict
|
||||
"Options" $options
|
||||
"Inner" .Inner
|
||||
"Resources" .Page.Resources
|
||||
"Position" .Position
|
||||
| partial "plugin/echarts.html"
|
||||
-}}
|
||||
{{- .Page.Store.Set "hasEcharts" true -}}
|
||||
|
||||
@@ -7,5 +7,13 @@
|
||||
{{- $options = .Get "width" | dict "width" | merge $options -}}
|
||||
{{- $options = .Get "height" | dict "height" | merge $options -}}
|
||||
{{- $options = .Get "class" | dict "class" | merge $options -}}
|
||||
{{- $options = .Get "data" | dict "data" | merge $options -}}
|
||||
{{- $options = .Get "file" | dict "file" | merge $options -}}
|
||||
{{- end -}}
|
||||
{{- dict "Options" $options "Inner" .Inner | partial "plugin/timeline.html" -}}
|
||||
{{- dict
|
||||
"Options" $options
|
||||
"Inner" .Inner
|
||||
"Resources" .Page.Resources
|
||||
"Position" .Position
|
||||
| partial "plugin/timeline.html"
|
||||
-}}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "fixit-core",
|
||||
"version": "0.3.17",
|
||||
"version": "0.3.20",
|
||||
"private": true,
|
||||
"packageManager": "pnpm@10.5.2",
|
||||
"description": "Hugo FixIt core theme component source files",
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ licenselink = "https://github.com/hugo-fixit/FixIt/blob/main/LICENSE"
|
||||
description = "A Clean, Elegant but Advanced Hugo Theme for Hugo."
|
||||
homepage = "https://github.com/hugo-fixit/FixIt"
|
||||
demosite = "https://fixit.lruihao.cn"
|
||||
min_version = "0.141.0"
|
||||
min_version = "0.146.0"
|
||||
|
||||
tags = [
|
||||
"blog",
|
||||
|
||||
Reference in New Issue
Block a user