mirror of
https://github.com/gedoor/legado.git
synced 2024-07-19 01:17:25 +08:00
优化
This commit is contained in:
parent
0045a3f98c
commit
d4ac63e1b0
@ -52,4 +52,6 @@ object AppPattern {
|
|||||||
val spaceRegex = "\\s+".toRegex()
|
val spaceRegex = "\\s+".toRegex()
|
||||||
|
|
||||||
val regexCharRegex = "[{}()\\[\\].+*?^$\\\\|]".toRegex()
|
val regexCharRegex = "[{}()\\[\\].+*?^$\\\\|]".toRegex()
|
||||||
|
|
||||||
|
val LFRegex = "\n".toRegex()
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package io.legado.app.model.webBook
|
package io.legado.app.model.webBook
|
||||||
|
|
||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
|
import io.legado.app.constant.AppPattern
|
||||||
import io.legado.app.data.appDb
|
import io.legado.app.data.appDb
|
||||||
import io.legado.app.data.entities.Book
|
import io.legado.app.data.entities.Book
|
||||||
import io.legado.app.data.entities.BookChapter
|
import io.legado.app.data.entities.BookChapter
|
||||||
@ -131,7 +132,10 @@ object BookContent {
|
|||||||
//全文替换
|
//全文替换
|
||||||
val replaceRegex = contentRule.replaceRegex
|
val replaceRegex = contentRule.replaceRegex
|
||||||
if (!replaceRegex.isNullOrEmpty()) {
|
if (!replaceRegex.isNullOrEmpty()) {
|
||||||
|
contentStr = contentStr.split(AppPattern.LFRegex)
|
||||||
|
.joinToString("\n") { it.trim { c -> c <= ' ' || c == ' ' } }
|
||||||
contentStr = analyzeRule.getString(replaceRegex, contentStr)
|
contentStr = analyzeRule.getString(replaceRegex, contentStr)
|
||||||
|
contentStr = contentStr.split(AppPattern.LFRegex).joinToString("\n") { " $it" }
|
||||||
}
|
}
|
||||||
Debug.log(bookSource.bookSourceUrl, "┌获取章节名称")
|
Debug.log(bookSource.bookSourceUrl, "┌获取章节名称")
|
||||||
Debug.log(bookSource.bookSourceUrl, "└${bookChapter.title}")
|
Debug.log(bookSource.bookSourceUrl, "└${bookChapter.title}")
|
||||||
|
Loading…
Reference in New Issue
Block a user