pull/1319/head
gedoor 3 years ago
parent e57d745c0c
commit 7d23791542
  1. 25
      app/src/main/java/io/legado/app/help/ContentProcessor.kt

@ -65,27 +65,10 @@ class ContentProcessor private constructor(
var mContent = content.trimStart { var mContent = content.trimStart {
it.code <= 0x20 || it == ' ' || it == ',' || it == ',' it.code <= 0x20 || it == ' ' || it == ',' || it == ','
} }
//去除书名 //去除重复标题
if (mContent.startsWith(book.name)) { val titleRegex =
mContent = mContent.substring(book.name.length) "^(\\s|\\pP)*《*(${book.name})*》*(\\s|\\pP)*${chapter.title}(\\s|\\pP)+".toRegex()
} mContent = mContent.replace(titleRegex, "")
//去除带书名号的书名
val cName = "${book.name}"
if (mContent.startsWith(cName)) {
mContent = mContent.substring(cName.length)
}
//去除无效内容
mContent = mContent.trimStart {
it.code <= 0x20 || it == ' ' || it == ',' || it == ','
}
//去除标题
if (mContent.startsWith(chapter.title)) {
mContent = mContent.substring(chapter.title.length)
}
//去除无效内容
mContent = mContent.trimStart {
it.code <= 0x20 || it == ' ' || it == ',' || it == ','
}
if (includeTitle) { if (includeTitle) {
//重新添加标题 //重新添加标题
mContent = chapter.getDisplayTitle() + "\n" + mContent mContent = chapter.getDisplayTitle() + "\n" + mContent

Loading…
Cancel
Save