Fixed/improved pre processing

pull/162/head
M66B 5 years ago
parent a8a5ed99a1
commit c5c121e6a1

@ -233,6 +233,9 @@ public class HtmlHelper {
} }
} }
if (sb.length() == 0)
span.removeAttr("style");
else
span.attr("style", sb.toString()); span.attr("style", sb.toString());
} }
} }
@ -255,10 +258,10 @@ public class HtmlHelper {
// Pre formatted text // Pre formatted text
for (Element pre : document.select("pre")) { for (Element pre : document.select("pre")) {
Element div = document.createElement("div"); Element div = document.createElement("font");
div.attr("face", "monospace");
for (TextNode tnode : pre.textNodes()) { String[] lines = pre.wholeText().split("\\r?\\n");
String[] lines = tnode.getWholeText().split("\\r?\\n");
for (String line : lines) { for (String line : lines) {
line = Html.escapeHtml(line); line = Html.escapeHtml(line);
@ -277,8 +280,6 @@ public class HtmlHelper {
span.html(sb.toString()); span.html(sb.toString());
div.appendChild(span); div.appendChild(span);
div.appendElement("br"); div.appendElement("br");
Log.i("span html=" + span.html());
}
} }
pre.replaceWith(div); pre.replaceWith(div);

Loading…
Cancel
Save