Fix blockStartMatcher function to handle nested blocks

This commit is contained in:
kwaroran
2024-04-04 06:30:33 +09:00
parent 2a3f0830ce
commit 63657a9252

View File

@@ -977,7 +977,7 @@ type blockMatch = 'ignore'|'parse'|'nothing'|'parse-pure'
function blockStartMatcher(p1:string,matcherArg:matcherArg):blockMatch{
if(p1.startsWith('#if') || p1.startsWith('#if_pure ')){
const statement = p1.substring(p1.indexOf(' ') + 1)
const statement = p1.split(' ', 2)
const state = statement[1]
if(state === 'true' || state === '1'){
return p1.startsWith('#if_pure') ? 'parse-pure' : 'parse'
@@ -1109,6 +1109,7 @@ export function risuChatParser(da:string, arg:{
}
const matchResult = blockStartMatcher(dat, matcherObj)
if(matchResult === 'nothing'){
nested[0] += `{{${dat}}}`
break
}
else{