diff options
author | June McEnroe <june@causal.agency> | 2021-10-20 17:39:30 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2021-10-20 17:39:30 -0400 |
commit | 5e29b86b600a0330dea18880db4fc2c2d1a03357 (patch) | |
tree | 1304569904be0d00e652395dbeaa3376a9b57222 /bin | |
parent | Run shotty after ptee in up -t (diff) | |
download | src-5e29b86b600a0330dea18880db4fc2c2d1a03357.tar.gz src-5e29b86b600a0330dea18880db4fc2c2d1a03357.zip |
Only output style attribute if necessary
Diffstat (limited to 'bin')
-rw-r--r-- | bin/shotty.l | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/shotty.l b/bin/shotty.l index 6eacdc4f..c33b1f8b 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("&"); |