From 9bbcb6b64b03c36d309cc63dc05d1a24c267756a Mon Sep 17 00:00:00 2001 From: bushixuanqi <57338301+bushixuanqi@users.noreply.github.com> Date: Sun, 18 Jul 2021 14:20:56 +0800 Subject: [PATCH] Update HtmlFormatter.kt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化 --- app/src/main/java/io/legado/app/utils/HtmlFormatter.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/utils/HtmlFormatter.kt b/app/src/main/java/io/legado/app/utils/HtmlFormatter.kt index fd1a67455..e1cedc005 100644 --- a/app/src/main/java/io/legado/app/utils/HtmlFormatter.kt +++ b/app/src/main/java/io/legado/app/utils/HtmlFormatter.kt @@ -23,7 +23,7 @@ object HtmlFormatter { html ?: return "" val keepImgHtml = html.replace(wrapHtmlRegex, "\n") .replace(notImgHtmlRegex, "") - .replace("[\\n\\s]+\$|^[\\n\\s]*".toRegex(), "") + .replace("[\\n\\s]+\$|^[\\n\\s]+".toRegex(), "") .replace("\\s*\\n+\\s*".toRegex(), "\n") val sb = StringBuffer() @@ -36,7 +36,7 @@ object HtmlFormatter { val urlBefore = url.substringBefore(',') val strBefore = keepImgHtml.substring(appendPos, matcher.start()) sb.append( - if(strBefore.isBlank()) '\n' else strBefore.replace("\n", "\n  ") //缩进图片之间的非空白段落 + if(strBefore.isBlank()) strBefore else strBefore.replace("\n", "\n  ") //缩进图片之间的非空白段落 ) sb.append( "