mirror of
https://github.com/severian-dev/sucker.severian.dev.git
synced 2025-10-28 04:35:45 +00:00
chore: sigh
This commit is contained in:
@@ -39,25 +39,32 @@ interface PersonaMatch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function findTagsBetween(content: string, startMarker: string, endMarker: string): PersonaMatch[] {
|
function findTagsBetween(content: string, startMarker: string, endMarker: string): PersonaMatch[] {
|
||||||
const startIdx = content.indexOf(`<${startMarker}>`);
|
const startMarkerTag = `<${startMarker}>`;
|
||||||
|
const endMarkerTag = `<${endMarker}>`;
|
||||||
|
|
||||||
|
const startIdx = content.indexOf(startMarkerTag);
|
||||||
if (startIdx === -1) return [];
|
if (startIdx === -1) return [];
|
||||||
|
|
||||||
const endIdx = content.indexOf(`<${endMarker}>`);
|
const endIdx = content.indexOf(endMarkerTag);
|
||||||
if (endIdx === -1) return [];
|
if (endIdx === -1) return [];
|
||||||
|
|
||||||
const section = content.slice(startIdx + startMarker.length + 2, endIdx);
|
const section = content.slice(startIdx, endIdx);
|
||||||
|
console.log("Section found:", section);
|
||||||
|
|
||||||
const matches: PersonaMatch[] = [];
|
const matches: PersonaMatch[] = [];
|
||||||
|
|
||||||
const tagPattern = /<([^/>][^>]*)>([^]*?)<\/\1>/g;
|
const tagPattern = /<([^/>\s][^>]*)>([^]*?)<\/\1>/g;
|
||||||
let match;
|
let match;
|
||||||
|
|
||||||
while ((match = tagPattern.exec(section)) !== null) {
|
while ((match = tagPattern.exec(section)) !== null) {
|
||||||
|
console.log("Found match:", match[1], match[2].substring(0, 50) + "...");
|
||||||
matches.push({
|
matches.push({
|
||||||
tag: match[1],
|
tag: match[1].trim(),
|
||||||
content: match[2].trim()
|
content: match[2].trim()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("Total matches found:", matches.length);
|
||||||
return matches;
|
return matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user