From f838497c889752a2b1927ce4a2c3756ccd6732d3 Mon Sep 17 00:00:00 2001 From: bushixuanqi <2208877960@qq.com> Date: Mon, 12 Jul 2021 22:38:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=93=BE=E6=8E=A5=E5=88=86?= =?UTF-8?q?=E5=89=B2=E8=A7=84=E5=88=99=EF=BC=8C=E9=81=BF=E5=85=8D=20,{c?= =?UTF-8?q?=E5=8F=82=E6=95=B0}=20=E7=9A=84=E5=AD=97=E7=AC=A6=E4=B8=B2?= =?UTF-8?q?=E4=B8=AD=E4=B9=9F=E5=AD=98=E5=9C=A8=20,{=20=EF=BC=8C=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E8=A7=84=E5=88=99=E5=88=87=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复这种页数列表写法中,js部分内含 < 或 > 就会切割错误的问题 优化格式化图片标签操作和匹配图片标签操作,加快图片处理速度 --- 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 3963a4b45..80fe2c71a 100644 --- a/app/src/main/java/io/legado/app/utils/HtmlFormatter.kt +++ b/app/src/main/java/io/legado/app/utils/HtmlFormatter.kt @@ -25,12 +25,12 @@ object HtmlFormatter { val sb = StringBuffer() //图片有data-开头的数据属性时优先用数据属性作为src,没有数据属性时匹配src - val imgPatternX = Pattern.compile( + val imgPattern = Pattern.compile( if(keepImgHtml.matches("]*data-".toRegex())) "]*data-[^=]*= *\"([^\"])\"[^>]*>" else "]*src *= *\"([^\"{]+(?:\\{(?:[^{}]|\\{[^{}]*\\})*\\})?)\"[^>]*>", Pattern.CASE_INSENSITIVE ) - val matcher = imgPatternX.matcher(keepImgHtml) + val matcher = imgPattern.matcher(keepImgHtml) var appendPos = 0 while (matcher.find()) { sb.append(keepImgHtml.substring(appendPos, matcher.start()))