Add pure-display
This commit is contained in:
@@ -1669,7 +1669,7 @@ const legacyBlockMatcher = (p1:string,matcherArg:matcherArg) => {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
type blockMatch = 'ignore'|'parse'|'nothing'|'parse-pure'|'pure'|'each'|'function'
|
type blockMatch = 'ignore'|'parse'|'nothing'|'parse-pure'|'pure'|'each'|'function'|'pure-display'
|
||||||
|
|
||||||
function parseArray(p1:string):string[]{
|
function parseArray(p1:string):string[]{
|
||||||
try {
|
try {
|
||||||
@@ -1712,6 +1712,9 @@ function blockStartMatcher(p1:string,matcherArg:matcherArg):{type:blockMatch,typ
|
|||||||
if(p1 === '#pure'){
|
if(p1 === '#pure'){
|
||||||
return {type:'pure'}
|
return {type:'pure'}
|
||||||
}
|
}
|
||||||
|
if(p1 === '#pure_display' || p1 === '#puredisplay'){
|
||||||
|
return {type:'pure-display'}
|
||||||
|
}
|
||||||
if(p1.startsWith('#each')){
|
if(p1.startsWith('#each')){
|
||||||
return {type:'each',type2:p1.substring(5).trim()}
|
return {type:'each',type2:p1.substring(5).trim()}
|
||||||
}
|
}
|
||||||
@@ -1737,6 +1740,7 @@ function blockEndMatcher(p1:string,type:{type:blockMatch,type2?:string},matcherA
|
|||||||
switch(type.type){
|
switch(type.type){
|
||||||
case 'pure':
|
case 'pure':
|
||||||
case 'parse-pure':
|
case 'parse-pure':
|
||||||
|
case 'pure-display':
|
||||||
case 'function':{
|
case 'function':{
|
||||||
return p1
|
return p1
|
||||||
}
|
}
|
||||||
@@ -1891,7 +1895,10 @@ export function risuChatParser(da:string, arg:{
|
|||||||
nested.unshift('')
|
nested.unshift('')
|
||||||
stackType[nested.length] = 5
|
stackType[nested.length] = 5
|
||||||
blockNestType.set(nested.length, matchResult)
|
blockNestType.set(nested.length, matchResult)
|
||||||
if(matchResult.type === 'ignore' || matchResult.type === 'pure' || matchResult.type === 'each' || matchResult.type === 'function'){
|
if( matchResult.type === 'ignore' || matchResult.type === 'pure' ||
|
||||||
|
matchResult.type === 'each' || matchResult.type === 'function' ||
|
||||||
|
matchResult.type === 'pure-display'
|
||||||
|
){
|
||||||
pureModeNest.set(nested.length, true)
|
pureModeNest.set(nested.length, true)
|
||||||
pureModeNestType.set(nested.length, "block")
|
pureModeNestType.set(nested.length, "block")
|
||||||
}
|
}
|
||||||
@@ -1901,7 +1908,10 @@ export function risuChatParser(da:string, arg:{
|
|||||||
if(dat.startsWith('/')){
|
if(dat.startsWith('/')){
|
||||||
if(stackType[nested.length] === 5){
|
if(stackType[nested.length] === 5){
|
||||||
const blockType = blockNestType.get(nested.length)
|
const blockType = blockNestType.get(nested.length)
|
||||||
if(blockType.type === 'ignore' || blockType.type === 'pure' || blockType.type === 'each' || blockType.type === 'function'){
|
if( blockType.type === 'ignore' || blockType.type === 'pure' ||
|
||||||
|
blockType.type === 'each' || blockType.type === 'function' ||
|
||||||
|
blockType.type === 'pure-display'
|
||||||
|
){
|
||||||
pureModeNest.delete(nested.length)
|
pureModeNest.delete(nested.length)
|
||||||
pureModeNestType.delete(nested.length)
|
pureModeNestType.delete(nested.length)
|
||||||
}
|
}
|
||||||
@@ -1928,6 +1938,10 @@ export function risuChatParser(da:string, arg:{
|
|||||||
})
|
})
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
if(blockType.type === 'pure-display'){
|
||||||
|
nested[0] += matchResult.replaceAll('{{', '\\{\\{').replaceAll('}}', '\\}\\}')
|
||||||
|
break
|
||||||
|
}
|
||||||
if(matchResult === ''){
|
if(matchResult === ''){
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user