From 188569aa91d688eccd057ab047a8c121d1dc43bf Mon Sep 17 00:00:00 2001 From: Elihuso Quigley Date: Thu, 4 Apr 2024 19:33:47 +0800 Subject: [PATCH 1/4] [R] Refactor exclude list --- data/comment-only.json | 3 --- data/exclude.json | 1 - data/hdata.json | 7 +++++++ scripts/build.ts | 12 ++++++++++-- 4 files changed, 17 insertions(+), 6 deletions(-) delete mode 100644 data/comment-only.json delete mode 100644 data/exclude.json create mode 100644 data/hdata.json diff --git a/data/comment-only.json b/data/comment-only.json deleted file mode 100644 index 450d397b..00000000 --- a/data/comment-only.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "tdor" -] \ No newline at end of file diff --git a/data/exclude.json b/data/exclude.json deleted file mode 100644 index 0637a088..00000000 --- a/data/exclude.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/data/hdata.json b/data/hdata.json new file mode 100644 index 00000000..dd05ece3 --- /dev/null +++ b/data/hdata.json @@ -0,0 +1,7 @@ +{ + "commentOnly": [ + "tdor" + ], + "exclude": [], + "notShowOnHome": [] +} \ No newline at end of file diff --git a/scripts/build.ts b/scripts/build.ts index e590e3ae..2b122b3a 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -27,8 +27,16 @@ const people = fs.readdirSync(peopleDir).map(person => ({ distPath: path.join(projectRoot, DIST_DIR, PEOPLE_DIR, person) })); -const commentOnlyList = JSON.parse(fs.readFileSync(path.join(projectRoot, DATA_DIR, "comment-only.json")).toString()) as String[]; -const excludeList = commentOnlyList.concat(JSON.parse(fs.readFileSync(path.join(projectRoot, DATA_DIR, 'exclude.json')).toString()) as String[]); +interface HData { + commentOnly: string[], + exclude: string[], + notShowOnHome: string[] +} + +const hdata = JSON.parse(fs.readFileSync(path.join(projectRoot, DATA_DIR, "hdata.json")).toString()) as HData; +const commentOnlyList = hdata.commentOnly; +const excludeList = hdata.exclude; +const notShowOnHomeList = hdata.notShowOnHome; interface PeopleMeta { id: string From 903bc812b663d69b12acef70aa1f98d1278ad11f Mon Sep 17 00:00:00 2001 From: Elihuso Quigley Date: Thu, 4 Apr 2024 19:47:23 +0800 Subject: [PATCH 2/4] [+] feature: entry won;t show on the homepage Feature requested by @Twinsherry --- scripts/build.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/build.ts b/scripts/build.ts index 2b122b3a..2b083a30 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -28,14 +28,14 @@ const people = fs.readdirSync(peopleDir).map(person => ({ })); interface HData { - commentOnly: string[], - exclude: string[], + commentOnly: string[] + exclude: string[] notShowOnHome: string[] } const hdata = JSON.parse(fs.readFileSync(path.join(projectRoot, DATA_DIR, "hdata.json")).toString()) as HData; const commentOnlyList = hdata.commentOnly; -const excludeList = hdata.exclude; +const excludeList = commentOnlyList.concat(hdata.exclude); const notShowOnHomeList = hdata.notShowOnHome; interface PeopleMeta { @@ -57,6 +57,7 @@ function buildPeopleInfoAndList() { // Compiled meta of list of people for the front page (contains keys id, name, profileUrl) const peopleList: PeopleMeta[] = []; + const peopleHomeList: PeopleMeta[] = []; // For each person for (const { dirname, srcPath, distPath } of people) { @@ -118,14 +119,19 @@ function buildPeopleInfoAndList() { } as PeopleMeta; // Add meta to people list - if (peopleList.filter(it => it.id == peopleMeta.id).length == 0) + if (peopleList.filter(it => it.id == peopleMeta.id).length == 0) { peopleList.push(peopleMeta); + if (!hdata.notShowOnHome.includes(peopleMeta.id)) + peopleHomeList.push(peopleMeta) + } } peopleList.sort((a, b) => b.sortKey.localeCompare(a.sortKey)) + peopleHomeList.sort((a, b) => b.sortKey.localeCompare(a.sortKey)) // Write people-list.json fs.writeFileSync(path.join(projectRoot, DIST_DIR, `people-list${lang}.json`), JSON.stringify(peopleList)); + fs.writeFileSync(path.join(projectRoot, DIST_DIR, `people-home-list${lang}.json`), JSON.stringify(peopleHomeList)); } } From 847cf56ee4dccfb7d9ca4aa3d0d5ac7712b94bed Mon Sep 17 00:00:00 2001 From: Elihuso Quigley Date: Thu, 4 Apr 2024 19:51:15 +0800 Subject: [PATCH 3/4] [F] typo --- scripts/build.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build.ts b/scripts/build.ts index 2b083a30..96d42afd 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -121,7 +121,7 @@ function buildPeopleInfoAndList() { // Add meta to people list if (peopleList.filter(it => it.id == peopleMeta.id).length == 0) { peopleList.push(peopleMeta); - if (!hdata.notShowOnHome.includes(peopleMeta.id)) + if (!notShowOnHomeList.includes(peopleMeta.id)) peopleHomeList.push(peopleMeta) } } From 9b6e2da9530cd0a42b928b7a57b23e78205e419b Mon Sep 17 00:00:00 2001 From: Elihuso Quigley Date: Thu, 4 Apr 2024 22:16:21 +0800 Subject: [PATCH 4/4] [F] Fix emoji (back) on ios & ipados requested by @Twinsherry --- scripts/build.ts | 4 ++-- scripts/icon.ts | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/build.ts b/scripts/build.ts index 96d42afd..a5cab8ee 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -8,7 +8,7 @@ import metadataParser from 'markdown-yaml-metadata-parser'; import { renderMdx } from "./mdx.js"; import moment from "moment"; -import { Icon } from "./icon.js"; +import { Icon, backSVG } from "./icon.js"; const PUBLIC_DIR = "public"; @@ -171,7 +171,7 @@ function handleFootnote(md: string) { // Replace footnote references with HTML superscript tags return md.replace(/\[\^(\d+)\](?::\s*(.*))?/g, (match, id, text) => text ? // Footnote definition - `
  • ${text}
  • ` : + `
  • ${text}${backSVG}
  • ` : // Footnote reference `${id}` ) diff --git a/scripts/icon.ts b/scripts/icon.ts index 8ddeaccc..a4f1f136 100644 --- a/scripts/icon.ts +++ b/scripts/icon.ts @@ -8,4 +8,6 @@ export const Icon = { Annotation: ``, TransFlag: ``, Pride: ``, -}; \ No newline at end of file +}; + +export const backSVG = ` ` \ No newline at end of file