Skip to content

Commit

Permalink
Do not emit HTML export for curdrawroot (#505)
Browse files Browse the repository at this point in the history
* Do not emit HTML export for curdrawroot

- `curdrawroot` only holds the default style information, so do not emit it.
- This avoids a `td` node without the parent `table` node in the HTML export.

* Do not emit text-decoration style attribute for empty text
  • Loading branch information
tobiolo authored Sep 9, 2023
1 parent 3994f4c commit 2dedfa4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ struct Cell {
uint SwapColor(uint c) { return ((c & 0xFF) << 16) | (c & 0xFF00) | ((c & 0xFF0000) >> 16); }
wxString ToText(int indent, const Selection &s, int format, Document *doc, bool inheritstyle) {
wxString str = text.ToText(indent, s, format);
if (format == A_EXPHTMLT && ((text.stylebits & STYLE_UNDERLINE) || (text.stylebits & STYLE_STRIKETHRU))) {
if (format == A_EXPHTMLT && ((text.stylebits & STYLE_UNDERLINE) || (text.stylebits & STYLE_STRIKETHRU))
&& this != doc->curdrawroot && !str.IsEmpty()) {
wxString spanstyle = L"text-decoration:";
spanstyle += (text.stylebits & STYLE_UNDERLINE) ? L" underline" : wxEmptyString;
spanstyle += (text.stylebits & STYLE_STRIKETHRU) ? L" line-through" : wxEmptyString;
Expand Down Expand Up @@ -255,7 +256,7 @@ struct Cell {
str.Prepend(L"<cell");
str.Append(L' ', indent);
str.Append(L"</cell>\n");
} else if (format == A_EXPHTMLT) {
} else if (format == A_EXPHTMLT && this != doc->curdrawroot) {
wxString style;
if (!inheritstyle || !parent || (text.stylebits & STYLE_BOLD) != (parent->text.stylebits & STYLE_BOLD))
style += (text.stylebits & STYLE_BOLD) ? L"font-weight: bold;" : L"font-weight: normal;";
Expand Down

0 comments on commit 2dedfa4

Please sign in to comment.