Răsfoiți Sursa

fix:错误净化章节标题

Xwite 4 ani în urmă
părinte
comite
b5f8b8ab8e

+ 2 - 0
app/src/main/java/io/legado/app/data/entities/BookChapter.kt

@@ -80,6 +80,7 @@ data class BookChapter(
         chineseConvert: Boolean = true,
         chineseConvert: Boolean = true,
     ): String {
     ): String {
         var displayTitle = title.replace(AppPattern.rnRegex, "")
         var displayTitle = title.replace(AppPattern.rnRegex, "")
+        val mDisplayTitle = displayTitle
         if (useReplace && replaceRules != null) {
         if (useReplace && replaceRules != null) {
             replaceRules.forEach { item ->
             replaceRules.forEach { item ->
                 if (item.pattern.isNotEmpty()) {
                 if (item.pattern.isNotEmpty()) {
@@ -95,6 +96,7 @@ data class BookChapter(
                 }
                 }
             }
             }
         }
         }
+        if (displayTitle.isBlank()) displayTitle = mDisplayTitle
         if (chineseConvert) {
         if (chineseConvert) {
             when (AppConfig.chineseConverterType) {
             when (AppConfig.chineseConverterType) {
                 1 -> displayTitle = ChineseUtils.t2s(displayTitle)
                 1 -> displayTitle = ChineseUtils.t2s(displayTitle)

+ 4 - 4
app/src/main/java/io/legado/app/help/ContentProcessor.kt

@@ -77,10 +77,6 @@ class ContentProcessor private constructor(
             //重新分段
             //重新分段
             mContent = ContentHelp.reSegment(mContent, chapter.title)
             mContent = ContentHelp.reSegment(mContent, chapter.title)
         }
         }
-        if (includeTitle) {
-            //重新添加标题
-            mContent = chapter.getDisplayTitle() + "\n" + mContent
-        }
         if (useReplace && book.getUseReplaceRule()) {
         if (useReplace && book.getUseReplaceRule()) {
             //替换
             //替换
             mContent = replaceContent(mContent)
             mContent = replaceContent(mContent)
@@ -96,6 +92,10 @@ class ContentProcessor private constructor(
                 appCtx.toastOnUi("简繁转换出错")
                 appCtx.toastOnUi("简繁转换出错")
             }
             }
         }
         }
+        if (includeTitle) {
+            //重新添加标题
+            mContent = chapter.getDisplayTitle() + "\n" + mContent
+        }
         val contents = arrayListOf<String>()
         val contents = arrayListOf<String>()
         mContent.split("\n").forEach { str ->
         mContent.split("\n").forEach { str ->
             val paragraph = str.trim {
             val paragraph = str.trim {