Skip to content

Commit

Permalink
fix markdown and html export of empty table cells
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxim Moinat committed Jun 9, 2020
1 parent 487139f commit 982e353
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,14 @@ public void addTable(List<Row> rows) {

for (Row row : rows) {
line = new StringBuilder();
for (String value : row.getCells())
line.append("| ").append(value.replaceAll("\n", " ")).append(" ");
for (String value : row.getCells()) {
if (value != null) {
value = value.replaceAll("\n", " ");
} else {
value = "";
}
line.append("| ").append(value).append(" ");
}
line.append("|");
lines.add(line.toString());
}
Expand Down Expand Up @@ -415,8 +421,12 @@ public void addTable(List<Row> rows) {

for (Row row : rows) {
lines.add("\t<tr>");
for (String cell : row.getCells())
for (String cell : row.getCells()) {
if (cell == null) {
cell = "";
}
lines.add("\t\t<td>" + cell + "</td>");
}
lines.add("\t</tr>");
}
lines.add("</table>");
Expand Down

0 comments on commit 982e353

Please sign in to comment.