diff --git a/preprocessor.gd b/preprocessor.gd index b97a6b9..d1af0df 100644 --- a/preprocessor.gd +++ b/preprocessor.gd @@ -336,16 +336,13 @@ func _escapes(msg:String) -> String: logger.diag("Preprocessor","Preprocessed escapes") return msg_proc -# Checks for and if found stops preprocessing -func _noprocess(msg:String) -> String: +# Checks for and if found returns true, otherwise false +func _noprocess(msg:String) -> bool: if verbose_logging: logger.diag("Preprocessor","Preprocessing noprocess") - if msg.find("") != -1: - logger.diag("Preprocessor","Preprocessed noprocess") - return msg.replace("","") - if verbose_logging: - logger.diag("Preprocessor","Preprocessed noprocess") - return msg + if msg.contains(""): + 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 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: 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: