Update HtmlFormatter.kt

优化
pull/1123/head
bushixuanqi 3 years ago committed by GitHub
parent 23f449e2ad
commit 2c4d6c7367
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      app/src/main/java/io/legado/app/utils/HtmlFormatter.kt

@ -60,8 +60,7 @@ object HtmlFormatter {
do{ do{
val url = matcher.group(1)!! val url = matcher.group(1)!!
val urlBefore = url.substringBefore(',') val urlBefore = url.substringBefore(',')
val beforeStr = keepImgHtml.substring(appendPos, matcher.start()) sb.append( keepImgHtml.substring(appendPos, matcher.start()).replace("\n","\n  ") ) //缩进换行下个非图片段落
sb.append( if(beforeStr == "\n") '\n' else beforeStr.replace("\n","\n  ") ) //缩进换行下个非图片段落
sb.append( sb.append(
"<img src=\"${ "<img src=\"${
NetworkUtils.getAbsoluteURL( NetworkUtils.getAbsoluteURL(
@ -79,8 +78,7 @@ object HtmlFormatter {
} }
if (appendPos < keepImgHtml.length) { if (appendPos < keepImgHtml.length) {
val beforeStr = keepImgHtml.substring(appendPos, keepImgHtml.length) sb.append( keepImgHtml.substring( appendPos, keepImgHtml.length ).replace("\n","\n  ") ) //缩进换行下个非图片段落
sb.append( if(beforeStr == "\n") '\n' else beforeStr.replace("\n","\n  ") ) //缩进换行下个非图片段落
} }
return sb.toString() return sb.toString()
} }

Loading…
Cancel
Save