From 603c181ad27109327617a78e5f672ebf68edc267 Mon Sep 17 00:00:00 2001
From: Mara-Li <lili.simonetti@outlook.fr>
Date: Mon, 29 Jan 2024 06:13:59 +0000
Subject: [PATCH] feat: allow to config a translation for date (#739)
---
quartz/components/pages/TagContent.tsx | 24 +++++++++++++-----------
1 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/quartz/components/pages/TagContent.tsx b/quartz/components/pages/TagContent.tsx
index 9907e3f..5050746 100644
--- a/quartz/components/pages/TagContent.tsx
+++ b/quartz/components/pages/TagContent.tsx
@@ -1,12 +1,11 @@
import { QuartzComponentConstructor, QuartzComponentProps } from "../types"
-import { Fragment, jsx, jsxs } from "preact/jsx-runtime"
-import { toJsxRuntime } from "hast-util-to-jsx-runtime"
import style from "../styles/listPage.scss"
import { PageList } from "../PageList"
import { FullSlug, getAllSegmentPrefixes, simplifySlug } from "../../util/path"
import { QuartzPluginData } from "../../plugins/vfile"
import { Root } from "hast"
import { pluralize } from "../../util/lang"
+import { htmlToJsx } from "../../util/jsx"
const numPages = 10
function TagContent(props: QuartzComponentProps) {
@@ -26,18 +25,21 @@
const content =
(tree as Root).children.length === 0
? fileData.description
- : // @ts-ignore
- toJsxRuntime(tree, { Fragment, jsx, jsxs, elementAttributeNameCase: "html" })
-
- if (tag === "") {
- const tags = [...new Set(allFiles.flatMap((data) => data.frontmatter?.tags ?? []))]
+ : htmlToJsx(fileData.filePath!, tree)
+ const cssClasses: string[] = fileData.frontmatter?.cssclasses ?? []
+ const classes = ["popover-hint", ...cssClasses].join(" ")
+ if (tag === "/") {
+ const tags = [
+ ...new Set(
+ allFiles.flatMap((data) => data.frontmatter?.tags ?? []).flatMap(getAllSegmentPrefixes),
+ ),
+ ].sort((a, b) => a.localeCompare(b))
const tagItemMap: Map<string, QuartzPluginData[]> = new Map()
for (const tag of tags) {
tagItemMap.set(tag, allPagesWithTag(tag))
}
-
return (
- <div class="popover-hint">
+ <div class={classes}>
<article>
<p>{content}</p>
</article>
@@ -55,7 +57,7 @@
return (
<div>
<h2>
- <a class="internal tag-link" href={`./${tag}`}>
+ <a class="internal tag-link" href={`../tags/${tag}`}>
#{tag}
</a>
</h2>
@@ -79,7 +81,7 @@
}
return (
- <div class="popover-hint">
+ <div class={classes}>
<article>{content}</article>
<p>{pluralize(pages.length, "item")} with this tag.</p>
<div>
--
Gitblit v1.10.0