summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-02-05 18:15:39 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-02-05 18:15:39 +0000
commit937a6b2e1aa8db0008fce66bcff5f7eab8c29190 (patch)
treefe39ca4266fd945094576f59b21a545b946b93a4
parent3b0514c192216cd9a089f8c8cc8b846917fa46fe (diff)
downloadmandoc-937a6b2e1aa8db0008fce66bcff5f7eab8c29190.tar.gz
Improve <table> syntax:
The <col> element can only appear inside <colgroup>, so use <colgroup>. The <tbody> element is optional and useless, so don't use it. Even if we would ever need <thead> or <tfoot>, <tbody> would still be optional and useless; besides, we will likely never need <thead> or <tfoot>, simply because our languages don't support such functionality.
-rw-r--r--html.c2
-rw-r--r--html.h2
-rw-r--r--man_html.c1
-rw-r--r--mdoc_html.c20
-rw-r--r--tbl_html.c5
5 files changed, 17 insertions, 13 deletions
diff --git a/html.c b/html.c
index 0e67a905..82ff911f 100644
--- a/html.c
+++ b/html.c
@@ -65,7 +65,7 @@ static const struct htmldata htmltags[TAG_MAX] = {
{"br", HTML_NOSTACK | HTML_AUTOCLOSE | HTML_NLALL},
{"a", 0},
{"table", HTML_NLALL | HTML_INDENT},
- {"tbody", HTML_NLALL | HTML_INDENT},
+ {"colgroup", HTML_NLALL | HTML_INDENT},
{"col", HTML_NOSTACK | HTML_AUTOCLOSE | HTML_NLALL},
{"tr", HTML_NLALL | HTML_INDENT},
{"td", HTML_NLAROUND},
diff --git a/html.h b/html.h
index 10434e44..67377411 100644
--- a/html.h
+++ b/html.h
@@ -30,7 +30,7 @@ enum htmltag {
TAG_BR,
TAG_A,
TAG_TABLE,
- TAG_TBODY,
+ TAG_COLGROUP,
TAG_COL,
TAG_TR,
TAG_TD,
diff --git a/man_html.c b/man_html.c
index b4e55f64..7db71e2a 100644
--- a/man_html.c
+++ b/man_html.c
@@ -374,7 +374,6 @@ man_root_pre(MAN_ARGS)
mandoc_asprintf(&title, "%s(%s)", man->title, man->msec);
t = print_otag(h, TAG_TABLE, "c", "head");
- print_otag(h, TAG_TBODY, "");
tt = print_otag(h, TAG_TR, "");
print_otag(h, TAG_TD, "c", "head-ltitle");
diff --git a/mdoc_html.c b/mdoc_html.c
index ecb72f7e..586b238f 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -428,7 +428,6 @@ mdoc_root_post(MDOC_ARGS)
struct tag *t, *tt;
t = print_otag(h, TAG_TABLE, "c", "foot");
- print_otag(h, TAG_TBODY, "");
tt = print_otag(h, TAG_TR, "");
print_otag(h, TAG_TD, "c", "foot-date");
@@ -459,7 +458,6 @@ mdoc_root_pre(MDOC_ARGS)
meta->title, meta->msec);
t = print_otag(h, TAG_TABLE, "c", "head");
- print_otag(h, TAG_TBODY, "");
tt = print_otag(h, TAG_TR, "");
print_otag(h, TAG_TD, "c", "head-ltitle");
@@ -574,6 +572,7 @@ mdoc_nd_pre(MDOC_ARGS)
static int
mdoc_nm_pre(MDOC_ARGS)
{
+ struct tag *t;
int len;
switch (n->type) {
@@ -602,9 +601,10 @@ mdoc_nm_pre(MDOC_ARGS)
if (len == 0 && meta->name != NULL)
len = html_strlen(meta->name);
+ t = print_otag(h, TAG_COLGROUP, "");
print_otag(h, TAG_COL, "shw", len);
print_otag(h, TAG_COL, "");
- print_otag(h, TAG_TBODY, "");
+ print_tagq(h, t);
print_otag(h, TAG_TR, "");
return 1;
}
@@ -801,6 +801,7 @@ mdoc_it_pre(MDOC_ARGS)
static int
mdoc_bl_pre(MDOC_ARGS)
{
+ struct tag *t;
struct mdoc_bl *bl;
const char *cattr;
size_t i;
@@ -808,13 +809,11 @@ mdoc_bl_pre(MDOC_ARGS)
bl = &n->norm->Bl;
- if (n->type == ROFFT_BODY) {
- if (bl->type == LIST_column)
- print_otag(h, TAG_TBODY, "");
+ switch (n->type) {
+ case ROFFT_BODY:
return 1;
- }
- if (n->type == ROFFT_HEAD) {
+ case ROFFT_HEAD:
if (bl->type != LIST_column || bl->ncols == 0)
return 0;
@@ -825,10 +824,15 @@ mdoc_bl_pre(MDOC_ARGS)
* screen and we want to preserve that behaviour.
*/
+ t = print_otag(h, TAG_COLGROUP, "");
for (i = 0; i < bl->ncols - 1; i++)
print_otag(h, TAG_COL, "sww", bl->cols[i]);
print_otag(h, TAG_COL, "swW", bl->cols[i]);
+ print_tagq(h, t);
return 0;
+
+ default:
+ break;
}
switch (bl->type) {
diff --git a/tbl_html.c b/tbl_html.c
index 8894669d..b230c9c3 100644
--- a/tbl_html.c
+++ b/tbl_html.c
@@ -50,6 +50,7 @@ html_tbl_strlen(const char *p, void *arg)
static void
html_tblopen(struct html *h, const struct tbl_span *sp)
{
+ struct tag *t;
int ic;
if (h->tbl.cols == NULL) {
@@ -61,10 +62,10 @@ html_tblopen(struct html *h, const struct tbl_span *sp)
assert(NULL == h->tblt);
h->tblt = print_otag(h, TAG_TABLE, "c", "tbl");
+ t = print_otag(h, TAG_COLGROUP, "");
for (ic = 0; ic < sp->opts->cols; ic++)
print_otag(h, TAG_COL, "shw", h->tbl.cols[ic].width);
-
- print_otag(h, TAG_TBODY, "");
+ print_tagq(h, t);
}
void