Merge pull request #1172 from celetor/patch-2

修复epub格式化
pull/1238/head
kunfei 3 years ago committed by GitHub
commit 4f81e5695f
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