summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-10-20 17:39:30 -0400
committerJune McEnroe <june@causal.agency>2021-10-20 17:39:30 -0400
commitc7b458887737f33a0b21c1ab35854072eec795e8 (patch)
treed925053729c189a1fb805f1d9ca161b5510eb2b1
parentRun shotty after ptee in up -t (diff)
downloadsrc-c7b458887737f33a0b21c1ab35854072eec795e8.tar.gz
src-c7b458887737f33a0b21c1ab35854072eec795e8.zip
Only output style attribute if necessary
-rw-r--r--bin/shotty.l5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/shotty.l b/bin/shotty.l
index e9edb515..8018d785 100644
--- a/bin/shotty.l
+++ b/bin/shotty.l
@@ -493,7 +493,8 @@ static void span(const struct Cell *prev, const struct Cell *cell) {
 			if (fg < 8) fg += 8;
 			attr &= ~Bold;
 		}
-		printf(Q(<span class="bg%d fg%d" style=) "\"", bg, fg);
+		printf(Q(<span class="bg%d fg%d"), bg, fg);
+		if (attr || colors) printf(" style=\"");
 		if (attr & Bold) printf("font-weight:bold;");
 		if (attr & Italic) printf("font-style:italic;");
 		if (attr & Underline) printf("text-decoration:underline;");
@@ -503,7 +504,7 @@ static void span(const struct Cell *prev, const struct Cell *cell) {
 				Palette[bg], Palette[fg]
 			);
 		}
-		printf("\">");
+		printf("%s>", (attr || colors ? "\"" : ""));
 	}
 	switch (cell->ch) {
 		break; case L'&': printf("&amp;");