Skip to content

Commit 3c8ac16

Browse files
committed
Fix {{#if_pure}} syntax issue where spaces and whitespace were not preserved as intended.
1 parent 8f72b9e commit 3c8ac16

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/ts/parser.svelte.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -1760,16 +1760,19 @@ function trimLines(p1:string){
17601760
}
17611761

17621762
function blockEndMatcher(p1:string,type:{type:blockMatch,type2?:string},matcherArg:matcherArg):string{
1763+
const p1Trimed = p1.trim()
17631764
switch(type.type){
17641765
case 'pure':
1765-
case 'parse-pure':
17661766
case 'pure-display':
17671767
case 'function':{
1768-
return p1
1768+
return p1Trimed
17691769
}
17701770
case 'parse':
17711771
case 'each':{
1772-
return trimLines(p1)
1772+
return trimLines(p1Trimed)
1773+
}
1774+
case 'parse-pure':{
1775+
return p1
17731776
}
17741777
default:{
17751778
return ''
@@ -1952,7 +1955,7 @@ export function risuChatParser(da:string, arg:{
19521955
}
19531956
blockNestType.delete(nested.length)
19541957
const dat2 = nested.shift()
1955-
const matchResult = blockEndMatcher(dat2.trim(), blockType, matcherObj)
1958+
const matchResult = blockEndMatcher(dat2, blockType, matcherObj)
19561959
if(blockType.type === 'each'){
19571960
const subind = blockType.type2.lastIndexOf(' ')
19581961
const sub = blockType.type2.substring(subind + 1)

0 commit comments

Comments
 (0)