Skip to content

Commit

Permalink
merge with upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
xy-241 committed Dec 8, 2024
2 parents 6fdafd0 + 5ccc2dc commit 957b8b0
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 20 deletions.
1 change: 1 addition & 0 deletions docs/showcase.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ Want to see what Quartz can do? Here are some cool community gardens:
- [Eledah's Crystalline](https://blog.eledah.ir/)
- [🌓 Projects & Privacy - FOSS, tech, law](https://be-far.com)
- [Zen Browser Docs](https://docs.zen-browser.app)
- [🪴8cat life](https://8cat.life)

If you want to see your own on here, submit a [Pull Request adding yourself to this file](https://github.com/jackyzha0/quartz/blob/v4/docs/showcase.md)!
10 changes: 5 additions & 5 deletions quartz/components/ContentMeta.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { formatDate, getDate } from "./Date"
import { Date, getDate } from "./Date"
import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
import readingTime from "reading-time"
import { classNames } from "../util/lang"
Expand Down Expand Up @@ -36,13 +36,13 @@ export default ((opts?: Partial<ContentMetaOptions>) => {
const cfgDefaultDataType = cfg.defaultDateType // For backward compatibility, just in case this is used somewhere else by the original author

if (fileData.dates.created) {
cfg.defaultDateType = "created"
createdSegment = formatDate(getDate(cfg, fileData)!)
cfg.defaultDateType = "created" // sets which date type to be set
createdSegment = <Date date={getDate(cfg, fileData)!} locale={cfg.locale} />
}

if (fileData.dates.modified) {
cfg.defaultDateType = "modified"
modifiedSegment = formatDate(getDate(cfg, fileData)!)
cfg.defaultDateType = "modified" // sets which date type to be set
modifiedSegment = <Date date={getDate(cfg, fileData)!} locale={cfg.locale} />
}

cfg.defaultDateType = cfgDefaultDataType
Expand Down
2 changes: 1 addition & 1 deletion quartz/components/Date.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ export function formatDate(d: Date, locale: ValidLocale = "en-US"): string {
}

export function Date({ date, locale }: Props) {
return <>{formatDate(date, locale)}</>
return <time datetime={date.toISOString()}>{formatDate(date, locale)}</time>
}
2 changes: 0 additions & 2 deletions quartz/components/Head.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,6 @@ export default (() => {
<>
<meta property="og:image:width" content={fullOptions.width.toString()} />
<meta property="og:image:height" content={fullOptions.height.toString()} />
<meta property="og:width" content={fullOptions.width.toString()} />
<meta property="og:height" content={fullOptions.height.toString()} />
</>
)}
<meta property="og:image:url" content={ogImagePath} />
Expand Down
10 changes: 3 additions & 7 deletions quartz/components/PageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,9 @@ export const PageList: QuartzComponent = ({ cfg, fileData, allFiles, limit, sort
return (
<li class="section-li">
<div class="section">
<div>
{page.dates && (
<p class="meta">
<Date date={getDate(cfg, page)!} locale={cfg.locale} />
</p>
)}
</div>
<p class="meta">
{page.dates && <Date date={getDate(cfg, page)!} locale={cfg.locale} />}
</p>
<div class="desc">
<h3>
<a href={resolveRelative(fileData.slug!, page.slug!)} class="internal" >
Expand Down
7 changes: 4 additions & 3 deletions quartz/components/scripts/darkmode.inline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ document.addEventListener("nav", () => {

// Darkmode toggle
const themeButton = document.querySelector("#darkmode") as HTMLButtonElement
themeButton.addEventListener("click", switchTheme)
window.addCleanup(() => themeButton.removeEventListener("click", switchTheme))

if (themeButton) {
themeButton.addEventListener("click", switchTheme)
window.addCleanup(() => themeButton.removeEventListener("click", switchTheme))
}
// Listen for changes in prefers-color-scheme
const colorSchemeMediaQuery = window.matchMedia("(prefers-color-scheme: dark)")
colorSchemeMediaQuery.addEventListener("change", themeChange)
Expand Down
2 changes: 1 addition & 1 deletion quartz/components/styles/contentMeta.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
color: var(--gray);

&[show-comma="true"] {
> span:not(:last-child) {
> *:not(:last-child) {
margin-right: 8px;

&::after {
Expand Down
2 changes: 2 additions & 0 deletions quartz/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import uk from "./locales/uk-UA"
import ru from "./locales/ru-RU"
import ko from "./locales/ko-KR"
import zh from "./locales/zh-CN"
import zhTw from "./locales/zh-TW"
import vi from "./locales/vi-VN"
import pt from "./locales/pt-BR"
import hu from "./locales/hu-HU"
Expand Down Expand Up @@ -59,6 +60,7 @@ export const TRANSLATIONS = {
"ru-RU": ru,
"ko-KR": ko,
"zh-CN": zh,
"zh-TW": zhTw,
"vi-VN": vi,
"pt-BR": pt,
"hu-HU": hu,
Expand Down
82 changes: 82 additions & 0 deletions quartz/i18n/locales/zh-TW.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import { Translation } from "./definition"

export default {
propertyDefaults: {
title: "無題",
description: "無描述",
},
components: {
callout: {
note: "筆記",
abstract: "摘要",
info: "提示",
todo: "待辦",
tip: "提示",
success: "成功",
question: "問題",
warning: "警告",
failure: "失敗",
danger: "危險",
bug: "錯誤",
example: "範例",
quote: "引用",
},
backlinks: {
title: "反向連結",
noBacklinksFound: "無法找到反向連結",
},
themeToggle: {
lightMode: "亮色模式",
darkMode: "暗色模式",
},
explorer: {
title: "探索",
},
footer: {
createdWith: "Created with",
},
graph: {
title: "關係圖譜",
},
recentNotes: {
title: "最近的筆記",
seeRemainingMore: ({ remaining }) => `查看更多 ${remaining} 篇筆記 →`,
},
transcludes: {
transcludeOf: ({ targetSlug }) => `包含 ${targetSlug}`,
linkToOriginal: "指向原始筆記的連結",
},
search: {
title: "搜尋",
searchBarPlaceholder: "搜尋些什麼",
},
tableOfContents: {
title: "目錄",
},
contentMeta: {
readingTime: ({ minutes }) => `閱讀時間約 ${minutes} 分鐘`,
},
},
pages: {
rss: {
recentNotes: "最近的筆記",
lastFewNotes: ({ count }) => `最近的 ${count} 條筆記`,
},
error: {
title: "無法找到",
notFound: "私人筆記或筆記不存在。",
home: "返回首頁",
},
folderContent: {
folder: "資料夾",
itemsUnderFolder: ({ count }) => `此資料夾下有 ${count} 條筆記。`,
},
tagContent: {
tag: "標籤",
tagIndex: "標籤索引",
itemsUnderTag: ({ count }) => `此標籤下有 ${count} 條筆記。`,
showingFirst: ({ count }) => `顯示前 ${count} 個標籤。`,
totalTags: ({ count }) => `總共有 ${count} 個標籤。`,
},
},
} as const satisfies Translation
2 changes: 1 addition & 1 deletion quartz/styles/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ a {
line-height: 1.4rem;

&:has(> img) {
background-color: none;
background-color: transparent;
border-radius: 0;
padding: 0;
}
Expand Down

0 comments on commit 957b8b0

Please sign in to comment.