Preserve Microsoft document parts

pull/210/head
M66B 2 years ago
parent 6d5c9f279a
commit 19ce6b36c0

@ -1637,6 +1637,7 @@ public class HtmlHelper {
// xmlns="http://www.w3.org/TR/REC-html40"> // xmlns="http://www.w3.org/TR/REC-html40">
// <o:p>&nbsp;</o:p></span> // <o:p>&nbsp;</o:p></span>
// <w:Sdt DocPart="0C3EDB8F875B40C899499DE56A431990" ...
// Default XHTML namespace: http://www.w3.org/1999/xhtml // Default XHTML namespace: http://www.w3.org/1999/xhtml
// https://developer.mozilla.org/en-US/docs/Related/IMSC/Namespaces // https://developer.mozilla.org/en-US/docs/Related/IMSC/Namespaces
@ -1659,7 +1660,7 @@ public class HtmlHelper {
String tag = e.tagName(); String tag = e.tagName();
if (tag.contains(":")) { if (tag.contains(":")) {
boolean show = (ns == null || tag.startsWith(ns) || boolean show = (ns == null || tag.startsWith(ns) ||
tag.startsWith("html:") || tag.startsWith("body:")); tag.startsWith("html:") || tag.startsWith("body:") || tag.startsWith("w:"));
if (display_hidden || show) { if (display_hidden || show) {
String[] nstag = tag.split(":"); String[] nstag = tag.split(":");
String t = nstag[nstag.length > 1 ? 1 : 0]; String t = nstag[nstag.length > 1 ? 1 : 0];
@ -1674,9 +1675,9 @@ public class HtmlHelper {
} }
} else { } else {
e.remove(); e.remove();
Log.i("Removed tag=" + tag); Log.i("Removed tag=" + tag + " ns=" + ns + " content=" + e.text());
} }
} else if (!"html".equals(tag) && !"body".equals(tag)) { } else if (!"html".equals(tag) && !"body".equals(tag) && !"w".equals(tag)) {
String xmlns = e.attr("xmlns").toLowerCase(Locale.ROOT); String xmlns = e.attr("xmlns").toLowerCase(Locale.ROOT);
if (!TextUtils.isEmpty(xmlns) && !xmlns.contains(W3NS)) { if (!TextUtils.isEmpty(xmlns) && !xmlns.contains(W3NS)) {
if (display_hidden) { if (display_hidden) {
@ -1684,7 +1685,7 @@ public class HtmlHelper {
e.attr("style", mergeStyles(style, "text-decoration:line-through;")); e.attr("style", mergeStyles(style, "text-decoration:line-through;"));
} else { } else {
e.remove(); e.remove();
Log.i("Removed tag=" + tag + " xmlns=" + xmlns); Log.i("Removed tag=" + tag + " ns=" + ns + " xmlns=" + xmlns + " content=" + e.text());
} }
} }
} }

Loading…
Cancel
Save