|
|
@ -16,7 +16,6 @@ import kotlinx.coroutines.CancellationException |
|
|
|
import splitties.init.appCtx |
|
|
|
import splitties.init.appCtx |
|
|
|
import java.lang.ref.WeakReference |
|
|
|
import java.lang.ref.WeakReference |
|
|
|
import java.util.concurrent.CopyOnWriteArrayList |
|
|
|
import java.util.concurrent.CopyOnWriteArrayList |
|
|
|
import java.util.regex.Pattern |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ContentProcessor private constructor( |
|
|
|
class ContentProcessor private constructor( |
|
|
|
private val bookName: String, |
|
|
|
private val bookName: String, |
|
|
@ -82,15 +81,6 @@ class ContentProcessor private constructor( |
|
|
|
): List<String> { |
|
|
|
): List<String> { |
|
|
|
var mContent = content |
|
|
|
var mContent = content |
|
|
|
if (content != "null") { |
|
|
|
if (content != "null") { |
|
|
|
//去除重复标题 |
|
|
|
|
|
|
|
// try { |
|
|
|
|
|
|
|
// val name = Pattern.quote(book.name) |
|
|
|
|
|
|
|
// val title = Pattern.quote(chapter.title) |
|
|
|
|
|
|
|
// val titleRegex = "^(\\s|\\p{P}|${name})*${title}(\\s)*".toRegex() |
|
|
|
|
|
|
|
// mContent = mContent.replace(titleRegex, "") |
|
|
|
|
|
|
|
// } catch (e: Exception) { |
|
|
|
|
|
|
|
// AppLog.put("去除重复标题出错\n${e.localizedMessage}", e) |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
if (reSegment && book.getReSegment()) { |
|
|
|
if (reSegment && book.getReSegment()) { |
|
|
|
//重新分段 |
|
|
|
//重新分段 |
|
|
|
mContent = ContentHelp.reSegment(mContent, chapter.title) |
|
|
|
mContent = ContentHelp.reSegment(mContent, chapter.title) |
|
|
|