fix:一级标题相同时,目录列表丢失

pull/1527/head
Xwite 3 years ago
parent 40ad8438ab
commit baccd099e6
  1. 4
      app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt
  2. 4
      app/src/main/java/io/legado/app/model/webBook/WebBook.kt
  3. 6
      app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.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替代")

@ -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()) {

@ -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(

Loading…
Cancel
Save