aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit24fd28849fa784bd04e3f5bbdb7152253c5d68ba (patch)
tree815cb714ddc062542177ba1156b3ddf9d58061f5 /tbl_html.c
parentebd515705cd44f744240e095a723a476fb6a95ef (diff)
downloadmandoc-24fd28849fa784bd04e3f5bbdb7152253c5d68ba.tar.gz
mandoc-24fd28849fa784bd04e3f5bbdb7152253c5d68ba.tar.zst
mandoc-24fd28849fa784bd04e3f5bbdb7152253c5d68ba.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 'tbl_html.c')
-rw-r--r--tbl_html.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/tbl_html.c b/tbl_html.c
index 51c43286..962d900e 100644
--- a/tbl_html.c
+++ b/tbl_html.c
@@ -1,7 +1,7 @@
-/* $Id: tbl_html.c,v 1.18 2015/10/12 00:08:16 schwarze Exp $ */
+/* $Id: tbl_html.c,v 1.19 2017/01/17 01:47:51 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
@@ -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;