to be compatible with desktop app, remove the <code> element which is the only child of <pre>

This commit is contained in:
houxg
2016-12-15 13:27:21 +08:00
parent 899d647028
commit 6e557f398d

View File

@@ -76,6 +76,16 @@ public class HtmlImporter {
}
}
for (Element preElement : document.body().select("pre")) {
Elements children = preElement.children();
if (children.size() == 1 && "code".equals(children.first().nodeName())) {
Element codeElement = children.first();
String codeHtml = codeElement.html();
codeElement.remove();
preElement.html(codeHtml);
}
}
if (mShouldRemoveAttributes) {
for (Element element : document.body().select(NORMAL_TAGS)) {
removeElementsAttributes(element);