文档部分基本完成,还需要完善生成目录

This commit is contained in:
:NoBody: committed 2026-04-25 16:42:37 +08:00
1 parent 578109c8de
commit 115fd47bae
108 files changed
+6202 -289

No files matched your search

+22 -21
View File
@@ -27,26 +27,27 @@ export class PFiles {
this.other_htmls.push(readFileSync(`${dir}/${file}`, "utf-8"));
break;
}
if ((file.endsWith(".md"))) {
const meta = new PFileMetadata(file);
const path = `${dir}/${file}`;
const content = readFileSync(path, "utf-8");
const pfile = new PFile(file, meta, content);
if (this.pcolumes.some((v) => v.name === meta.colume)) {
const volume = this.pcolumes.find((v) => v.name === meta.colume);
volume?.pfiles.push(pfile);
const meta = new PFileMetadata(file);
const path = `${dir}/${file}`;
const content = readFileSync(path, "utf-8");
const pfile = new PFile(file, meta, content);
if (this.pcolumes.some((v) => v.name === meta.colume)) {
const volume = this.pcolumes.find((v) => v.name === meta.colume);
volume?.pfiles.push(pfile);
//保证每个专栏内的文件按照index排序,每个专栏之间也按照index排序
volume?.pfiles.sort((a, b) => a.meta.index - b.meta.index);
this.pcolumes.sort((a, b) => a.index - b.index);
} else {
this.pcolumes.push(new PColume(meta.colume, [pfile]));
//保证每个专栏内的文件按照index排序,每个专栏之间也按照index排序
//保证每个专栏内的文件按照index排序,每个专栏之间也按照index排序
volume?.pfiles.sort((a, b) => a.meta.index - b.meta.index);
this.pcolumes.sort((a, b) => a.index - b.index);
} else {
this.pcolumes.push(new PColume(meta.colume, [pfile]));
//保证每个专栏内的文件按照index排序,每个专栏之间也按照index排序
this.pcolumes[this.pcolumes.length - 1].pfiles.sort((a, b) =>
a.meta.index - b.meta.index
);
this.pcolumes.sort((a, b) => a.index - b.index);
this.pcolumes[this.pcolumes.length - 1].pfiles.sort((a, b) =>
a.meta.index - b.meta.index
);
this.pcolumes.sort((a, b) => a.index - b.index);
}
}
}
}
@@ -60,7 +61,7 @@ export class PColume {
constructor(name: string, pfiles: Array<PFile>) {
this.name = name;
this.pfiles = pfiles;
this.index = pfiles[0].meta.index;
this.index = pfiles[0].meta.c_index;
}
}
@@ -80,11 +81,11 @@ export class PFileMetadata {
title: string;
index: number;
colume: string;
c_index: string;
c_index: number;
constructor(filename: string) {
let [c_index, colume, index, title] = filename.split("::");
title = title.replace(".md", "");
this.c_index = c_index;
this.c_index = parseInt(c_index);
this.title = title;
this.index = parseInt(index);
this.colume = colume;