Table fixes

pull/187/head
M66B 4 years ago
parent 79faffa759
commit 9e4b6c0718

@ -462,7 +462,7 @@ public class HtmlHelper {
.addAttributes(":all", "class") .addAttributes(":all", "class")
.addAttributes(":all", "style") .addAttributes(":all", "style")
.addAttributes("div", "x-plain") .addAttributes("div", "x-plain")
.removeTags("col", "colgroup", "thead", "tbody") .removeTags("col", "colgroup")
.removeAttributes("table", "width") .removeAttributes("table", "width")
.addAttributes("tr", "height") .addAttributes("tr", "height")
.removeAttributes("td", "rowspan", "width") .removeAttributes("td", "rowspan", "width")
@ -858,13 +858,24 @@ public class HtmlHelper {
for (Element col : row.children()) { for (Element col : row.children()) {
cols++; cols++;
if (!"td".equals(col.tagName()) && !"th".equals(col.tagName())) { switch (col.tagName()) {
Log.e("Column expected tag=" + col.tagName()); case "td":
if (tdebug) { break;
col.prependText("COLUMN=" + col.tagName() + "["); case "th":
col.appendText("]"); Element strong = new Element("strong");
} for (Node child : new ArrayList<>(col.childNodes())) {
col.attr("x-block", "true"); child.remove();
strong.appendChild(child);
}
col.appendChild(strong);
break;
default:
Log.e("Column expected tag=" + col.tagName());
if (tdebug) {
col.prependText("COLUMN=" + col.tagName() + "[");
col.appendText("]");
}
col.attr("x-block", "true");
} }
String span = col.attr("colspan"); String span = col.attr("colspan");
@ -893,6 +904,15 @@ public class HtmlHelper {
// Rebuild table // Rebuild table
table.tagName("div"); table.tagName("div");
table.children().remove(); // leaves nodes table.children().remove(); // leaves nodes
for (Element extra : extras) {
if (tdebug) {
extra.prependText("EXTRA=" + extra.tagName() + "[");
extra.appendText("]");
}
table.appendChild(extra.tagName("div").attr("x-block", "true"));
}
for (int c = 0; c < maxcols; c++) { for (int c = 0; c < maxcols; c++) {
Element col = document.createElement("div") Element col = document.createElement("div")
.attr("x-block", "true"); .attr("x-block", "true");
@ -931,14 +951,6 @@ public class HtmlHelper {
.attr("x-block", "true") .attr("x-block", "true")
.attr("x-dashed", "true"); .attr("x-dashed", "true");
} }
for (Element extra : extras) {
if (tdebug) {
extra.prependText("EXTRA=" + extra.tagName() + "[");
extra.appendText("]");
}
table.appendChild(extra.tagName("div").attr("x-block", "true"));
}
} }
// Images // Images

Loading…
Cancel
Save