pull/1127/head
bushixuanqi 3 years ago
parent c215685672
commit 5c89c39539
  1. 7
      app/src/main/java/io/legado/app/utils/HtmlFormatter.kt

@ -34,9 +34,10 @@ object HtmlFormatter {
while (matcher.find()) { while (matcher.find()) {
val url = matcher.group(1)!! val url = matcher.group(1)!!
val urlBefore = url.substringBefore(',') val urlBefore = url.substringBefore(',')
val StrBefore = keepImgHtml.substring(appendPos, matcher.start())
sb.append( sb.append(
keepImgHtml.substring(appendPos, matcher.start()).replace("\n", "\n  ") if(StrBefore.isBlank()) StrBefore else StrBefore.replace("\n", "\n  ") //缩进图片之间的非空白段落
) //缩进换行下个非图片段落 )
sb.append( sb.append(
"<img src=\"${ "<img src=\"${
NetworkUtils.getAbsoluteURL( NetworkUtils.getAbsoluteURL(
@ -51,7 +52,7 @@ object HtmlFormatter {
} }
if (endPos < keepImgHtml.length) { if (endPos < keepImgHtml.length) {
sb.append( keepImgHtml.substring( endPos, keepImgHtml.length ).replace("\n","\n  ") ) //缩进换行下个非图片段落 sb.append( keepImgHtml.substring( endPos, keepImgHtml.length ).replace("\n","\n  ") ) //缩进图片之间的非空白段落
} }
return sb.toString() return sb.toString()
} }

Loading…
Cancel
Save