From b86e17bc065c75bacabc3558c4c249b327adf069 Mon Sep 17 00:00:00 2001 From: bushixuanqi <2208877960@qq.com> Date: Sun, 18 Jul 2021 01:07:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=93=BE=E6=8E=A5=E5=88=86?= =?UTF-8?q?=E5=89=B2=E8=A7=84=E5=88=99=EF=BC=8C=E9=81=BF=E5=85=8D=E9=99=84?= =?UTF-8?q?=E5=8A=A0=E5=8F=82=E6=95=B0=E4=B8=AD=E5=AD=98=E5=9C=A8=20,{=20?= =?UTF-8?q?=E6=97=B6=E5=AF=BC=E8=87=B4=E8=A7=84=E5=88=99=E5=88=87=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复这种页数列表写法中,js部分内含 < 或 > 会切割错误的问题 格式化图片和匹配图片规则不在使用同一个正则,加快图片处理速度。 优化一下不需要循环执行却被循环执行的操作 --- .../java/io/legado/app/model/analyzeRule/AnalyzeRule.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt index 3753738eb..1ad285563 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt @@ -121,7 +121,7 @@ class AnalyzeRule(val ruleData: RuleDataInterface) : JsExtensions { @JvmOverloads fun getStringList(rule: String?, isUrl: Boolean = false): List? { if (rule.isNullOrEmpty()) return null - val ruleList = splitSourceRule(rule) + val ruleList = splitSourceRule(rule,true) return getStringList(ruleList, isUrl) } @@ -281,7 +281,7 @@ class AnalyzeRule(val ruleData: RuleDataInterface) : JsExtensions { @Suppress("UNCHECKED_CAST") fun getElements(ruleStr: String): List { var result: Any? = null - val ruleList = splitSourceRule(ruleStr) + val ruleList = splitSourceRule(ruleStr,true) content?.let { o -> if (ruleList.isNotEmpty()) result = o for (sourceRule in ruleList) { @@ -356,7 +356,7 @@ class AnalyzeRule(val ruleData: RuleDataInterface) : JsExtensions { /** * 分解规则生成规则列表 */ - fun splitSourceRule(ruleStr: String?): List { + fun splitSourceRule(ruleStr: String?,isList:Boolean = false): List { if (ruleStr.isNullOrEmpty()) return ArrayList() val ruleList = ArrayList() //检测Mode @@ -387,8 +387,9 @@ class AnalyzeRule(val ruleData: RuleDataInterface) : JsExtensions { ruleStr0 } } + //拆分为规则列表 - var start = if(ruleStr.startsWith(":")){ //仅首字符为:时为AllInOne,其实:与伪类选择器冲突,建议改成?更合理 + var start = if(isList && ruleStr.startsWith(":")){ //仅首字符为:时为AllInOne,其实:与伪类选择器冲突,建议改成?更合理 mMode = Mode.Regex isRegex = true 1