Fix {{#if_pure}} syntax issue where spaces and whitespace were not preserved as intended.

This commit is contained in:
Bo26fhmC5M
2024-12-02 13:04:56 +09:00
parent 8f72b9e6e2
commit 3c8ac16367

View File

@@ -1760,16 +1760,19 @@ function trimLines(p1:string){
}
function blockEndMatcher(p1:string,type:{type:blockMatch,type2?:string},matcherArg:matcherArg):string{
const p1Trimed = p1.trim()
switch(type.type){
case 'pure':
case 'parse-pure':
case 'pure-display':
case 'function':{
return p1
return p1Trimed
}
case 'parse':
case 'each':{
return trimLines(p1)
return trimLines(p1Trimed)
}
case 'parse-pure':{
return p1
}
default:{
return ''
@@ -1952,7 +1955,7 @@ export function risuChatParser(da:string, arg:{
}
blockNestType.delete(nested.length)
const dat2 = nested.shift()
const matchResult = blockEndMatcher(dat2.trim(), blockType, matcherObj)
const matchResult = blockEndMatcher(dat2, blockType, matcherObj)
if(blockType.type === 'each'){
const subind = blockType.type2.lastIndexOf(' ')
const sub = blockType.type2.substring(subind + 1)