Przeglądaj źródła

替换净化应该在简繁转换之后进行

Xwite 4 lat temu
rodzic
commit
accc62e0b8

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

@@ -81,6 +81,12 @@ data class BookChapter(
     ): String {
     ): String {
         var displayTitle = title.replace(AppPattern.rnRegex, "")
         var displayTitle = title.replace(AppPattern.rnRegex, "")
         val mDisplayTitle = displayTitle
         val mDisplayTitle = displayTitle
+        if (chineseConvert) {
+            when (AppConfig.chineseConverterType) {
+                1 -> displayTitle = ChineseUtils.t2s(displayTitle)
+                2 -> displayTitle = ChineseUtils.s2t(displayTitle)
+            }
+        }
         if (useReplace && replaceRules != null) {
         if (useReplace && replaceRules != null) {
             replaceRules.forEach { item ->
             replaceRules.forEach { item ->
                 if (item.pattern.isNotEmpty()) {
                 if (item.pattern.isNotEmpty()) {
@@ -97,12 +103,6 @@ data class BookChapter(
             }
             }
         }
         }
         if (displayTitle.isBlank()) displayTitle = mDisplayTitle
         if (displayTitle.isBlank()) displayTitle = mDisplayTitle
-        if (chineseConvert) {
-            when (AppConfig.chineseConverterType) {
-                1 -> displayTitle = ChineseUtils.t2s(displayTitle)
-                2 -> displayTitle = ChineseUtils.s2t(displayTitle)
-            }
-        }
         return when {
         return when {
             !isVip -> displayTitle
             !isVip -> displayTitle
             isPay -> appCtx.getString(R.string.payed_title, displayTitle)
             isPay -> appCtx.getString(R.string.payed_title, 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 (useReplace && book.getUseReplaceRule()) {
-            //替换
-            mContent = replaceContent(mContent)
-        }
         if (chineseConvert) {
         if (chineseConvert) {
             //简繁转换
             //简繁转换
             try {
             try {
@@ -92,6 +88,10 @@ class ContentProcessor private constructor(
                 appCtx.toastOnUi("简繁转换出错")
                 appCtx.toastOnUi("简繁转换出错")
             }
             }
         }
         }
+        if (useReplace && book.getUseReplaceRule()) {
+            //替换
+            mContent = replaceContent(mContent)
+        }
         if (includeTitle) {
         if (includeTitle) {
             //重新添加标题
             //重新添加标题
             mContent = chapter.getDisplayTitle(getReplaceRules()) + "\n" + mContent
             mContent = chapter.getDisplayTitle(getReplaceRules()) + "\n" + mContent