Merge remote-tracking branch 'origin/master'

pull/1660/head
kunfei 3 years ago
commit 3cbd7d0f68
  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 = 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( val imgComplete = Regex(

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

Loading…
Cancel
Save