use express server
This commit is contained in:
1 parent
48cbaf1672
commit
a10e7faa17
7 files changed
+835
-10
No files matched your search
Generated
+744
File diff suppressed because it is too large.
Load diff
+11
-9
@@ -2,8 +2,10 @@
|
|||||||
"name": "zhdiary",
|
"name": "zhdiary",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "My journey through Chinese language",
|
"description": "My journey through Chinese language",
|
||||||
"main": "index.js",
|
"main": "server.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"express": "^4.17.1",
|
||||||
|
"husky": "^3.0.3",
|
||||||
"hyperscript": "^2.0.2",
|
"hyperscript": "^2.0.2",
|
||||||
"jstransformer-markdown-it": "^2.1.0",
|
"jstransformer-markdown-it": "^2.1.0",
|
||||||
"p-iteration": "^1.1.8",
|
"p-iteration": "^1.1.8",
|
||||||
@@ -12,17 +14,17 @@
|
|||||||
"webpack": "^4.39.1",
|
"webpack": "^4.39.1",
|
||||||
"webpack-merge": "^4.2.1"
|
"webpack-merge": "^4.2.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {},
|
||||||
"start": "cogear",
|
|
||||||
"build": "cogear build",
|
|
||||||
"deploy": "cogear build && cd public && surge",
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"author": "Pacharapol Withayasakpunt",
|
"author": "Pacharapol Withayasakpunt",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/patarapolw/zhdiary"
|
"url": "https://github.com/patarapolw/zhdiary.git"
|
||||||
},
|
},
|
||||||
"homepage": "https://zhdiary.surge.sh"
|
"homepage": "https://zhdiary.herokuapp.com",
|
||||||
|
"husky": {
|
||||||
|
"hooks": {
|
||||||
|
"pre-commit": "cogear build"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,7 @@ class Markdown {
|
|||||||
const rowRegex = /(?:(?:^|\r?\n)(?:\| )?(?:(?:.* \| )+.+)*(?:.* \| )+.+(?: \|)?(?:$|\r?\n))+/m;
|
const rowRegex = /(?:(?:^|\r?\n)(?:\| )?(?:(?:.* \| )+.+)*(?:.* \| )+.+(?: \|)?(?:$|\r?\n))+/m;
|
||||||
|
|
||||||
text = text.replace(rowRegex, (p0) => {
|
text = text.replace(rowRegex, (p0) => {
|
||||||
return h("table.table", p0.split("\n").map((pi) => {
|
return h("table.table", p0.trim().split("\n").map((pi) => {
|
||||||
pi = pi.trim().replace(/^|/, "").replace(/|$/, "")
|
pi = pi.trim().replace(/^|/, "").replace(/|$/, "")
|
||||||
|
|
||||||
return h("tr", pi.split(" | ").map((x) => x.trim()).map((qi) => {
|
return h("tr", pi.split(" | ").map((x) => x.trim()).map((qi) => {
|
||||||
@@ -36,6 +36,7 @@ class Markdown {
|
|||||||
const md = new Markdown();
|
const md = new Markdown();
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
Markdown,
|
||||||
apply() {
|
apply() {
|
||||||
cogear.on("preload.page.parse", (page) => {
|
cogear.on("preload.page.parse", (page) => {
|
||||||
if (page.format === ".pug") {
|
if (page.format === ".pug") {
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
const { Markdown } = require("./plugin");
|
||||||
|
|
||||||
|
const md = new Markdown();
|
||||||
|
console.log(md.md2html(`
|
||||||
|
a | b | c
|
||||||
|
d | e | f
|
||||||
|
`));
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
const express = require("express");
|
||||||
|
const app = express();
|
||||||
|
const port = process.env.PORT || 5000;
|
||||||
|
|
||||||
|
app.use(express.static("public"));
|
||||||
|
|
||||||
|
app.listen(port, () => {
|
||||||
|
console.log(`Server running at http://localhost:${port}`);
|
||||||
|
});
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
---
|
||||||
|
title: "千字文 - 4"
|
||||||
|
date: "2019-08-14"
|
||||||
|
tags:
|
||||||
|
- 千字文
|
||||||
|
- 汉字
|
||||||
|
---
|
||||||
|
|
||||||
|
.w-100.mt-3: h3.text-center 閏餘成歲,律呂調陽。
|
||||||
|
.w-100
|
||||||
|
figure.d-inline-block
|
||||||
|
.hanzi-img 閏
|
||||||
|
figcaption.text-center run4
|
||||||
|
figure.d-inline-block
|
||||||
|
img(src="https://www.mdbg.net/chinese/rsc/img/stroke_anim/39192.gif" height=100)
|
||||||
|
figcaption.text-center yu2
|
||||||
|
figure.d-inline-block
|
||||||
|
img(src="https://www.mdbg.net/chinese/rsc/img/stroke_anim/25104.gif" height=100)
|
||||||
|
figcaption.text-center cheng2
|
||||||
|
figure.d-inline-block
|
||||||
|
img(src="https://www.mdbg.net/chinese/rsc/img/stroke_anim/27506.gif" height=100)
|
||||||
|
figcaption.text-center sui4
|
||||||
|
.w-100
|
||||||
|
figure.d-inline-block
|
||||||
|
img(src="https://www.mdbg.net/chinese/rsc/img/stroke_anim/24459.gif" height=100)
|
||||||
|
figcaption.text-center lu:4
|
||||||
|
figure.d-inline-block
|
||||||
|
img(src="https://www.mdbg.net/chinese/rsc/img/stroke_anim/21570.gif" height=100)
|
||||||
|
figcaption.text-center lu:3
|
||||||
|
figure.d-inline-block
|
||||||
|
img(src="https://www.mdbg.net/chinese/rsc/img/stroke_anim/35519.gif" height=100)
|
||||||
|
figcaption.text-center diao4
|
||||||
|
figure.d-inline-block
|
||||||
|
img(src="https://www.mdbg.net/chinese/rsc/img/stroke_anim/38525.gif" height=100)
|
||||||
|
figcaption.text-center yang2
|
||||||
|
|
||||||
|
| ===
|
||||||
|
|
||||||
|
.w-100.mt-3
|
||||||
|
:markdown
|
||||||
|
闰年 | rùnnián | leap year / (lunar calendar) year with a thirteen intercalary month
|
||||||
|
闰月 | rùnyuè | intercalary month in the lunar calendar / leap month
|
||||||
|
敖闰 | Áorùn | Dragon King of the West Sea, Ao Run, also Ao Ji (敖吉)
|
||||||
|
余额 (餘額) | yú'é | balance (of an account, bill etc) / surplus / remainder
|
||||||
|
剩余 (剩餘) | shèngyú | remainder / surplus
|
||||||
|
其余 (其餘) | qíyú | the rest / the others / remaining / remainder / apart from them
|
||||||
|
业余 (業餘) | yèyú | in one's spare time / outside working hours / amateur (historian etc)
|
||||||
|
多余 (多餘) | duōyú | superfluous / unnecessary / surplus
|
||||||
|
岁月 (歲月) | suìyuè | years / time
|
||||||
|
周岁 (週歲) | zhōusuì | one full year (e.g. on child's first birthday)
|
||||||
|
万岁 (萬歲) | wànsuì | Long live (the king, the revolution etc)! / Your Majesty / His Majesty
|
||||||
|
岁时 (歲時) | suìshí | season / time of the year
|
||||||
|
贺岁 (賀歲) | hèsuì | to extend New Year's greetings / to pay a New Year's visit
|
||||||
|
法律 | fǎlǜ | law / CL: 條|条, 套, 個|个
|
||||||
|
律师 | lǜshī | lawyer
|
||||||
|
规律 | guīlǜ | rule (e.g. of science) / law of behavior / regular pattern / rhythm / discipline
|
||||||
|
纪律 | jìlǜ | discipline
|
||||||
|
style.
|
||||||
|
table td:first-child {
|
||||||
|
width: 10em;
|
||||||
|
}
|
||||||
Reference in new issue
Block a user