Merge pull request #1659 from syomie/master

添加补全时对列表规则的分析
pull/1660/head
kunfei 3 years ago committed by GitHub
commit e079f9030f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      app/src/main/java/io/legado/app/help/ruleComplete.kt
  2. 48
      app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt

@ -2,10 +2,10 @@ package io.legado.app.help
// 补全时忽略匹配规则
val completeIgnore =
Regex("""\\n|##|@js:|<js>|@Json:|\$.|(attr|text|ownText|textNodes|href|content|html|alt|all|value|src)(\(\)|##.*)?\s*$""")
Regex("""\\n|##|@js:|<js>|@Json:|\$\.|(attr|text|ownText|textNodes|href|content|html|alt|all|value|src)(\(\)|##.*)?\s*$""",RegexOption.MULTILINE)
// 补全时忽略匹配的规则(仅对详情页预处理规则生效)
val completeIgnorePreRule = Regex("""^:|##|@js:|<js>|@Json:|\$.""")
// 补全时忽略匹配的规则(判断列表项和详情页预处理规则生效)
val completeIgnorePreRule = Regex("""^:|##|@js:|<js>|@Json:|\$\.""")
// 匹配从图片获取信息的规则
val imgComplete = Regex(

@ -327,31 +327,31 @@ class BookSourceEditActivity :
when (it.key) {
"searchUrl" -> source.searchUrl = it.value
"checkKeyWord" -> searchRule.checkKeyWord = it.value
"bookList" -> searchRule.bookList = it.value
"name" -> searchRule.name = ruleComplete(it.value)
"author" -> searchRule.author = ruleComplete(it.value)
"kind" -> searchRule.kind = ruleComplete(it.value)
"intro" -> searchRule.intro = ruleComplete(it.value)
"updateTime" -> searchRule.updateTime = ruleComplete(it.value)
"wordCount" -> searchRule.wordCount = ruleComplete(it.value)
"lastChapter" -> searchRule.lastChapter = ruleComplete(it.value)
"coverUrl" -> searchRule.coverUrl = ruleComplete(it.value, type = 3)
"bookUrl" -> searchRule.bookUrl = ruleComplete(it.value, type = 2)
"bookList" -> searchRule.bookList = it.value ?: ""
"name" -> searchRule.name = ruleComplete(it.value,searchRule.bookList)
"author" -> searchRule.author = ruleComplete(it.value,searchRule.bookList)
"kind" -> searchRule.kind = ruleComplete(it.value,searchRule.bookList)
"intro" -> searchRule.intro = ruleComplete(it.value,searchRule.bookList)
"updateTime" -> searchRule.updateTime = ruleComplete(it.value,searchRule.bookList)
"wordCount" -> searchRule.wordCount = ruleComplete(it.value,searchRule.bookList)
"lastChapter" -> searchRule.lastChapter = ruleComplete(it.value,searchRule.bookList)
"coverUrl" -> searchRule.coverUrl = ruleComplete(it.value,searchRule.bookList,3)
"bookUrl" -> searchRule.bookUrl = ruleComplete(it.value,searchRule.bookList,2)
}
}
findEntities.forEach {
when (it.key) {
"exploreUrl" -> source.exploreUrl = it.value
"bookList" -> exploreRule.bookList = it.value
"name" -> exploreRule.name = ruleComplete(it.value)
"author" -> exploreRule.author = ruleComplete(it.value)
"kind" -> exploreRule.kind = ruleComplete(it.value)
"intro" -> exploreRule.intro = ruleComplete(it.value)
"updateTime" -> exploreRule.updateTime = ruleComplete(it.value)
"wordCount" -> exploreRule.wordCount = ruleComplete(it.value)
"lastChapter" -> exploreRule.lastChapter = ruleComplete(it.value)
"coverUrl" -> exploreRule.coverUrl = ruleComplete(it.value, type = 3)
"bookUrl" -> exploreRule.bookUrl = ruleComplete(it.value, type = 2)
"bookList" -> exploreRule.bookList = it.value ?: ""
"name" -> exploreRule.name = ruleComplete(it.value,exploreRule.bookList)
"author" -> exploreRule.author = ruleComplete(it.value,exploreRule.bookList)
"kind" -> exploreRule.kind = ruleComplete(it.value,exploreRule.bookList)
"intro" -> exploreRule.intro = ruleComplete(it.value,exploreRule.bookList)
"updateTime" -> exploreRule.updateTime = ruleComplete(it.value,exploreRule.bookList)
"wordCount" -> exploreRule.wordCount = ruleComplete(it.value,exploreRule.bookList)
"lastChapter" -> exploreRule.lastChapter = ruleComplete(it.value,exploreRule.bookList)
"coverUrl" -> exploreRule.coverUrl = ruleComplete(it.value,exploreRule.bookList,3)
"bookUrl" -> exploreRule.bookUrl = ruleComplete(it.value,exploreRule.bookList,2)
}
}
infoEntities.forEach {
@ -372,14 +372,14 @@ class BookSourceEditActivity :
}
tocEntities.forEach {
when (it.key) {
"chapterList" -> tocRule.chapterList = it.value
"chapterName" -> tocRule.chapterName = ruleComplete(it.value)
"chapterUrl" -> tocRule.chapterUrl = ruleComplete(it.value, type = 2)
"chapterList" -> tocRule.chapterList = it.value ?: ""
"chapterName" -> tocRule.chapterName = ruleComplete(it.value,tocRule.chapterList)
"chapterUrl" -> tocRule.chapterUrl = ruleComplete(it.value,tocRule.chapterList, 2)
"isVolume" -> tocRule.isVolume = it.value
"updateTime" -> tocRule.updateTime = it.value
"isVip" -> tocRule.isVip = it.value
"isPay" -> tocRule.isPay = it.value
"nextTocUrl" -> tocRule.nextTocUrl = ruleComplete(it.value, type = 2)
"nextTocUrl" -> tocRule.nextTocUrl = ruleComplete(it.value,tocRule.chapterList,2)
}
}
contentEntities.forEach {

Loading…
Cancel
Save