aboutsummaryrefslogtreecommitdiffstatshomepage
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
commitc6e62f9888a3bce6f8b3f7a4ee028dbdfc01ab1f (patch)
tree5b001c4f9597be2aa5b561fe3d2bd93dae2735ec
parent917cc472b6d91e5bac0a2f3cdf26e113a64ecd45 (diff)
downloadmandoc-c6e62f9888a3bce6f8b3f7a4ee028dbdfc01ab1f.tar.gz
mandoc-c6e62f9888a3bce6f8b3f7a4ee028dbdfc01ab1f.tar.zst
mandoc-c6e62f9888a3bce6f8b3f7a4ee028dbdfc01ab1f.zip
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.c4
-rw-r--r--html.h4
-rw-r--r--man_html.c3
-rw-r--r--mdoc_html.c22
-rw-r--r--tbl_html.c7
5 files changed, 22 insertions, 18 deletions
diff --git a/html.c b/html.c
index 8f1e3df4..bf3d13ce 100644
--- a/html.c
+++ b/html.c
@@ -1,4 +1,4 @@
-/* $Id: html.c,v 1.204 2017/01/29 14:02:41 schwarze Exp $ */
+/* $Id: html.c,v 1.205 2017/02/05 18:15:39 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -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 7b2de501..afceebad 100644
--- a/html.h
+++ b/html.h
@@ -1,4 +1,4 @@
-/* $Id: html.h,v 1.80 2017/01/29 14:02:42 schwarze Exp $ */
+/* $Id: html.h,v 1.81 2017/02/05 18:15:39 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -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 777ffa63..9151e4c7 100644
--- a/man_html.c
+++ b/man_html.c
@@ -1,4 +1,4 @@
-/* $Id: man_html.c,v 1.132 2017/01/30 20:24:02 schwarze Exp $ */
+/* $Id: man_html.c,v 1.133 2017/02/05 18:15:39 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -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 b32aaaf3..9dc82953 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.264 2017/01/29 14:02:42 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.265 2017/02/05 18:15:39 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -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 962d900e..4dff2937 100644
--- a/tbl_html.c
+++ b/tbl_html.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_html.c,v 1.19 2017/01/17 01:47:51 schwarze Exp $ */
+/* $Id: tbl_html.c,v 1.20 2017/02/05 18:15:39 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -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