diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2018-11-26 01:51:46 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2018-11-26 01:51:46 +0000 |
commit | 9a942b0d761cb1d28c369ba2eee07297a956abd0 (patch) | |
tree | 57cae3fdfaaf2b948c35a73eae2d1963469c90ca | |
parent | 61fcffec773b678355426660027d08c645313d1e (diff) | |
download | mandoc-9a942b0d761cb1d28c369ba2eee07297a956abd0.tar.gz mandoc-9a942b0d761cb1d28c369ba2eee07297a956abd0.tar.zst mandoc-9a942b0d761cb1d28c369ba2eee07297a956abd0.zip |
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.
-rw-r--r-- | tbl_html.c | 22 |
1 files changed, 5 insertions, 17 deletions
@@ -1,4 +1,4 @@ -/* $Id: tbl_html.c,v 1.27 2018/11/25 21:17:34 schwarze Exp $ */ +/* $Id: tbl_html.c,v 1.28 2018/11/26 01:51:46 schwarze Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014, 2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org> @@ -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); } |