[O] Use yaml instead of json5

pull/35/head
Hykilpikonna 2022-12-02 20:59:51 -05:00
parent 3bed21c666
commit bfd7065c0e
No known key found for this signature in database
GPG Key ID: 256CD01A41D7FA26
23 changed files with 74 additions and 117 deletions

View File

@ -19,7 +19,6 @@
"esbuild": "^0.15.14",
"fs-extra": "^10.1.0",
"js-yaml": "^4.1.0",
"json5": "^2.2.1",
"markdown-yaml-metadata-parser": "^3.0.0",
"ts-node": "^10.9.1",
"typescript": "^4.9.3",

View File

@ -1,11 +0,0 @@
{
id: 'GLaDOSister',
profileUrl: '${path}/photos/profile.jpg',
info: {
born: "1997-01-13",
died: "2019-12-03"
},
websites: [
['zhihu', 'https://www.zhihu.com/people/gmjyxx'],
],
}

View File

@ -0,0 +1,7 @@
id: GLaDOSister
profileUrl: ${path}/photos/profile.jpg
info:
born: '1997-01-13'
died: '2019-12-03'
websites:
zhihu: https://www.zhihu.com/people/gmjyxx

View File

@ -1,11 +0,0 @@
{
id: 'MioCardMeow',
profileUrl: '${path}/photos/profile.jpg',
info: {
born: "2005-04-02",
died: "2022-01-31"
},
websites: [
['twitter', 'https://twitter.com/MiocardMeow'],
],
}

View File

@ -0,0 +1,7 @@
id: MioCardMeow
profileUrl: ${path}/photos/profile.jpg
info:
born: '2005-04-02'
died: '2022-01-31'
websites:
twitter: https://twitter.com/MiocardMeow

View File

@ -1,11 +0,0 @@
{
id: 'MizuharaNagisa',
profileUrl: '${path}/photos/profile.png',
info: {
born: "2002-04-19",
died: "2021-07-21"
},
websites: [
['twitter', 'https://twitter.com/MizuharaNagisa'],
],
}

View File

@ -0,0 +1,7 @@
id: MizuharaNagisa
profileUrl: ${path}/photos/profile.png
info:
born: '2002-04-19'
died: '2021-07-21'
websites:
twitter: https://twitter.com/MizuharaNagisa

View File

@ -1,11 +0,0 @@
{
id: 'SevenBird',
profileUrl: '${path}/photos/profile.jpg',
info: {
born: "2005-02-26",
died: "2022-08-12"
},
websites: [
['twitter', 'https://twitter.com/Selrayer'],
],
}

View File

@ -0,0 +1,7 @@
id: SevenBird
profileUrl: ${path}/photos/profile.jpg
info:
born: '2005-02-26'
died: '2022-08-12'
websites:
twitter: https://twitter.com/Selrayer

View File

@ -1,12 +0,0 @@
{
id: 'Uekawakuyuurei',
profileUrl: '${path}/photos/profile.jpg',
info: {
born: "2000-12-04",
died: "2021-09-07"
},
websites: [
['twitter', 'https://twitter.com/Uekawakuyuurei'],
['telegram', 'https://t.me/joinchat/65vSQ6ELb3YxN2I9'],
],
}

View File

@ -0,0 +1,8 @@
id: Uekawakuyuurei
profileUrl: ${path}/photos/profile.jpg
info:
born: '2000-12-04'
died: '2021-09-07'
websites:
twitter: https://twitter.com/Uekawakuyuurei
telegram: https://t.me/joinchat/65vSQ6ELb3YxN2I9

View File

@ -1,11 +0,0 @@
{
id: 'donotexist_A',
profileUrl: '${path}/photos/profile.jpg',
info: {
born: "2002-05-07",
died: "2021-05-13"
},
websites: [
['twitter', 'https://twitter.com/donotexist_A'],
],
}

View File

@ -0,0 +1,7 @@
id: donotexist_A
profileUrl: ${path}/photos/profile.jpg
info:
born: '2002-05-07'
died: '2021-05-13'
websites:
twitter: https://twitter.com/donotexist_A

View File

@ -1,12 +0,0 @@
{
id: 'gaoyanger',
profileUrl: '${path}/photos/profile.jpg',
info: {
born: "2002-04-12",
died: "2020-08-27",
},
websites: [
['twitter', 'https://twitter.com/gaoyanger'],
['zhihu', 'https://www.zhihu.com/people/chen-ru-32-42'],
],
}

View File

@ -0,0 +1,8 @@
id: gaoyanger
profileUrl: ${path}/photos/profile.jpg
info:
born: '2002-04-12'
died: '2020-08-27'
websites:
twitter: https://twitter.com/gaoyanger
zhihu: https://www.zhihu.com/people/chen-ru-32-42

View File

@ -1,11 +0,0 @@
{
id: 'homoyamakaze',
profileUrl: '${path}/photos/profile.jpg',
info: {
born: "1999-11-03",
died: "2022-11-09"
},
websites: [
['twitter', 'https://twitter.com/homoyamakaze'],
],
}

View File

@ -0,0 +1,7 @@
id: homoyamakaze
profileUrl: ${path}/photos/profile.jpg
info:
born: '1999-11-03'
died: '2022-11-09'
websites:
twitter: https://twitter.com/homoyamakaze

View File

@ -1,11 +0,0 @@
{
id: 'lintong',
profileUrl: '${path}/photos/profile.jpg',
info: {
born: "2000.06.01",
died: "2022.06.06"
},
websites: [
['QQ', 'https://304915994.qzone.qq.com/'],
],
}

7
people/lintong/info.yml Normal file
View File

@ -0,0 +1,7 @@
id: lintong
profileUrl: ${path}/photos/profile.jpg
info:
born: 2000.06.01
died: 2022.06.06
websites:
QQ: https://304915994.qzone.qq.com/

View File

@ -1,7 +0,0 @@
{
id: 'noname',
profileUrl: '${path}/photos/profile.png',
websites: [
['one-among-us', 'https://one-among.us'],
],
}

4
people/noname/info.yml Normal file
View File

@ -0,0 +1,4 @@
id: noname
profileUrl: ${path}/photos/profile.png
websites:
one-among-us: https://one-among.us

View File

@ -2,7 +2,6 @@ import url from "url";
import path from "path";
import fs from "fs-extra";
import json5 from "json5";
import YAML from 'js-yaml';
import metadataParser from 'markdown-yaml-metadata-parser';
@ -40,8 +39,8 @@ function buildPeopleInfoAndList() {
// For each person
for (const { dirname, srcPath, distPath } of people) {
const infoFile = fs.readFileSync(path.join(srcPath, `info.json5`), "utf-8");
const info = json5.parse(infoFile);
const infoFile = fs.readFileSync(path.join(srcPath, `info.yml`), "utf-8");
const info = YAML.load(infoFile);
// Read the page.md of that language
const markdown = fs.readFileSync(path.join(srcPath, `page${lang}.md`), "utf-8");
@ -50,6 +49,9 @@ function buildPeopleInfoAndList() {
const mdMeta = metadataParser(markdown).metadata
info.name = mdMeta.name
// Convert website dict into entries [[k, v], ...]
info.websites = Object.entries(info.websites ?? {})
// Convert info dict to [[key, value], ...]
// And add info k-v pairs from markdown to the info object in json5
info.info = [...Object.entries(mdMeta.info ?? {}), ...Object.entries(info.info ?? {})]

View File

@ -670,11 +670,6 @@ js-yaml@^4.1.0:
dependencies:
argparse "^2.0.1"
json5@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c"
integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==
jsonfile@^6.0.1:
version "6.1.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"