Skip to content

Commit

Permalink
🎨
Browse files Browse the repository at this point in the history
  • Loading branch information
nanarino committed Jan 10, 2025
1 parent 3bb0f34 commit bc00573
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/markdown/img.astro
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const props = Astro.props
ondragstart="return false"
onerror={`
this.src='${unknow.src}';
this.parentElement.dataset.error=true;
this.parentElement.dataset.error='';
this.onerror='return false'
`}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/menu/typography/image.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ style(lang='stylus').
.☘-image-footer-content
.☘-title(data-size=5)
| 标题标题标题标题标题标题标题标题标题标题标题
.☘-paragraph(data-ellipsis="1")
.☘-paragraph(data-ellipsis=1)
| 描述描述描述描述描述描述描述描述描述描述描述描述
.☘-image-footer-action
svg.☘-link(
Expand Down
2 changes: 1 addition & 1 deletion src/pages/menu/typography/paragraph.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ markdown中的空格另起一行即为 `<p>`

```pug
div(style={width: "20em"})
.☘-paragraph(data-has-indent data-ellipsis="5")
.☘-paragraph(data-has-indent data-ellipsis=5)
| 我欲因之梦吴越,一夜飞度镜湖月。 湖月照我影,送我至剡溪。
| 谢公宿处今尚在,渌水荡漾清猿啼。 脚著谢公屐,身登青云梯。
| 半壁见海日,空中闻天鸡。 千岩万转路不定,迷花倚石忽已暝。
Expand Down
8 changes: 6 additions & 2 deletions src/scripts/server/dataset.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
export default function (dataset: Record<string, any>) {
const attrs: Record<`data-${string}`, string> = {}
const attrs: Record<`data-${string}`, string | null> = {}
for (const [k, v] of Object.entries(dataset)) {
Reflect.set(attrs, `data-${k}`, `${v}`)
let unbv: string | null
if (v === true) unbv = ""
else if (v === false) unbv = null
else unbv = `${v ?? ""}`
Reflect.set(attrs, `data-${k}`, unbv)
}
return attrs
}

0 comments on commit bc00573

Please sign in to comment.