段评相关

感谢@Luoyacheng,https://github.com/Luoyacheng/legado
This commit is contained in:
HapeLee committed 2025-09-24 19:24:06 +08:00
1 parent 53a1a6c89a
commit 891ec2a6ec
7 files changed
+1980 -65

No files matched your search

@@ -9,11 +9,22 @@ object AppPattern {
val EXP_PATTERN: Pattern = Pattern.compile("\\{\\{([\\w\\W]*?)\\}\\}")
//匹配格式化后的图片格式
val imgPattern: Pattern =
Pattern.compile("<img[^>]*src=['\"]([^'\"]*(?:['\"][^>]+\\})?)['\"][^>]*>")
val imgPattern: Pattern = Pattern.compile("<img[^>]*src=\"([^\"]*(?:\"[^>]+\\})?)\"[^>]*>")
//dataURL图片类型
val dataUriRegex = Regex("^data:.*?;base64,(.*)")
//提取标题中的段评
val imgRegex = Regex("(.*)((?:data|https?):[\\s\\S]+)$")
//自定义图片样式
val imgStyRegex = Regex("style[\"'\\s]*:\\s*[\"']([^\"']*)[\"']")
//匹配章节信息中的字数
val wordCountRegex = Regex("(?:^|字数[::、]?|\\s+)([0-9万千百\\.]{1,6}字)")
//正文不计入字数的字符
val noWordCountRegex = Regex("[\\s\\u200B-\\u200F\\uFEFF]")
//提取链接中的域名
val domainRegex = Regex("^https?://([^:/]+)",RegexOption.IGNORE_CASE)
val nameRegex = Regex("\\s+作\\s*者.*|\\s+\\S+\\s+著")
val authorRegex = Regex("^\\s*作\\s*者[::\\s]+|\\s+著")
@@ -55,4 +66,4 @@ object AppPattern {
val regexCharRegex = "[{}()\\[\\].+*?^$\\\\|]".toRegex()
val LFRegex = "\n".toRegex()
}
}