This commit is contained in:
Horis 2024-06-09 12:34:53 +08:00
parent 2f2ba9a751
commit e081b4b470

View File

@ -188,6 +188,7 @@ class ContentProcessor private constructor(
mContent = mContent.replace('\u00A0', ' ') mContent = mContent.replace('\u00A0', ' ')
} }
val contents = arrayListOf<String>() val contents = arrayListOf<String>()
val paragraphIndent = ReadBookConfig.paragraphIndent
mContent.split("\n").forEach { str -> mContent.split("\n").forEach { str ->
val paragraph = str.trim { val paragraph = str.trim {
it.code <= 0x20 || it == ' ' it.code <= 0x20 || it == ' '
@ -196,10 +197,14 @@ class ContentProcessor private constructor(
if (contents.isEmpty() && includeTitle) { if (contents.isEmpty() && includeTitle) {
contents.add(paragraph) contents.add(paragraph)
} else { } else {
contents.add("${ReadBookConfig.paragraphIndent}$paragraph") contents.add("$paragraphIndent$paragraph")
} }
} }
} }
if (contents.isEmpty()) {
contents.add("${paragraphIndent}加载正文失败")
contents.add("${paragraphIndent}内容处理后为空")
}
return BookContent(sameTitleRemoved, contents, effectiveReplaceRules) return BookContent(sameTitleRemoved, contents, effectiveReplaceRules)
} }