htmlFormat只用在@html规则上,防止替换过度,有些东西显示不出来

pull/354/head
gedoor 4 years ago
parent 72ab2456ed
commit d8c2484d69
  1. 3
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt
  2. 3
      app/src/main/java/io/legado/app/model/webBook/BookContent.kt

@ -3,6 +3,7 @@ package io.legado.app.model.analyzeRule
import android.text.TextUtils.isEmpty import android.text.TextUtils.isEmpty
import android.text.TextUtils.join import android.text.TextUtils.join
import androidx.annotation.Keep import androidx.annotation.Keep
import io.legado.app.utils.htmlFormat
import io.legado.app.utils.splitNotBlank import io.legado.app.utils.splitNotBlank
import org.jsoup.Jsoup import org.jsoup.Jsoup
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
@ -379,7 +380,7 @@ class AnalyzeByJSoup {
"html" -> { "html" -> {
elements.select("script").remove() elements.select("script").remove()
elements.select("style").remove() elements.select("style").remove()
val html = elements.outerHtml() val html = elements.outerHtml().htmlFormat()
textS.add(html) textS.add(html)
} }
"all" -> textS.add(elements.outerHtml()) "all" -> textS.add(elements.outerHtml())

@ -10,7 +10,6 @@ import io.legado.app.model.Debug
import io.legado.app.model.analyzeRule.AnalyzeRule import io.legado.app.model.analyzeRule.AnalyzeRule
import io.legado.app.model.analyzeRule.AnalyzeUrl import io.legado.app.model.analyzeRule.AnalyzeUrl
import io.legado.app.utils.NetworkUtils import io.legado.app.utils.NetworkUtils
import io.legado.app.utils.htmlFormat
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
@ -96,7 +95,7 @@ object BookContent {
} }
} }
content.deleteCharAt(content.length - 1) content.deleteCharAt(content.length - 1)
var contentStr = content.toString().htmlFormat() var contentStr = content.toString()
val replaceRegex = bookSource.ruleContent?.replaceRegex?.trim() val replaceRegex = bookSource.ruleContent?.replaceRegex?.trim()
if (!replaceRegex.isNullOrEmpty()) { if (!replaceRegex.isNullOrEmpty()) {
contentStr = AnalyzeRule(book).setContent(contentStr).getString(replaceRegex) contentStr = AnalyzeRule(book).setContent(contentStr).getString(replaceRegex)

Loading…
Cancel
Save