From ed05749ddd7fb8550b646e848b20ac8a0a5db9f3 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 20 Feb 2021 16:07:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/help/ContentHelp.kt | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/ContentHelp.kt b/app/src/main/java/io/legado/app/help/ContentHelp.kt index 9c2b612bb..b286188e3 100644 --- a/app/src/main/java/io/legado/app/help/ContentHelp.kt +++ b/app/src/main/java/io/legado/app/help/ContentHelp.kt @@ -17,22 +17,8 @@ object ContentHelp { */ fun reSegment(content: String, chapterName: String): String { var content1 = content - val content2: String - val chapterNameLength = chapterName.trim { it <= ' ' }.length - content2 = if (chapterNameLength > 1) { - val regexp = - chapterName.trim { it <= ' ' }.replace("\\s+".toRegex(), "(\\\\s*)") - // 质量较低的页面,章节内可能重复出现章节标题 - if (chapterNameLength > 5) content1.replace(regexp.toRegex(), "") - .trim { it <= ' ' } else content1.replaceFirst( - "^\\s*" + regexp.toRegex(), - "" - ).trim { it <= ' ' } - } else { - content1 - } - val dict = makeDict(content2) - var p = content2 + val dict = makeDict(content1) + var p = content1 .replace(""".toRegex(), "“") .replace("[::]['\"‘”“]+".toRegex(), ":“") .replace("[\"”“]+[\\s]*[\"”“][\\s\"”“]*".toRegex(), "”\n“")