Fixed/improved pre processing

This commit is contained in:
M66B 2019-09-25 18:05:13 +02:00
parent a8a5ed99a1
commit c5c121e6a1
1 changed files with 23 additions and 22 deletions

View File

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