le icons
This commit is contained in:
@@ -4,6 +4,7 @@ const { XMLParser } = require("fast-xml-parser");
|
||||
|
||||
const xmlAPIPath = path.join(__dirname, "../", "xml", "types")
|
||||
const mdAPIPath = path.join(__dirname, "../", "docs/api", "types")
|
||||
const iconDataPath = path.join(__dirname, "../", "docs/theme/.icons", "polytoria")
|
||||
const xmlEnumPath = path.join(__dirname, "../", "xml", "enums")
|
||||
const mdEnumPath = path.join(__dirname, "../", "docs/api", "enums")
|
||||
|
||||
@@ -29,16 +30,17 @@ const parser = new XMLParser();
|
||||
const xmlFiles = fs.readdirSync(xmlAPIPath).filter(file => file.endsWith('.xml'));
|
||||
|
||||
for (const xmlFile of xmlFiles) {
|
||||
const xmlPath = path.join(xmlAPIPath, xmlFile);
|
||||
const xmlContent = fs.readFileSync(xmlPath, "utf-8");
|
||||
const data = parser.parse(xmlContent);
|
||||
const xmlPath = path.join(xmlAPIPath, xmlFile)
|
||||
const xmlContent = fs.readFileSync(xmlPath, "utf-8")
|
||||
const data = parser.parse(xmlContent)
|
||||
|
||||
if (!data.ClassDef) continue;
|
||||
|
||||
const c = data.ClassDef;
|
||||
const className = path.basename(xmlFile, '.xml');
|
||||
const className = path.basename(xmlFile, '.xml')
|
||||
let mdPath = path.join(mdAPIPath, className + ".md")
|
||||
let mk = ""
|
||||
const iconPath = path.join(iconDataPath, c.Name + ".svg")
|
||||
|
||||
function appendLine(str) {
|
||||
mk += str + "\n"
|
||||
@@ -47,6 +49,11 @@ for (const xmlFile of xmlFiles) {
|
||||
appendLine("---")
|
||||
appendLine("title: " + c.Name)
|
||||
appendLine("description:")
|
||||
if (fs.existsSync(iconPath)) {
|
||||
appendLine("icon: polytoria/" + c.Name)
|
||||
} else {
|
||||
appendLine("icon: polytoria/Unknown")
|
||||
}
|
||||
appendLine("---")
|
||||
appendLine("")
|
||||
appendLine("# " + c.Name)
|
||||
|
||||
Reference in New Issue
Block a user