From 4a74b96c220b9fb37a33f6194b2f7254a94fe1e4 Mon Sep 17 00:00:00 2001
From: bushixuanqi <57338301+bushixuanqi@users.noreply.github.com>
Date: Tue, 15 Jun 2021 16:16:17 +0800
Subject: [PATCH] Update AppPattern.kt
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
修复上次修改时,忘记在src前加[^>]*,导致没有数据属性的图片标签没被匹配到的问题。
---
app/src/main/java/io/legado/app/constant/AppPattern.kt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/main/java/io/legado/app/constant/AppPattern.kt b/app/src/main/java/io/legado/app/constant/AppPattern.kt
index cea60d9c5..027b68556 100644
--- a/app/src/main/java/io/legado/app/constant/AppPattern.kt
+++ b/app/src/main/java/io/legado/app/constant/AppPattern.kt
@@ -9,7 +9,7 @@ object AppPattern {
val EXP_PATTERN: Pattern = Pattern.compile("\\{\\{([\\w\\W]*?)\\}\\}")
//图片有data-开头的数据属性时优先用数据属性作为src,没有数据属性时才匹配src
val imgPattern: Pattern =
- Pattern.compile("", Pattern.CASE_INSENSITIVE)
+ Pattern.compile("]*data-)[^>]*src|(?=[^>]*data-)[^>]*data-[^= ]+) *= *\"([^\"{]+(?:\\{(?:[^{}]|\\{[^{}]*\\})*\\})?)\"[^>]*>", Pattern.CASE_INSENSITIVE)
val nameRegex = Regex("\\s+作\\s*者.*|\\s+\\S+\\s+著")
val authorRegex = Regex("^.*?作\\s*者[::\\s]*|\\s+著")