summary refs log tree commit diff
path: root/bin/shotty.l
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
commit5e29b86b600a0330dea18880db4fc2c2d1a03357 (patch)
tree1304569904be0d00e652395dbeaa3376a9b57222 /bin/shotty.l
parentRun shotty after ptee in up -t (diff)
downloadsrc-5e29b86b600a0330dea18880db4fc2c2d1a03357.tar.gz
src-5e29b86b600a0330dea18880db4fc2c2d1a03357.zip
Only output style attribute if necessary
Diffstat (limited to '')
-rw-r--r--bin/shotty.l5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/shotty.l b/bin/shotty.l
index 6eacdc4..c33b1f8 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;");