summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-07-11 17:43:40 -0400
committerJune McEnroe <june@causal.agency>2019-07-11 17:43:40 -0400
commitbd985953cf8c45a7d9a92ece8a986975c3ac496a (patch)
tree7ddb252f95b934157d1eb3e9c261b482a3bbb75c /bin
parentFactor out clear (diff)
downloadsrc-bd985953cf8c45a7d9a92ece8a986975c3ac496a.tar.gz
src-bd985953cf8c45a7d9a92ece8a986975c3ac496a.zip
Use inline style rather than <b>, <i>, <u>
Diffstat (limited to '')
-rw-r--r--bin/shotty.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/bin/shotty.c b/bin/shotty.c
index 765be47d..8a08fbe5 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("&amp;");