@ -136,7 +136,9 @@ object BookHelp {
var replaceRules: List<ReplaceRule> = arrayListOf()
fun disposeContent(
name: String, origin: String?,
title: String,
name: String,
origin: String?,
content: String,
enableReplace: Boolean
): String {
@ -150,6 +152,9 @@ object BookHelp {
}
if (!content.substringBefore("\n").contains(title)) {
c = title + "\n" + c
for (item in replaceRules) {
item.pattern.let {
if (it.isNotEmpty()) {
@ -94,15 +94,6 @@ object BookContent {
content.append(item.content)
if (content.isNotEmpty()) {
SourceDebug.printLog(bookSource.bookSourceUrl, "┌获取章节名称")
SourceDebug.printLog(bookSource.bookSourceUrl, "└${bookChapter.title}")
SourceDebug.printLog(bookSource.bookSourceUrl, "┌获取正文内容")
if (!content[0].toString().startsWith(bookChapter.title)) {
content
.insert(0, "└\n")
return content.toString()
@ -225,10 +225,11 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
execute {
if (chapter.index in durChapterIndex - 1..durChapterIndex + 1) {
val c = BookHelp.disposeContent(
bookData.value?.name ?: "",
chapter.title,
bookData.value!!.name,
webBook?.bookSource?.bookSourceUrl,
content,
bookData.value?.useReplaceRule ?: true
bookData.value!!.useReplaceRule
)
callBack?.contentLoadFinish(chapter, c)