summaryrefslogtreecommitdiffstats
path: root/tbl_html.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2018-11-26 01:51:46 +0000
committerIngo Schwarze <schwarze@openbsd.org>2018-11-26 01:51:46 +0000
commit7afb42b3f0ce890a6e9f9d04f3ee354e8309f63e (patch)
treec4d2482cf1112063d58272041afa501ee3617be3 /tbl_html.c
parent37a9c2800e52ed5cc47923cb4cf5eb39453ba4b7 (diff)
downloadmandoc-7afb42b3f0ce890a6e9f9d04f3ee354e8309f63e.tar.gz
Simplify writing of tbl(7) cells by using the new feature of passing
a NULL pointer for the value of a style attribute, in which case the attribute is omitted from the HTML element. Minus 12 lines of ugly and repetitive code, no functional change.
Diffstat (limited to 'tbl_html.c')
-rw-r--r--tbl_html.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/tbl_html.c b/tbl_html.c
index 8d408211..6ff72aad 100644
--- a/tbl_html.c
+++ b/tbl_html.c
@@ -175,22 +175,10 @@ print_tbl(struct html *h, const struct tbl_span *sp)
/* Print the element and the attributes. */
- if (halign == NULL && valign == NULL)
- print_otag(h, TAG_TD, "??",
- "colspan", hspans, "rowspan", vspans);
- else if (halign == NULL)
- print_otag(h, TAG_TD, "??s",
- "colspan", hspans, "rowspan", vspans,
- "vertical-align", valign);
- else if (valign == NULL)
- print_otag(h, TAG_TD, "??s",
- "colspan", hspans, "rowspan", vspans,
- "text-align", halign);
- else
- print_otag(h, TAG_TD, "??ss",
- "colspan", hspans, "rowspan", vspans,
- "vertical-align", valign,
- "text-align", halign);
+ print_otag(h, TAG_TD, "??ss",
+ "colspan", hspans, "rowspan", vspans,
+ "vertical-align", valign,
+ "text-align", halign);
if (dp->string != NULL)
print_text(h, dp->string);
}