mirror of
https://github.com/one-among-us/data.git
synced 2024-11-25 20:47:37 +08:00
[PR] Merge pull request #214 from LS-KR/main
[+] Detach people-list.json so that the homepage does not load specific entries
This commit is contained in:
commit
1f5e204b98
@ -1,3 +0,0 @@
|
|||||||
[
|
|
||||||
"tdor"
|
|
||||||
]
|
|
@ -1 +0,0 @@
|
|||||||
[]
|
|
7
data/hdata.json
Normal file
7
data/hdata.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"commentOnly": [
|
||||||
|
"tdor"
|
||||||
|
],
|
||||||
|
"exclude": [],
|
||||||
|
"notShowOnHome": []
|
||||||
|
}
|
@ -8,7 +8,7 @@ import metadataParser from 'markdown-yaml-metadata-parser';
|
|||||||
|
|
||||||
import { renderMdx } from "./mdx.js";
|
import { renderMdx } from "./mdx.js";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { Icon } from "./icon.js";
|
import { Icon, backSVG } from "./icon.js";
|
||||||
|
|
||||||
const PUBLIC_DIR = "public";
|
const PUBLIC_DIR = "public";
|
||||||
|
|
||||||
@ -27,8 +27,16 @@ const people = fs.readdirSync(peopleDir).map(person => ({
|
|||||||
distPath: path.join(projectRoot, DIST_DIR, PEOPLE_DIR, 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[];
|
interface HData {
|
||||||
const excludeList = commentOnlyList.concat(JSON.parse(fs.readFileSync(path.join(projectRoot, DATA_DIR, 'exclude.json')).toString()) as 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 = commentOnlyList.concat(hdata.exclude);
|
||||||
|
const notShowOnHomeList = hdata.notShowOnHome;
|
||||||
|
|
||||||
interface PeopleMeta {
|
interface PeopleMeta {
|
||||||
id: string
|
id: string
|
||||||
@ -49,6 +57,7 @@ function buildPeopleInfoAndList() {
|
|||||||
|
|
||||||
// Compiled meta of list of people for the front page (contains keys id, name, profileUrl)
|
// Compiled meta of list of people for the front page (contains keys id, name, profileUrl)
|
||||||
const peopleList: PeopleMeta[] = [];
|
const peopleList: PeopleMeta[] = [];
|
||||||
|
const peopleHomeList: PeopleMeta[] = [];
|
||||||
|
|
||||||
// For each person
|
// For each person
|
||||||
for (const { dirname, srcPath, distPath } of people) {
|
for (const { dirname, srcPath, distPath } of people) {
|
||||||
@ -110,14 +119,19 @@ function buildPeopleInfoAndList() {
|
|||||||
} as PeopleMeta;
|
} as PeopleMeta;
|
||||||
|
|
||||||
// Add meta to people list
|
// 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);
|
peopleList.push(peopleMeta);
|
||||||
|
if (!notShowOnHomeList.includes(peopleMeta.id))
|
||||||
|
peopleHomeList.push(peopleMeta)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
peopleList.sort((a, b) => b.sortKey.localeCompare(a.sortKey))
|
peopleList.sort((a, b) => b.sortKey.localeCompare(a.sortKey))
|
||||||
|
peopleHomeList.sort((a, b) => b.sortKey.localeCompare(a.sortKey))
|
||||||
|
|
||||||
// Write people-list.json
|
// 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-list${lang}.json`), JSON.stringify(peopleList));
|
||||||
|
fs.writeFileSync(path.join(projectRoot, DIST_DIR, `people-home-list${lang}.json`), JSON.stringify(peopleHomeList));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +171,7 @@ function handleFootnote(md: string) {
|
|||||||
// Replace footnote references with HTML superscript tags
|
// Replace footnote references with HTML superscript tags
|
||||||
return md.replace(/\[\^(\d+)\](?::\s*(.*))?/g, (match, id, text) => text ?
|
return md.replace(/\[\^(\d+)\](?::\s*(.*))?/g, (match, id, text) => text ?
|
||||||
// Footnote definition
|
// Footnote definition
|
||||||
`<li id="footnote-${id}">${text}<a href="#footnote-ref-${id}">↩</a></li>` :
|
`<li id="footnote-${id}">${text}<a href="#footnote-ref-${id}">${backSVG}</a></li>` :
|
||||||
// Footnote reference
|
// Footnote reference
|
||||||
`<sup><a href="#footnote-${id}" id="footnote-ref-${id}">${id}</a></sup>`
|
`<sup><a href="#footnote-${id}" id="footnote-ref-${id}">${id}</a></sup>`
|
||||||
)
|
)
|
||||||
|
@ -8,4 +8,6 @@ export const Icon = {
|
|||||||
Annotation: `<svg style="display: inline-block; overflow: visible !important; vertical-align: sub; fill: #865e3c; margin-right: 10px;" viewBox="0 0 20 20" version="1.1" width="16" height="16" aria-hidden="true"><path d="M12 15c.81 0 1.5-.3 2.11-.89c.59-.61.89-1.3.89-2.11c0-.81-.3-1.5-.89-2.11C13.5 9.3 12.81 9 12 9c-.81 0-1.5.3-2.11.89C9.3 10.5 9 11.19 9 12c0 .81.3 1.5.89 2.11c.61.59 1.3.89 2.11.89m0-13c2.75 0 5.1 1 7.05 2.95C21 6.9 22 9.25 22 12v1.45c0 1-.35 1.85-1 2.55c-.7.67-1.5 1-2.5 1c-1.2 0-2.19-.5-2.94-1.5c-1 1-2.18 1.5-3.56 1.5c-1.37 0-2.55-.5-3.54-1.46C7.5 14.55 7 13.38 7 12c0-1.37.5-2.55 1.46-3.54C9.45 7.5 10.63 7 12 7c1.38 0 2.55.5 3.54 1.46C16.5 9.45 17 10.63 17 12v1.45c0 .41.16.77.46 1.08c.3.31.65.47 1.04.47c.42 0 .77-.16 1.07-.47c.3-.31.43-.67.43-1.08V12c0-2.19-.77-4.07-2.35-5.65S14.19 4 12 4c-2.19 0-4.07.77-5.65 2.35S4 9.81 4 12c0 2.19.77 4.07 2.35 5.65S9.81 20 12 20h5v2h-5c-2.75 0-5.1-1-7.05-2.95C3 17.1 2 14.75 2 12s1-5.1 2.95-7.05C6.9 3 9.25 2 12 2"/></svg>`,
|
Annotation: `<svg style="display: inline-block; overflow: visible !important; vertical-align: sub; fill: #865e3c; margin-right: 10px;" viewBox="0 0 20 20" version="1.1" width="16" height="16" aria-hidden="true"><path d="M12 15c.81 0 1.5-.3 2.11-.89c.59-.61.89-1.3.89-2.11c0-.81-.3-1.5-.89-2.11C13.5 9.3 12.81 9 12 9c-.81 0-1.5.3-2.11.89C9.3 10.5 9 11.19 9 12c0 .81.3 1.5.89 2.11c.61.59 1.3.89 2.11.89m0-13c2.75 0 5.1 1 7.05 2.95C21 6.9 22 9.25 22 12v1.45c0 1-.35 1.85-1 2.55c-.7.67-1.5 1-2.5 1c-1.2 0-2.19-.5-2.94-1.5c-1 1-2.18 1.5-3.56 1.5c-1.37 0-2.55-.5-3.54-1.46C7.5 14.55 7 13.38 7 12c0-1.37.5-2.55 1.46-3.54C9.45 7.5 10.63 7 12 7c1.38 0 2.55.5 3.54 1.46C16.5 9.45 17 10.63 17 12v1.45c0 .41.16.77.46 1.08c.3.31.65.47 1.04.47c.42 0 .77-.16 1.07-.47c.3-.31.43-.67.43-1.08V12c0-2.19-.77-4.07-2.35-5.65S14.19 4 12 4c-2.19 0-4.07.77-5.65 2.35S4 9.81 4 12c0 2.19.77 4.07 2.35 5.65S9.81 20 12 20h5v2h-5c-2.75 0-5.1-1-7.05-2.95C3 17.1 2 14.75 2 12s1-5.1 2.95-7.05C6.9 3 9.25 2 12 2"/></svg>`,
|
||||||
TransFlag: `<svg style="display: inline-block; overflow: visible !important; vertical-align: sub; margin-right: 10px;" viewBox="0 0 32 32" width="16" height="16" aria-hidden="true"><path fill="#5BCEFA" d="M0 27c0 2.209 1.791 4 4 4h28c2.209 0 4-1.791 4-4v-1.3H0V27z"/><path fill="#F5A9B8" d="M.026 20.5L0 25.8h36v-5.3z"/><path fill="#EEE" d="M0 15.3h36v5.3H0z"/><path fill="#F5A9B8" d="M0 9.902h36V15.4H0z"/><path fill="#5BCEFA" d="M36 9c0-2.209-1.791-4-4-4H4C1.791 5 0 6.791 0 9v1.2h36V9z"/></svg>`,
|
TransFlag: `<svg style="display: inline-block; overflow: visible !important; vertical-align: sub; margin-right: 10px;" viewBox="0 0 32 32" width="16" height="16" aria-hidden="true"><path fill="#5BCEFA" d="M0 27c0 2.209 1.791 4 4 4h28c2.209 0 4-1.791 4-4v-1.3H0V27z"/><path fill="#F5A9B8" d="M.026 20.5L0 25.8h36v-5.3z"/><path fill="#EEE" d="M0 15.3h36v5.3H0z"/><path fill="#F5A9B8" d="M0 9.902h36V15.4H0z"/><path fill="#5BCEFA" d="M36 9c0-2.209-1.791-4-4-4H4C1.791 5 0 6.791 0 9v1.2h36V9z"/></svg>`,
|
||||||
Pride: `<svg style="display: inline-block; overflow: visible !important; vertical-align: sub; margin-right: 10px;" viewBox="0 0 32 32" width="16" height="16" aria-hidden="true"><path fill="#880082" d="M0 27a4 4 0 0 0 4 4h28a4 4 0 0 0 4-4v-.5H0v.5z"/><path fill="#3558A0" d="M0 22.07h36v4.6H0z"/><path fill="#138F3E" d="M0 17.83h36v4.5H0z"/><path fill="#FAD220" d="M0 13.5h36V18H0z"/><path fill="#FF7300" d="M0 9.17h36v4.5H0z"/><path fill="#FF000E" d="M32 5H4a4 4 0 0 0-4 4v.33h36V9a4 4 0 0 0-4-4z"/></svg>`,
|
Pride: `<svg style="display: inline-block; overflow: visible !important; vertical-align: sub; margin-right: 10px;" viewBox="0 0 32 32" width="16" height="16" aria-hidden="true"><path fill="#880082" d="M0 27a4 4 0 0 0 4 4h28a4 4 0 0 0 4-4v-.5H0v.5z"/><path fill="#3558A0" d="M0 22.07h36v4.6H0z"/><path fill="#138F3E" d="M0 17.83h36v4.5H0z"/><path fill="#FAD220" d="M0 13.5h36V18H0z"/><path fill="#FF7300" d="M0 9.17h36v4.5H0z"/><path fill="#FF000E" d="M32 5H4a4 4 0 0 0-4 4v.33h36V9a4 4 0 0 0-4-4z"/></svg>`,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const backSVG = `<svg width="16" height="16"viewBox="0 0 16 16" version="1.1" id="svg1" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"> <defs id="defs1" /> <path style="opacity:1;fill:#fff9f9;fill-opacity:0.0199483;stroke:#ff8373;stroke-width:0.839;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers" d="m 10,4.0031 c 0,0 4.003714,0.3021906 4.001025,4.1458036 C 13.998336,11.992517 10,12.004973 10,12.004973 l -8,-0.0267" id="path1" /> <path style="opacity:1;fill:#fff9f9;fill-opacity:0.0199483;stroke:#ff8373;stroke-width:0.839;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers" d="M 3.3112984,10.696288 2,11.978273 3.2812828,13.265655" id="path2" /></svg>`
|
Loading…
Reference in New Issue
Block a user