修复xpath获取alt属性规则

pull/1653/head
syomie 3 years ago
parent de41eac7a1
commit 510ee30f44
  1. 5
      app/src/main/java/io/legado/app/help/ruleComplete.kt

@ -26,18 +26,21 @@ fun ruleComplete(rule:String?,preRule:String?="",type:Int=1):String?{
var textRule:String
var linkRule:String
var imgRule:String
var imgText:String
if (rule.contains(Regex("/[^@]+$"))){
textRule="/text()"
linkRule="/@href"
imgRule="/@src"
imgText="img/@alt"
}else{
textRule="@text"
linkRule="@href"
imgRule="@src"
imgText="img@alt"
}
var ret:String=rule
when(type){
1 -> ret = rule.replace(Regex("$"),textRule).replace(imgComplete,"img@alt")
1 -> ret = rule.replace(Regex("$"),textRule).replace(imgComplete,imgText)
2 -> ret = rule.replace(Regex("$"),linkRule)
3 -> ret = rule.replace(Regex("$"),imgRule)
}

Loading…
Cancel
Save