fix: mooth's bug, I like to call it

This commit is contained in:
Severian
2025-02-13 14:33:45 +08:00
parent 4686fc734e
commit 87cef3ac20
3 changed files with 15 additions and 8 deletions

View File

@@ -46,13 +46,19 @@ function findTagsBetween(content: string, startMarker: string, endMarker: string
if (endIdx === -1) return [];
const section = content.slice(startIdx + startMarker.length + 2, endIdx);
const tagRegex = /<([^/>]+)>([^<]+)<\/\1>/g;
const matches = Array.from(section.matchAll(tagRegex));
const matches: PersonaMatch[] = [];
return matches.map(match => ({
tag: match[1],
content: match[2].trim()
}));
const tagPattern = /<([^/>][^>]*)>([^]*?)<\/\1>/g;
let match;
while ((match = tagPattern.exec(section)) !== null) {
matches.push({
tag: match[1],
content: match[2].trim()
});
}
return matches;
}
function extractBetweenTags(content: string, tag: string): string {