pull/1463/head
gedoor 3 years ago
parent 48eed794e1
commit 89fae49fd3
  1. 6
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt

@ -262,9 +262,10 @@ class AnalyzeRule(
/** /**
* 获取Element * 获取Element
*/ */
fun getElement(ruleStr: String): Any? { fun getElement(ruleStr: String, mContent: Any? = null): Any? {
if (TextUtils.isEmpty(ruleStr)) return null if (TextUtils.isEmpty(ruleStr)) return null
var result: Any? = null var result: Any? = null
val content = mContent ?: this.content
val ruleList = splitSourceRule(ruleStr, true) val ruleList = splitSourceRule(ruleStr, true)
content?.let { o -> content?.let { o ->
if (ruleList.isNotEmpty()) result = o if (ruleList.isNotEmpty()) result = o
@ -295,8 +296,9 @@ class AnalyzeRule(
* 获取列表 * 获取列表
*/ */
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
fun getElements(ruleStr: String): List<Any> { fun getElements(ruleStr: String, mContent: Any? = null): List<Any> {
var result: Any? = null var result: Any? = null
val content = mContent ?: this.content
val ruleList = splitSourceRule(ruleStr, true) val ruleList = splitSourceRule(ruleStr, true)
content?.let { o -> content?.let { o ->
if (ruleList.isNotEmpty()) result = o if (ruleList.isNotEmpty()) result = o

Loading…
Cancel
Save