Made _noprocess() a little bit better

This commit is contained in:
JeremyStar™ 2023-07-07 22:17:28 +02:00
parent 24fb70ce80
commit c5a8432da4

View file

@ -336,16 +336,13 @@ func _escapes(msg:String) -> String:
logger.diag("Preprocessor","Preprocessed escapes")
return msg_proc
# Checks for <np> and if found stops preprocessing
func _noprocess(msg:String) -> String:
# Checks for <np> and if found returns true, otherwise false
func _noprocess(msg:String) -> bool:
if verbose_logging:
logger.diag("Preprocessor","Preprocessing noprocess")
if msg.find("<np>") != -1:
logger.diag("Preprocessor","Preprocessed noprocess")
return msg.replace("<np>","")
if verbose_logging:
logger.diag("Preprocessor","Preprocessed noprocess")
return msg
if msg.contains("<np>"):
return true
return false
# Executes all preprocessing functions and returns their combined work
func process(msg:String,prefix:String = "",pre_msg:String = "",post_msg:String = "",exclusion_filter:Array = []) -> String:
@ -355,13 +352,11 @@ func process(msg:String,prefix:String = "",pre_msg:String = "",post_msg:String =
if verbose_logging:
logger.diag("Preprocessor","Preprocessing failed: Preprocessor is disabled")
return msg
# _noprocess() returns a modified msg variable with <np> removed. That's returned and then checked against the "real" msg variable.
var msg_proc = _noprocess(msg)
if msg_proc != msg:
if _noprocess(msg):
if verbose_logging:
logger.diag("Preprocessor","Preprocessing cancelled: <np> tag detected")
return msg_proc
msg_proc = _case(msg)
return msg
var msg_proc = _case(msg)
msg_proc = _newline(msg_proc,prefix,pre_msg,post_msg,exclusion_filter)
msg_proc = _escapes(msg_proc)
if verbose_logging: