换行符

This commit is contained in:
辉鸭蛋
2024-10-11 02:48:18 +08:00
parent 7c0fb6be73
commit 7801ca2014
3 changed files with 18 additions and 14 deletions

View File

@@ -9,6 +9,10 @@ function calculateSHA1(filePath) {
return hashSum.digest('hex'); return hashSum.digest('hex');
} }
function convertNewlines(text) {
return text.replace(/\\n/g, '\n');
}
function extractInfoFromCombatFile(filePath) { function extractInfoFromCombatFile(filePath) {
const content = fs.readFileSync(filePath, 'utf8'); const content = fs.readFileSync(filePath, 'utf8');
const authorMatch = content.match(/\/\/\s*作者:(.*)/); const authorMatch = content.match(/\/\/\s*作者:(.*)/);
@@ -21,7 +25,7 @@ function extractInfoFromCombatFile(filePath) {
return { return {
author: authorMatch ? authorMatch[1].trim() : '', author: authorMatch ? authorMatch[1].trim() : '',
description: descriptionMatch ? descriptionMatch[1].trim() : '', description: descriptionMatch ? convertNewlines(descriptionMatch[1].trim()) : '',
tags: tags tags: tags
}; };
} }
@@ -34,7 +38,7 @@ function extractInfoFromJSFolder(folderPath) {
const manifest = JSON.parse(manifestContent); const manifest = JSON.parse(manifestContent);
return { return {
version: manifest.version || '', version: manifest.version || '',
description: manifest.description || '', description: convertNewlines(manifest.description || ''),
author: manifest.authors && manifest.authors.length > 0 ? manifest.authors[0].name : '', author: manifest.authors && manifest.authors.length > 0 ? manifest.authors[0].name : '',
tags: [] tags: []
}; };
@@ -51,7 +55,7 @@ function extractInfoFromPathingFile(filePath, parentFolders) {
const content = JSON.parse(fs.readFileSync(filePath, 'utf8')); const content = JSON.parse(fs.readFileSync(filePath, 'utf8'));
return { return {
author: content.info && content.info.author ? content.info.author : '', author: content.info && content.info.author ? content.info.author : '',
description: '', description: convertNewlines(content.info && content.info.description ? content.info.description : ''),
tags: parentFolders.slice(2) // 从第三个元素开始,跳过 'pathing' 和下一级目录 tags: parentFolders.slice(2) // 从第三个元素开始,跳过 'pathing' 和下一级目录
}; };
} }
@@ -73,7 +77,7 @@ function extractInfoFromTCGFile(filePath, parentFolder) {
return { return {
author: authorMatch ? authorMatch[1].trim() : '', author: authorMatch ? authorMatch[1].trim() : '',
description: descriptionMatch ? descriptionMatch[1].trim() : '', description: descriptionMatch ? convertNewlines(descriptionMatch[1].trim()) : '',
tags: [...new Set(tags)] // 去重 tags: [...new Set(tags)] // 去重
}; };
} }

View File

@@ -273,7 +273,7 @@
"hash": "c60bd5e36c893a00761879c5936b502fb3a30911", "hash": "c60bd5e36c893a00761879c5936b502fb3a30911",
"version": "c60bd5e", "version": "c60bd5e",
"author": "柠檬茶叶", "author": "柠檬茶叶",
"description": "", "description": "幽光星星",
"tags": [ "tags": [
"幽光星星" "幽光星星"
] ]
@@ -284,7 +284,7 @@
"hash": "d30275ba2734afbadf3aa38555146755b50fe352", "hash": "d30275ba2734afbadf3aa38555146755b50fe352",
"version": "d30275b", "version": "d30275b",
"author": "柠檬茶叶", "author": "柠檬茶叶",
"description": "", "description": "幽光星星",
"tags": [ "tags": [
"幽光星星" "幽光星星"
] ]
@@ -295,7 +295,7 @@
"hash": "d7e30fa180404d7850f5c7b7badfc5d4a81ff5bc", "hash": "d7e30fa180404d7850f5c7b7badfc5d4a81ff5bc",
"version": "d7e30fa", "version": "d7e30fa",
"author": "柠檬茶叶", "author": "柠檬茶叶",
"description": "", "description": "幽光星星",
"tags": [ "tags": [
"幽光星星" "幽光星星"
] ]
@@ -306,7 +306,7 @@
"hash": "16c22741f88ab173f37623182029a03895c36476", "hash": "16c22741f88ab173f37623182029a03895c36476",
"version": "16c2274", "version": "16c2274",
"author": "柠檬茶叶", "author": "柠檬茶叶",
"description": "", "description": "幽光星星",
"tags": [ "tags": [
"幽光星星" "幽光星星"
] ]
@@ -317,7 +317,7 @@
"hash": "7fc8c1999ac223f9387cf44026591bfc34c7b951", "hash": "7fc8c1999ac223f9387cf44026591bfc34c7b951",
"version": "7fc8c19", "version": "7fc8c19",
"author": "柠檬茶叶", "author": "柠檬茶叶",
"description": "", "description": "幽光星星",
"tags": [ "tags": [
"幽光星星" "幽光星星"
] ]
@@ -2536,10 +2536,10 @@
{ {
"name": "2.宵宫队[请看文件内说明].txt", "name": "2.宵宫队[请看文件内说明].txt",
"type": "file", "type": "file",
"hash": "3ceb9838769c84a415f2897db80ad1b7d21ece1e", "hash": "33aa7c52e63e8bc45195d60af20f9aef721b20a5",
"version": "3ceb983", "version": "33aa7c5",
"author": "爱司基模人", "author": "爱司基模人",
"description": "推荐配队\\n钟离 (夜/行/班/云/万)四选二 宵宫\\n不推荐云堇万叶一起上\\n钟离 芙宁娜 琴/早柚/班尼特 宵宫\\n风奶带风套最好(金珀小鹿?金珀砂糖?金珀散兵?),其他奶凑合用/n", "description": "推荐配队\n钟离 (夜/行/班/云/万)四选二 宵宫\n不推荐云堇万叶一起上\n钟离 芙宁娜 琴/早柚/班尼特 宵宫\n风奶带风套最好(金珀小鹿?金珀砂糖?金珀散兵?),其他奶凑合用",
"tags": [ "tags": [
"钟离", "钟离",
"芙宁娜", "芙宁娜",
@@ -2712,7 +2712,7 @@
"hash": "2edd6804f44f208c9b19390d13e22d0a2b238576", "hash": "2edd6804f44f208c9b19390d13e22d0a2b238576",
"version": "2edd680", "version": "2edd680",
"author": "佚名", "author": "佚名",
"description": "推荐配队:\\n1钟离 夜班行云四选二 散兵\\n2钟离 珐露珊 四琴 散兵 琴不识别,四琴用不了 可以试试加个q收尾\\n3钟离 芙宁娜 四琴 散兵 琴不识别,四琴用不了\\n4莱依拉北斗 行秋 云珐夜班 散兵", "description": "推荐配队:\n1钟离 夜班行云四选二 散兵\n2钟离 珐露珊 四琴 散兵 琴不识别,四琴用不了 可以试试加个q收尾\n3钟离 芙宁娜 四琴 散兵 琴不识别,四琴用不了\n4莱依拉北斗 行秋 云珐夜班 散兵",
"tags": [ "tags": [
"钟离", "钟离",
"行秋", "行秋",

View File

@@ -1,5 +1,5 @@
// 作者:爱司基模人 // 作者:爱司基模人
// 描述:推荐配队\n钟离 (夜/行/班/云/万)四选二 宵宫\n不推荐云堇万叶一起上\n钟离 芙宁娜 琴/早柚/班尼特 宵宫\n风奶带风套最好(金珀小鹿?金珀砂糖?金珀散兵?),其他奶凑合用/n // 描述:推荐配队\n钟离 (夜/行/班/云/万)四选二 宵宫\n不推荐云堇万叶一起上\n钟离 芙宁娜 琴/早柚/班尼特 宵宫\n风奶带风套最好(金珀小鹿?金珀砂糖?金珀散兵?),其他奶凑合用
钟离 s(0.1),e(hold),wait(0.3),w(0.1) 钟离 s(0.1),e(hold),wait(0.3),w(0.1)