mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
move docs, remove katex
This commit is contained in:
1 parent
da6002278d
commit
c4a13f2e27
27 files changed
+190
-550
No files matched your search
+1
-40
@@ -21,7 +21,7 @@ export const builtinModel = [
|
||||
export const builtinHandler = [
|
||||
'home', 'problem', 'record', 'judge', 'user',
|
||||
'contest', 'training', 'discussion', 'manage', 'import',
|
||||
'misc', 'homework', 'domain', 'wiki',
|
||||
'misc', 'homework', 'domain',
|
||||
];
|
||||
|
||||
export const builtinScript = [
|
||||
@@ -212,42 +212,3 @@ export async function script(pending: string[], fail: string[], active: string[]
|
||||
active.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
export async function wiki(pending: string[], fail: string[]) {
|
||||
for (const i of pending) {
|
||||
const p = path.resolve(i, 'wiki');
|
||||
if (fs.existsSync(p) && fs.statSync(p).isDirectory() && !fail.includes(i)) {
|
||||
try {
|
||||
const categories = fs.readdirSync(p);
|
||||
for (const category of categories) {
|
||||
if (!fs.statSync(p).isDirectory()) return;
|
||||
const pages = fs.readdirSync(path.join(p, category));
|
||||
if (!global.Hydro.wiki[category]) global.Hydro.wiki[category] = {};
|
||||
for (const page of pages) {
|
||||
const c = fs.readFileSync(path.join(p, category, page)).toString().split('\n');
|
||||
const pagename = page.split('.')[0];
|
||||
global.Hydro.wiki[category][pagename] = [];
|
||||
let content = null;
|
||||
for (let j = 0; j < c.length; j++) {
|
||||
const line = c[j];
|
||||
if (line.startsWith('# ')) {
|
||||
if (content) global.Hydro.wiki[category][pagename].push(content);
|
||||
content = {};
|
||||
const t = line.split('# ')[1].split('|');
|
||||
[content.title, content.id] = t.map((q) => q.trim());
|
||||
content.content = '';
|
||||
} else {
|
||||
content.content = `${content.content}${line}\n`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(`Wiki init: ${i}`);
|
||||
} catch (e) {
|
||||
fail.push(i);
|
||||
console.error(`Wiki Load Fail: ${i}`);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user