From a5888c4fd46f7d96792f339304c1fab092817d63 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 2 Sep 2020 18:01:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E6=96=87=E5=90=88=E5=B9=B6=E5=90=8E?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E8=A7=84=E5=88=99=E6=94=AF=E6=8C=81=E6=89=80?= =?UTF-8?q?=E6=9C=89=E8=A7=84=E5=88=99=E5=86=99=E6=B3=95,=E5=8C=85?= =?UTF-8?q?=E6=8B=ACjs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/model/webBook/BookContent.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/webBook/BookContent.kt b/app/src/main/java/io/legado/app/model/webBook/BookContent.kt index 9e5336b62..b17c5e4ff 100644 --- a/app/src/main/java/io/legado/app/model/webBook/BookContent.kt +++ b/app/src/main/java/io/legado/app/model/webBook/BookContent.kt @@ -97,11 +97,9 @@ object BookContent { } content.deleteCharAt(content.length - 1) var contentStr = content.toString().htmlFormat() - val replaceRegex = bookSource.ruleContent?.replaceRegex - replaceRegex?.trim { it <= ' ' }?.split("##")?.let { - if (it.size > 1) { - contentStr = contentStr.replace(it[1].toRegex(), it.getOrNull(2) ?: "") - } + val replaceRegex = bookSource.ruleContent?.replaceRegex?.trim() + if (!replaceRegex.isNullOrEmpty()) { + contentStr = AnalyzeRule(book).setContent(contentStr).getString(replaceRegex) } Debug.log(bookSource.bookSourceUrl, "┌获取章节名称") Debug.log(bookSource.bookSourceUrl, "└${bookChapter.title}")