diff options
author | June McEnroe <june@causal.agency> | 2019-07-11 17:43:40 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-07-11 17:43:40 -0400 |
commit | 12f0a2b1c3a0817656ac8d7fd80335e260e90a4e (patch) | |
tree | 602cd83abcd8187b9ab88de0ddc51f1f95cabfb8 /bin | |
parent | Factor out clear (diff) | |
download | src-12f0a2b1c3a0817656ac8d7fd80335e260e90a4e.tar.gz src-12f0a2b1c3a0817656ac8d7fd80335e260e90a4e.zip |
Use inline style rather than <b>, <i>, <u>
Diffstat (limited to '')
-rw-r--r-- | bin/shotty.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/bin/shotty.c b/bin/shotty.c index e5f05bbf..68a2f03d 100644 --- a/bin/shotty.c +++ b/bin/shotty.c @@ -232,18 +232,16 @@ static void update(wchar_t ch) { static void html(const struct Style *prev, const struct Cell *cell) { if (!prev || memcmp(&cell->style, prev, sizeof(cell->style))) { - if (prev) { - if (prev->bold) printf("</b>"); - if (prev->italic) printf("</i>"); - if (prev->underline) printf("</u>"); - printf("</span>"); - } + if (prev) printf("</span>"); uint bg = (cell->style.reverse ? cell->style.fg : cell->style.bg); uint fg = (cell->style.reverse ? cell->style.bg : cell->style.fg); - printf("<span class=\"bg%u fg%u\">", bg, fg); - if (cell->style.bold) printf("<b>"); - if (cell->style.italic) printf("<i>"); - if (cell->style.underline) printf("<u>"); + printf( + "<span style=\"%s%s%s\" class=\"bg%u fg%u\">", + cell->style.bold ? "font-weight:bold;" : "", + cell->style.italic ? "font-style:italic;" : "", + cell->style.underline ? "text-decoration:underline;" : "", + bg, fg + ); } switch (cell->ch) { break; case '&': printf("&"); |