summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/tbl_html.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2018-11-26 01:51:41 +0000
committerschwarze <schwarze@openbsd.org>2018-11-26 01:51:41 +0000
commit71d7c80e351beb81935458dbdd217fcf8fefbf7c (patch)
tree5805f1707b034df51733ca022bce143e457f2851 /usr.bin/mandoc/tbl_html.c
parentSupport more than one style attribute one the same HTML element. (diff)
downloadwireguard-openbsd-71d7c80e351beb81935458dbdd217fcf8fefbf7c.tar.xz
wireguard-openbsd-71d7c80e351beb81935458dbdd217fcf8fefbf7c.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.
Diffstat (limited to 'usr.bin/mandoc/tbl_html.c')
-rw-r--r--usr.bin/mandoc/tbl_html.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/usr.bin/mandoc/tbl_html.c b/usr.bin/mandoc/tbl_html.c
index 03c55004d1f..6efc748f50c 100644
--- a/usr.bin/mandoc/tbl_html.c
+++ b/usr.bin/mandoc/tbl_html.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tbl_html.c,v 1.22 2018/11/25 21:17:30 schwarze Exp $ */
+/* $OpenBSD: tbl_html.c,v 1.23 2018/11/26 01:51:41 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -173,22 +173,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);
}