正文合并后替换规则支持所有规则写法,包括js

pull/354/head
gedoor 4 years ago
parent 58407ac7d6
commit a5888c4fd4
  1. 8
      app/src/main/java/io/legado/app/model/webBook/BookContent.kt

@ -97,11 +97,9 @@ object BookContent {
} }
content.deleteCharAt(content.length - 1) content.deleteCharAt(content.length - 1)
var contentStr = content.toString().htmlFormat() var contentStr = content.toString().htmlFormat()
val replaceRegex = bookSource.ruleContent?.replaceRegex val replaceRegex = bookSource.ruleContent?.replaceRegex?.trim()
replaceRegex?.trim { it <= ' ' }?.split("##")?.let { if (!replaceRegex.isNullOrEmpty()) {
if (it.size > 1) { contentStr = AnalyzeRule(book).setContent(contentStr).getString(replaceRegex)
contentStr = contentStr.replace(it[1].toRegex(), it.getOrNull(2) ?: "")
}
} }
Debug.log(bookSource.bookSourceUrl, "┌获取章节名称") Debug.log(bookSource.bookSourceUrl, "┌获取章节名称")
Debug.log(bookSource.bookSourceUrl, "${bookChapter.title}") Debug.log(bookSource.bookSourceUrl, "${bookChapter.title}")

Loading…
Cancel
Save