Added option to skip quoted text for rule condition text contains

This commit is contained in:
M66B
2022-01-09 11:09:39 +01:00
parent c1f97ca0f8
commit bfc632c4b9
4 changed files with 21 additions and 2 deletions

View File

@@ -338,6 +338,7 @@ public class EntityRule {
if (jbody != null) {
String value = jbody.getString("value");
boolean regex = jbody.getBoolean("regex");
boolean skip_quotes = jbody.optBoolean("skip_quotes");
if (!regex)
value = value.replaceAll("\\s+", " ");
@@ -355,7 +356,8 @@ public class EntityRule {
throw new IllegalArgumentException(context.getString(R.string.title_rule_no_body));
Document d = JsoupEx.parse(html);
//d.select("blockquote").remove();
if (skip_quotes)
d.select("blockquote").remove();
String text = d.body().text();
if (!matches(context, message, value, text, regex))
return false;