diff options
author | 2017-01-17 01:47:46 +0000 | |
---|---|---|
committer | 2017-01-17 01:47:46 +0000 | |
commit | 229cc7fd611932d0ced8047f6b9191a86a58ba11 (patch) | |
tree | 0db49af6603b46d0be1a19a2c6d74c259d9322d4 /usr.bin/mandoc/tbl_html.c | |
parent | Correctly handle -style options without all of a corresponding -fg/-bg/-attr. (diff) | |
download | wireguard-openbsd-229cc7fd611932d0ced8047f6b9191a86a58ba11.tar.xz wireguard-openbsd-229cc7fd611932d0ced8047f6b9191a86a58ba11.zip |
Simplify the usage of print_otag() by making it accept a variable
number of arguments.
Delete struct htmlpair and all the PAIR_*() macros.
Delete enum htmlattr, handle that in print_otag() instead.
Minus 190 lines of code; no functional change except better ordering
of attributes (class before style) in three cases.
Diffstat (limited to 'usr.bin/mandoc/tbl_html.c')
-rw-r--r-- | usr.bin/mandoc/tbl_html.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/usr.bin/mandoc/tbl_html.c b/usr.bin/mandoc/tbl_html.c index 08e643c0d16..f645f462b00 100644 --- a/usr.bin/mandoc/tbl_html.c +++ b/usr.bin/mandoc/tbl_html.c @@ -1,7 +1,7 @@ -/* $OpenBSD: tbl_html.c,v 1.13 2015/10/12 00:07:27 schwarze Exp $ */ +/* $OpenBSD: tbl_html.c,v 1.14 2017/01/17 01:47:46 schwarze Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv> - * Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -48,9 +48,6 @@ html_tbl_strlen(const char *p, void *arg) static void html_tblopen(struct html *h, const struct tbl_span *sp) { - struct htmlpair tag; - struct roffsu su; - struct roffcol *col; int ic; if (h->tbl.cols == NULL) { @@ -60,19 +57,12 @@ html_tblopen(struct html *h, const struct tbl_span *sp) } assert(NULL == h->tblt); - PAIR_CLASS_INIT(&tag, "tbl"); - h->tblt = print_otag(h, TAG_TABLE, 1, &tag); - - for (ic = 0; ic < sp->opts->cols; ic++) { - bufinit(h); - col = h->tbl.cols + ic; - SCALE_HS_INIT(&su, col->width); - bufcat_su(h, "width", &su); - PAIR_STYLE_INIT(&tag, h); - print_otag(h, TAG_COL, 1, &tag); - } + h->tblt = print_otag(h, TAG_TABLE, "c", "tbl"); + + for (ic = 0; ic < sp->opts->cols; ic++) + print_otag(h, TAG_COL, "shw", h->tbl.cols[ic].width); - print_otag(h, TAG_TBODY, 0, NULL); + print_otag(h, TAG_TBODY, ""); } void @@ -88,7 +78,6 @@ void print_tbl(struct html *h, const struct tbl_span *sp) { const struct tbl_dat *dp; - struct htmlpair tag; struct tag *tt; int ic; @@ -102,19 +91,18 @@ print_tbl(struct html *h, const struct tbl_span *sp) h->flags |= HTML_NONOSPACE; h->flags |= HTML_NOSPACE; - tt = print_otag(h, TAG_TR, 0, NULL); + tt = print_otag(h, TAG_TR, ""); switch (sp->pos) { case TBL_SPAN_HORIZ: case TBL_SPAN_DHORIZ: - PAIR_INIT(&tag, ATTR_COLSPAN, "0"); - print_otag(h, TAG_TD, 1, &tag); + print_otag(h, TAG_TD, "?", "colspan", "0"); break; default: dp = sp->first; for (ic = 0; ic < sp->opts->cols; ic++) { print_stagq(h, tt); - print_otag(h, TAG_TD, 0, NULL); + print_otag(h, TAG_TD, ""); if (dp == NULL || dp->layout->col > ic) continue; |