add simple line break
This commit is contained in:
1 parent
4fb41de0f1
commit
e4e364ae2a
8 files changed
+122
-72
No files matched your search
Vendored
+3
-1
@@ -3,5 +3,7 @@
|
|||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true,
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
".env.*": "dotenv"
|
".env.*": "dotenv"
|
||||||
}
|
},
|
||||||
|
"whitespacepp.backColorWS": "",
|
||||||
|
"editor.tabSize": 4
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: ZhLevel Level 2
|
title: ZhLevel Level 2
|
||||||
date: 2020-03-23T00:00:00+07:00
|
date: 2020-03-23T01:00:00+07:00
|
||||||
tag:
|
tag:
|
||||||
- zhlevel
|
- zhlevel
|
||||||
---
|
---
|
||||||
|
|||||||
+25
-25
@@ -13,41 +13,41 @@ tag:
|
|||||||
|
|
||||||
### 千里之外(& 费玉清)
|
### 千里之外(& 费玉清)
|
||||||
|
|
||||||
作词:方文山
|
作词:方文山 \
|
||||||
作曲:周杰伦
|
作曲:周杰伦
|
||||||
|
|
||||||
(周)屋簷如悬崖 风铃如沧海 我等燕归来
|
(周)屋簷如悬崖 风铃如沧海 我等燕归来 \
|
||||||
时间被安排 演一场意外 妳悄然走开
|
时间被安排 演一场意外 妳悄然走开 \
|
||||||
故事在城外 浓雾散不开 看不清对白
|
故事在城外 浓雾散不开 看不清对白 \
|
||||||
妳听不出来 风声不存在 是我在感慨
|
妳听不出来 风声不存在 是我在感慨 \
|
||||||
梦醒来 是谁在窗台 把结局打开
|
梦醒来 是谁在窗台 把结局打开 \
|
||||||
那薄如蝉翼的未来 禁不起谁来拆
|
那薄如蝉翼的未来 禁不起谁来拆
|
||||||
|
|
||||||
(费)我送你离开 千里之外 你无声黑白
|
(费)我送你离开 千里之外 你无声黑白 \
|
||||||
沉默年代 或许不该 太遥远的相爱
|
沉默年代 或许不该 太遥远的相爱 \
|
||||||
我送妳离开 天涯之外 妳是否还在
|
我送妳离开 天涯之外 妳是否还在 \
|
||||||
琴声何来 生死难猜 用一生 去等待
|
琴声何来 生死难猜 用一生 去等待
|
||||||
|
|
||||||
(周)闻泪声入林 寻梨花白 只得一行青苔
|
(周)闻泪声入林 寻梨花白 只得一行青苔 \
|
||||||
天在山之外 雨落花台 我两鬓斑白
|
天在山之外 雨落花台 我两鬓斑白 \
|
||||||
闻泪声入林 寻梨花白 只得一行青苔
|
闻泪声入林 寻梨花白 只得一行青苔 \
|
||||||
天在山之外 雨落花台 我等妳来
|
天在山之外 雨落花台 我等妳来
|
||||||
|
|
||||||
更多更详尽歌词 在 ※ Mojim.com 魔镜歌词网
|
更多更详尽歌词 在 ※ Mojim.com 魔镜歌词网 \
|
||||||
(费)一身琉璃白 透明著尘埃 妳无瑕的爱
|
(费)一身琉璃白 透明著尘埃 妳无瑕的爱 \
|
||||||
妳从雨中来 诗化了悲哀 我淋湿现在
|
妳从雨中来 诗化了悲哀 我淋湿现在
|
||||||
|
|
||||||
(周)芙蓉水面采 船行影犹在 妳却不回来
|
(周)芙蓉水面采 船行影犹在 妳却不回来 \
|
||||||
被岁月覆蓋 妳说的花开 过去成空白
|
被岁月覆蓋 妳说的花开 过去成空白
|
||||||
|
|
||||||
(费)梦醒来 是谁在窗台 把结局打开
|
(费)梦醒来 是谁在窗台 把结局打开 \
|
||||||
(周)那薄如蝉翼的未来
|
(周)那薄如蝉翼的未来 \
|
||||||
(周)禁不起谁来拆
|
(周)禁不起谁来拆 \
|
||||||
(费)我送你离开 千里之外 你无声黑白 沉默年代 或许不该 太遥远的相爱
|
(费)我送你离开 千里之外 你无声黑白 沉默年代 或许不该 太遥远的相爱 \
|
||||||
(周)我送妳离开 天涯之外 妳是否还在 琴声何来 生死难猜 用一生
|
(周)我送妳离开 天涯之外 妳是否还在 琴声何来 生死难猜 用一生 \
|
||||||
(费)我送妳离开 千里之外 妳无声黑白 沉默年代 或许不该 太遥远的相爱
|
(费)我送妳离开 千里之外 妳无声黑白 沉默年代 或许不该 太遥远的相爱 \
|
||||||
(周)我送妳离开 天涯之外
|
(周)我送妳离开 天涯之外 \
|
||||||
(周)妳是否还在
|
(周)妳是否还在 \
|
||||||
(周)琴声何来
|
(周)琴声何来 \
|
||||||
(费)生死难猜
|
(费)生死难猜 \
|
||||||
(合)用一生去等待
|
(合)用一生去等待
|
||||||
+16
-16
@@ -13,31 +13,31 @@ tag:
|
|||||||
|
|
||||||
## 祝福
|
## 祝福
|
||||||
|
|
||||||
作词:丁晓雯
|
作词:丁晓雯 \
|
||||||
作曲:郭子
|
作曲:郭子 \
|
||||||
编曲:王豫民
|
编曲:王豫民 \
|
||||||
|
|
||||||
不要问 不要说 一切尽在不言中
|
不要问 不要说 一切尽在不言中 \
|
||||||
这一刻 偎著烛光 让我们静静的渡过
|
这一刻 偎著烛光 让我们静静的渡过 \
|
||||||
莫挥手 莫回头 当我唱起这首歌 怕只怕 泪水轻轻的滑落
|
莫挥手 莫回头 当我唱起这首歌 怕只怕 泪水轻轻的滑落 \
|
||||||
愿心中永远留着我的笑容 伴你走过每一个春夏秋冬
|
愿心中永远留着我的笑容 伴你走过每一个春夏秋冬
|
||||||
|
|
||||||
几许愁 几许忧 人生难免苦与痛
|
几许愁 几许忧 人生难免苦与痛 \
|
||||||
失去过 才能真正懂得去珍惜和拥有
|
失去过 才能真正懂得去珍惜和拥有 \
|
||||||
情难舍 人难留 今朝一别各西东 冷和热 点点滴滴在心头
|
情难舍 人难留 今朝一别各西东 冷和热 点点滴滴在心头 \
|
||||||
愿心中永远留着我的笑容 伴你走过每一个春夏秋冬
|
愿心中永远留着我的笑容 伴你走过每一个春夏秋冬
|
||||||
|
|
||||||
*伤离别 离别虽然在眼前 说再见 再见不会太遥远
|
*伤离别 离别虽然在眼前 说再见 再见不会太遥远 \
|
||||||
更多更详尽歌词
|
更多更详尽歌词 \
|
||||||
若有缘 有缘就能期待明天 你和我重逢在灿烂的季节
|
若有缘 有缘就能期待明天 你和我重逢在灿烂的季节
|
||||||
|
|
||||||
Repeat *
|
Repeat *
|
||||||
|
|
||||||
伤离别 离别虽然在眼前 说再见 再见不会太遥远
|
伤离别 离别虽然在眼前 说再见 再见不会太遥远 \
|
||||||
伤离别 离别虽然在眼前 说再见 再见不会太遥远
|
伤离别 离别虽然在眼前 说再见 再见不会太遥远 \
|
||||||
若有缘 有缘就能期待明天 你和我重逢在灿烂的季节
|
若有缘 有缘就能期待明天 你和我重逢在灿烂的季节
|
||||||
|
|
||||||
不要问 不要说 一切尽在不言中
|
不要问 不要说 一切尽在不言中 \
|
||||||
这一刻 偎著烛光 让我们静静的渡过
|
这一刻 偎著烛光 让我们静静的渡过 \
|
||||||
莫挥手 莫回头 当我唱起这首歌
|
莫挥手 莫回头 当我唱起这首歌 \
|
||||||
愿心中留着笑容 陪你度过每个春夏秋冬
|
愿心中留着笑容 陪你度过每个春夏秋冬
|
||||||
+10
-10
@@ -9,18 +9,18 @@ tag:
|
|||||||
|
|
||||||
<!-- excerpt -->
|
<!-- excerpt -->
|
||||||
|
|
||||||
黑黑的天空低垂
|
黑黑的天空低垂 \
|
||||||
亮亮的繁星相随
|
亮亮的繁星相随 \
|
||||||
虫儿飞 虫儿飞
|
虫儿飞 虫儿飞 \
|
||||||
你在思念谁
|
你在思念谁
|
||||||
|
|
||||||
天上的星星流泪
|
天上的星星流泪 \
|
||||||
地上的玫瑰枯萎
|
地上的玫瑰枯萎 \
|
||||||
冷风吹 冷风吹
|
冷风吹 冷风吹 \
|
||||||
只要有你陪
|
只要有你陪
|
||||||
|
|
||||||
虫儿飞 花儿睡
|
虫儿飞 花儿睡 \
|
||||||
一双又一对才美
|
一双又一对才美 \
|
||||||
不怕天黑 只怕心碎
|
不怕天黑 只怕心碎 \
|
||||||
不管累不累
|
不管累不累 \
|
||||||
也不管东南西北
|
也不管东南西北
|
||||||
@@ -22,10 +22,20 @@ export class MakeHTML {
|
|||||||
backslashEscapesHTMLTags: true,
|
backslashEscapesHTMLTags: true,
|
||||||
emoji: true,
|
emoji: true,
|
||||||
underline: true,
|
underline: true,
|
||||||
|
disableForced4SpacesIndentedSublists: true,
|
||||||
metadata: true,
|
metadata: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
this.mdConverter.addExtension(
|
||||||
|
{
|
||||||
|
type: 'lang',
|
||||||
|
regex: /\\\n/g,
|
||||||
|
replace: '<br />',
|
||||||
|
},
|
||||||
|
'commonmark-simple-linebreak'
|
||||||
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ! For some reasons default underscore italic fails to render...
|
* ! For some reasons default underscore italic fails to render...
|
||||||
*/
|
*/
|
||||||
|
|||||||
+53
-17
@@ -47,7 +47,7 @@ export class Database {
|
|||||||
priority INT,
|
priority INT,
|
||||||
-- q.title
|
-- q.title
|
||||||
[image] TEXT,
|
[image] TEXT,
|
||||||
-- q.tag.split(/ /g)
|
-- m2o files_tag
|
||||||
-- q.category
|
-- q.category
|
||||||
-- q.content
|
-- q.content
|
||||||
excerptHtml TEXT NOT NULL,
|
excerptHtml TEXT NOT NULL,
|
||||||
@@ -58,6 +58,12 @@ export class Database {
|
|||||||
CREATE INDEX IF NOT EXISTS files_createdAt ON files(createdAt);
|
CREATE INDEX IF NOT EXISTS files_createdAt ON files(createdAt);
|
||||||
CREATE INDEX IF NOT EXISTS files_updatedAt ON files(updatedAt);
|
CREATE INDEX IF NOT EXISTS files_updatedAt ON files(updatedAt);
|
||||||
CREATE INDEX IF NOT EXISTS files_priority ON files(priority);
|
CREATE INDEX IF NOT EXISTS files_priority ON files(priority);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS files_tag (
|
||||||
|
[path] TEXT NOT NULL,
|
||||||
|
tag TEXT NOT NULL,
|
||||||
|
PRIMARY KEY ([path], tag)
|
||||||
|
);
|
||||||
`)
|
`)
|
||||||
|
|
||||||
this.db.exec(/* sql */ `
|
this.db.exec(/* sql */ `
|
||||||
@@ -77,6 +83,11 @@ export class Database {
|
|||||||
VALUES (@path, @date, @createdAt, @updatedAt, @priority, @image, @excerptHtml, @contentHtml)
|
VALUES (@path, @date, @createdAt, @updatedAt, @priority, @image, @excerptHtml, @contentHtml)
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
const ftStmt = this.db.prepare(/* sql */ `
|
||||||
|
INSERT INTO files_tag ([path], tag)
|
||||||
|
VALUES (@path, @tag)
|
||||||
|
`)
|
||||||
|
|
||||||
const qStmt = this.db.prepare(/* sql */ `
|
const qStmt = this.db.prepare(/* sql */ `
|
||||||
INSERT INTO q ([path], title, tag, category, content)
|
INSERT INTO q ([path], title, tag, category, content)
|
||||||
VALUES (@path, @title, @tag, @category, @content)
|
VALUES (@path, @title, @tag, @category, @content)
|
||||||
@@ -118,6 +129,15 @@ export class Database {
|
|||||||
content,
|
content,
|
||||||
tag: tag ? tag.join(' ') : undefined,
|
tag: tag ? tag.join(' ') : undefined,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (tag) {
|
||||||
|
Array.from(new Set(tag)).map((t) => {
|
||||||
|
ftStmt.run({
|
||||||
|
path,
|
||||||
|
tag: t,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})()
|
})()
|
||||||
}
|
}
|
||||||
@@ -130,12 +150,14 @@ export class Database {
|
|||||||
[date],
|
[date],
|
||||||
title,
|
title,
|
||||||
[image],
|
[image],
|
||||||
tag,
|
GROUP_CONCAT(ft.tag, ' ') tag,
|
||||||
category,
|
category,
|
||||||
contentHtml content
|
contentHtml content
|
||||||
FROM files f
|
FROM files f
|
||||||
JOIN q ON q.path = f.path
|
JOIN q ON q.path = f.path
|
||||||
|
LEFT JOIN files_tag ft ON ft.path = f.path
|
||||||
WHERE f.path = @id
|
WHERE f.path = @id
|
||||||
|
GROUP BY f.path
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
.get({ id })
|
.get({ id })
|
||||||
@@ -163,6 +185,7 @@ export class Database {
|
|||||||
opts: {
|
opts: {
|
||||||
offset: number
|
offset: number
|
||||||
limit: number
|
limit: number
|
||||||
|
tag?: string
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
return this._search(q, {
|
return this._search(q, {
|
||||||
@@ -171,17 +194,11 @@ export class Database {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
public by(
|
public by(opts: { tag?: string; offset: number; limit: number }) {
|
||||||
q: string,
|
return this._search('', {
|
||||||
opts: {
|
|
||||||
offset: number
|
|
||||||
limit: number
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
return this._search(q, {
|
|
||||||
...opts,
|
...opts,
|
||||||
orderedBy: 'priority DESC, [date] DESC, createdAt DESC, updatedAt DESC',
|
orderedBy: 'priority DESC, [date] DESC, createdAt DESC, updatedAt DESC',
|
||||||
where: '[date] IS NOT NULL',
|
where: ['[date] IS NOT NULL'],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,15 +208,36 @@ export class Database {
|
|||||||
offset: number
|
offset: number
|
||||||
limit: number
|
limit: number
|
||||||
orderedBy: string
|
orderedBy: string
|
||||||
where?: string
|
tag?: string
|
||||||
|
where?: string[]
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
|
const $where: string[] = []
|
||||||
|
if (q) {
|
||||||
|
$where.push('q = @q')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opts.tag) {
|
||||||
|
$where.push('ft.tag = @tag')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opts.where) {
|
||||||
|
$where.push(...opts.where)
|
||||||
|
}
|
||||||
|
|
||||||
const fromSegment = /* sql */ `
|
const fromSegment = /* sql */ `
|
||||||
FROM files f
|
FROM files f
|
||||||
JOIN q ON q.path = f.path
|
JOIN q ON q.path = f.path
|
||||||
WHERE ${q ? `q = @q` : 'TRUE'} ${opts.where ? `AND ${opts.where}` : ''}
|
${opts.tag ? `LEFT JOIN files_tag ft ON ft.path = f.path` : ''}
|
||||||
|
WHERE ${$where.join(' AND ') || 'TRUE'}
|
||||||
|
${opts.tag ? 'GROUP BY f.path' : ''}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
const cond = {
|
||||||
|
q,
|
||||||
|
tag: opts.tag,
|
||||||
|
}
|
||||||
|
|
||||||
const count =
|
const count =
|
||||||
this.db
|
this.db
|
||||||
.prepare(
|
.prepare(
|
||||||
@@ -208,7 +246,7 @@ export class Database {
|
|||||||
${fromSegment}
|
${fromSegment}
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
.get({ q })?.count || 0
|
.get(cond)?.count || 0
|
||||||
|
|
||||||
const result = this.db
|
const result = this.db
|
||||||
.prepare(
|
.prepare(
|
||||||
@@ -218,7 +256,6 @@ export class Database {
|
|||||||
[date],
|
[date],
|
||||||
title,
|
title,
|
||||||
[image],
|
[image],
|
||||||
tag,
|
|
||||||
category,
|
category,
|
||||||
excerptHtml excerpt
|
excerptHtml excerpt
|
||||||
${fromSegment}
|
${fromSegment}
|
||||||
@@ -226,12 +263,11 @@ export class Database {
|
|||||||
LIMIT ${opts.limit} OFFSET ${opts.offset}
|
LIMIT ${opts.limit} OFFSET ${opts.offset}
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
.all({ q }) as {
|
.all(cond) as {
|
||||||
path: string
|
path: string
|
||||||
date?: Date
|
date?: Date
|
||||||
title: string
|
title: string
|
||||||
image?: string
|
image?: string
|
||||||
tag?: string[]
|
|
||||||
category?: string
|
category?: string
|
||||||
excerpt: string
|
excerpt: string
|
||||||
}[]
|
}[]
|
||||||
|
|||||||
@@ -42,18 +42,20 @@ app.get('/q', (req, res) => {
|
|||||||
|
|
||||||
if (q) {
|
if (q) {
|
||||||
res.json(
|
res.json(
|
||||||
db.q(`${q} ${tag ? `tag:${tag}` : ''}`, {
|
db.q(q, {
|
||||||
offset,
|
offset,
|
||||||
limit: perPage,
|
limit: perPage,
|
||||||
|
tag,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
res.json(
|
res.json(
|
||||||
db.by(tag ? `tag:${tag}` : '', {
|
db.by({
|
||||||
offset,
|
offset,
|
||||||
limit: perPage,
|
limit: perPage,
|
||||||
|
tag,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in new issue
Block a user