pull/2457/head
kunfei 2 years ago
parent fdf71cc48e
commit c43f396747
  1. 3
      app/src/main/java/io/legado/app/data/entities/BookChapter.kt
  2. 6
      app/src/main/java/io/legado/app/help/book/ContentProcessor.kt

@ -102,7 +102,8 @@ data class BookChapter(
val mDisplayTitle = if (item.isRegex) {
displayTitle.replace(
item.pattern.toRegex(),
item.replacement
item.replacement,
item.timeoutMillisecond
)
} else {
displayTitle.replace(item.pattern, item.replacement)

@ -9,6 +9,7 @@ import io.legado.app.data.entities.ReplaceRule
import io.legado.app.exception.RegexTimeoutException
import io.legado.app.help.config.AppConfig
import io.legado.app.help.config.ReadBookConfig
import io.legado.app.utils.replace
import io.legado.app.utils.stackTraceStr
import io.legado.app.utils.toastOnUi
import kotlinx.coroutines.CancellationException
@ -133,7 +134,7 @@ class ContentProcessor private constructor(
return contents
}
fun replaceContent(content: String): String {
suspend fun replaceContent(content: String): String {
var mContent = content
mContent = mContent.lines().joinToString("\n") { it.trim() }
getContentReplaceRules().forEach { item ->
@ -142,7 +143,8 @@ class ContentProcessor private constructor(
mContent = if (item.isRegex) {
mContent.replace(
item.pattern.toRegex(),
item.replacement
item.replacement,
item.timeoutMillisecond
)
} else {
mContent.replace(item.pattern, item.replacement)

Loading…
Cancel
Save