summaryrefslogtreecommitdiffstats
path: root/tbl_html.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-01-17 01:47:51 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-01-17 01:47:51 +0000
commit3786665f3a0f980a9bbbcb5cd8d674cc679491ab (patch)
treec02a6d2574b2570b9d9e8e04140906512a268118 /tbl_html.c
parent7285dcc5cc02f2e79f96fd4647cb1f1ac094b26b (diff)
downloadmandoc-3786665f3a0f980a9bbbcb5cd8d674cc679491ab.tar.gz
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 'tbl_html.c')
-rw-r--r--tbl_html.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/tbl_html.c b/tbl_html.c
index ae43ff78..8894669d 100644
--- a/tbl_html.c
+++ b/tbl_html.c
@@ -1,7 +1,7 @@
/* $Id$ */
/*
* 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
@@ -50,9 +50,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) {
@@ -62,19 +59,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
@@ -90,7 +80,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;
@@ -104,19 +93,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;