|
|
@ -133,16 +133,6 @@ class AnalyzeByJSoup { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!isEmpty(sourceRule.replaceRegex)) { |
|
|
|
|
|
|
|
val tempList = ArrayList(textS) |
|
|
|
|
|
|
|
textS.clear() |
|
|
|
|
|
|
|
for (text in tempList) { |
|
|
|
|
|
|
|
val tmpText = text.replace(sourceRule.replaceRegex.toRegex(), sourceRule.replacement) |
|
|
|
|
|
|
|
if (tmpText.isNotEmpty()) { |
|
|
|
|
|
|
|
textS.add(tmpText) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return textS |
|
|
|
return textS |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -409,24 +399,13 @@ class AnalyzeByJSoup { |
|
|
|
internal inner class SourceRule(ruleStr: String) { |
|
|
|
internal inner class SourceRule(ruleStr: String) { |
|
|
|
var isCss = false |
|
|
|
var isCss = false |
|
|
|
var elementsRule: String |
|
|
|
var elementsRule: String |
|
|
|
var replaceRegex = "" |
|
|
|
|
|
|
|
var replacement = "" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
init { |
|
|
|
init { |
|
|
|
if (ruleStr.startsWith("@CSS:", true)) { |
|
|
|
if (ruleStr.startsWith("@CSS:", true)) { |
|
|
|
isCss = true |
|
|
|
isCss = true |
|
|
|
elementsRule = ruleStr.substring(5).trim { it <= ' ' } |
|
|
|
elementsRule = ruleStr.substring(5).trim { it <= ' ' } |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
val ruleStrS: Array<String> = |
|
|
|
elementsRule = ruleStr |
|
|
|
ruleStr.trim { it <= ' ' }.split("#".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() |
|
|
|
|
|
|
|
//分离正则表达式 |
|
|
|
|
|
|
|
elementsRule = ruleStrS[0] |
|
|
|
|
|
|
|
if (ruleStrS.size > 1) { |
|
|
|
|
|
|
|
replaceRegex = ruleStrS[1] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (ruleStrS.size > 2) { |
|
|
|
|
|
|
|
replacement = ruleStrS[2] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|