修复epub格式化

pull/1172/head
celetor 3 years ago committed by GitHub
parent 4f0c48ec0f
commit e65219a2d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      epublib/src/main/java/me/ag2s/epublib/util/StringUtil.java

@ -280,8 +280,9 @@ public class StringUtil {
s = s.replaceAll("^\\s+|\\s+$", ""); s = s.replaceAll("^\\s+|\\s+$", "");
if (s.length() > 0) { if (s.length() > 0) {
if (s.toLowerCase().contains("<img")) { if (s.toLowerCase().contains("<img")) {
body.append(s.replaceAll("(?i)<img\\s([^>]+)/?>", "<div class=\"duokan-image-single\"><img class=\"picture-80\" $1/></div>")); s = s.replaceAll("(?i)<img\\s([^>]+)/?>", "<div class=\"duokan-image-single\"><img class=\"picture-80\" $1/></div>");
} else { }
if (!(s.startsWith("<div") && s.endsWith("</div>"))) {
body.append("<p>").append(s).append("</p>"); body.append("<p>").append(s).append("</p>");
} }
} }

Loading…
Cancel
Save