From baccd099e6fc6da123176ae180cbdf58dc4ab6c2 Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Thu, 13 Jan 2022 15:39:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=B8=80=E7=BA=A7=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E7=9B=B8=E5=90=8C=E6=97=B6=EF=BC=8C=E7=9B=AE=E5=BD=95=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/model/webBook/BookChapterList.kt | 4 ++-- app/src/main/java/io/legado/app/model/webBook/WebBook.kt | 4 ++-- .../app/ui/book/read/page/provider/ChapterProvider.kt | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt b/app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt index 72d13880d..faf5f1fa4 100644 --- a/app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt +++ b/app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt @@ -193,8 +193,8 @@ object BookChapterList { } if (bookChapter.url.isEmpty()) { if (bookChapter.isVolume) { - bookChapter.url = bookChapter.title - Debug.log(bookSource.bookSourceUrl, "一级目录${index}未获取到url,使用章节标题替代") + bookChapter.url = bookChapter.title + index + Debug.log(bookSource.bookSourceUrl, "一级目录${index}未获取到url,使用${bookChapter.title}${index}替代") } else { bookChapter.url = baseUrl Debug.log(bookSource.bookSourceUrl, "目录${index}未获取到url,使用baseUrl替代") diff --git a/app/src/main/java/io/legado/app/model/webBook/WebBook.kt b/app/src/main/java/io/legado/app/model/webBook/WebBook.kt index c1f727fd0..9cda244cf 100644 --- a/app/src/main/java/io/legado/app/model/webBook/WebBook.kt +++ b/app/src/main/java/io/legado/app/model/webBook/WebBook.kt @@ -261,8 +261,8 @@ object WebBook { Debug.log(bookSource.bookSourceUrl, "⇒正文规则为空,使用章节链接:${bookChapter.url}") return bookChapter.url } - if(bookChapter.isVolume && bookChapter.url == bookChapter.title) { - Debug.log(bookSource.bookSourceUrl, "⇒一级目录获取链接为空,使用${bookChapter.tag}") + if(bookChapter.isVolume && bookChapter.url.startsWith(bookChapter.title)) { + Debug.log(bookSource.bookSourceUrl, "⇒一级目录正文不解析规则") return bookChapter.tag ?: "" } return if (bookChapter.url == book.bookUrl && !book.tocHtml.isNullOrEmpty()) { diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt index d42c60a66..ebfbcb0f8 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt @@ -129,7 +129,7 @@ object ChapterProvider { matcher.appendTail(sb) text = sb.toString() val isTitle = index == 0 - val isVolumeTitle = bookChapter.isVolume && isTitle && bookChapter.url == bookChapter.title && bookChapter.tag.isNullOrBlank() + val isVolumeTitle = bookChapter.isVolume && isTitle && contents.size == 1 val textPaint = if (isTitle) titlePaint else contentPaint if (!(isTitle && ReadBookConfig.titleMode == 2)) { setTypeText( @@ -147,7 +147,7 @@ object ChapterProvider { val text = content.substring(start, matcher.start()) if (text.isNotBlank()) { val isTitle = index == 0 - val isVolumeTitle = bookChapter.isVolume && isTitle && bookChapter.url == bookChapter.title && bookChapter.tag.isNullOrBlank() + val isVolumeTitle = bookChapter.isVolume && isTitle && contents.size == 1 val textPaint = if (isTitle) titlePaint else contentPaint if (!(isTitle && ReadBookConfig.titleMode == 2)) { setTypeText( @@ -169,7 +169,7 @@ object ChapterProvider { val text = content.substring(start, content.length) if (text.isNotBlank()) { val isTitle = index == 0 - val isVolumeTitle = bookChapter.isVolume && isTitle && bookChapter.url == bookChapter.title && bookChapter.tag.isNullOrBlank() + val isVolumeTitle = bookChapter.isVolume && isTitle && contents.size == 1 val textPaint = if (isTitle) titlePaint else contentPaint if (!(isTitle && ReadBookConfig.titleMode == 2)) { setTypeText(