Made _noprocess() a little bit better
This commit is contained in:
parent
24fb70ce80
commit
c5a8432da4
1 changed files with 8 additions and 13 deletions
|
@ -336,16 +336,13 @@ func _escapes(msg:String) -> String:
|
||||||
logger.diag("Preprocessor","Preprocessed escapes")
|
logger.diag("Preprocessor","Preprocessed escapes")
|
||||||
return msg_proc
|
return msg_proc
|
||||||
|
|
||||||
# Checks for <np> and if found stops preprocessing
|
# Checks for <np> and if found returns true, otherwise false
|
||||||
func _noprocess(msg:String) -> String:
|
func _noprocess(msg:String) -> bool:
|
||||||
if verbose_logging:
|
if verbose_logging:
|
||||||
logger.diag("Preprocessor","Preprocessing noprocess")
|
logger.diag("Preprocessor","Preprocessing noprocess")
|
||||||
if msg.find("<np>") != -1:
|
if msg.contains("<np>"):
|
||||||
logger.diag("Preprocessor","Preprocessed noprocess")
|
return true
|
||||||
return msg.replace("<np>","")
|
return false
|
||||||
if verbose_logging:
|
|
||||||
logger.diag("Preprocessor","Preprocessed noprocess")
|
|
||||||
return msg
|
|
||||||
|
|
||||||
# Executes all preprocessing functions and returns their combined work
|
# 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:
|
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:
|
if verbose_logging:
|
||||||
logger.diag("Preprocessor","Preprocessing failed: Preprocessor is disabled")
|
logger.diag("Preprocessor","Preprocessing failed: Preprocessor is disabled")
|
||||||
return msg
|
return msg
|
||||||
# _noprocess() returns a modified msg variable with <np> removed. That's returned and then checked against the "real" msg variable.
|
if _noprocess(msg):
|
||||||
var msg_proc = _noprocess(msg)
|
|
||||||
if msg_proc != msg:
|
|
||||||
if verbose_logging:
|
if verbose_logging:
|
||||||
logger.diag("Preprocessor","Preprocessing cancelled: <np> tag detected")
|
logger.diag("Preprocessor","Preprocessing cancelled: <np> tag detected")
|
||||||
return msg_proc
|
return msg
|
||||||
msg_proc = _case(msg)
|
var msg_proc = _case(msg)
|
||||||
msg_proc = _newline(msg_proc,prefix,pre_msg,post_msg,exclusion_filter)
|
msg_proc = _newline(msg_proc,prefix,pre_msg,post_msg,exclusion_filter)
|
||||||
msg_proc = _escapes(msg_proc)
|
msg_proc = _escapes(msg_proc)
|
||||||
if verbose_logging:
|
if verbose_logging:
|
||||||
|
|
Loading…
Reference in a new issue