三级目录

This commit is contained in:
辉鸭蛋
2024-10-14 22:43:49 +08:00
parent 252bc48ee6
commit 081496493c
8 changed files with 149 additions and 140 deletions

View File

@@ -55,10 +55,14 @@ function extractInfoFromJSFolder(folderPath) {
function extractInfoFromPathingFile(filePath, parentFolders) {
const content = JSON.parse(fs.readFileSync(filePath, 'utf8'));
let tags = parentFolders.slice(2) // 从第三个元素开始,跳过 'pathing' 和下一级目录
.map(tag => tag.split('@')[0]) // 取@符号前面的数据
.filter((tag, index, self) => self.indexOf(tag) === index); // 去重
return {
author: content.info && content.info.author ? content.info.author : '',
description: convertNewlines(content.info && content.info.description ? content.info.description : ''),
tags: parentFolders.slice(2) // 从第三个元素开始,跳过 'pathing' 和下一级目录
tags: tags
};
}