diff options
author | June McEnroe <june@causal.agency> | 2019-07-11 17:11:39 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-07-11 17:11:39 -0400 |
commit | 744b05db5d0b665a7767e92cec432bd494bcff31 (patch) | |
tree | b03aa2a65d1f8814fe34843d15034f689a125afd | |
parent | Ignore SM and RM (diff) | |
download | src-744b05db5d0b665a7767e92cec432bd494bcff31.tar.gz src-744b05db5d0b665a7767e92cec432bd494bcff31.zip |
Output <b>, <i>, <u> in shotty
Diffstat (limited to '')
-rw-r--r-- | bin/shotty.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/bin/shotty.c b/bin/shotty.c index 304be444..d4a7b160 100644 --- a/bin/shotty.c +++ b/bin/shotty.c @@ -231,15 +231,18 @@ 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) printf("</span>"); - printf("<span class=\""); - if (cell->style.bold) printf("bold "); - if (cell->style.italic) printf("italic "); - if (cell->style.underline) printf("underline "); + if (prev) { + if (prev->bold) printf("</b>"); + if (prev->italic) printf("</i>"); + if (prev->underline) printf("</u>"); + printf("</span>"); + } uint bg = (cell->style.reverse ? cell->style.fg : cell->style.bg); uint fg = (cell->style.reverse ? cell->style.bg : cell->style.fg); - if (cell->style.bold && fg < 8) fg += 8; - printf("bg%u fg%u\">", bg, 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>"); } switch (cell->ch) { break; case '&': printf("&"); |