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