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

pull/1591/head
Xwite 3 years ago
parent 8ea5b7d6bc
commit 0cc3938c08
  1. 12
      app/src/main/java/io/legado/app/data/entities/BookChapter.kt
  2. 8
      app/src/main/java/io/legado/app/help/ContentProcessor.kt

@ -81,6 +81,12 @@ data class BookChapter(
): String {
var displayTitle = title.replace(AppPattern.rnRegex, "")
val mDisplayTitle = displayTitle
if (chineseConvert) {
when (AppConfig.chineseConverterType) {
1 -> displayTitle = ChineseUtils.t2s(displayTitle)
2 -> displayTitle = ChineseUtils.s2t(displayTitle)
}
}
if (useReplace && replaceRules != null) {
replaceRules.forEach { item ->
if (item.pattern.isNotEmpty()) {
@ -97,12 +103,6 @@ data class BookChapter(
}
}
if (displayTitle.isBlank()) displayTitle = mDisplayTitle
if (chineseConvert) {
when (AppConfig.chineseConverterType) {
1 -> displayTitle = ChineseUtils.t2s(displayTitle)
2 -> displayTitle = ChineseUtils.s2t(displayTitle)
}
}
return when {
!isVip -> displayTitle
isPay -> appCtx.getString(R.string.payed_title, displayTitle)

@ -77,10 +77,6 @@ class ContentProcessor private constructor(
//重新分段
mContent = ContentHelp.reSegment(mContent, chapter.title)
}
if (useReplace && book.getUseReplaceRule()) {
//替换
mContent = replaceContent(mContent)
}
if (chineseConvert) {
//简繁转换
try {
@ -92,6 +88,10 @@ class ContentProcessor private constructor(
appCtx.toastOnUi("简繁转换出错")
}
}
if (useReplace && book.getUseReplaceRule()) {
//替换
mContent = replaceContent(mContent)
}
if (includeTitle) {
//重新添加标题
mContent = chapter.getDisplayTitle(getReplaceRules()) + "\n" + mContent

Loading…
Cancel
Save