From c6e62f9888a3bce6f8b3f7a4ee028dbdfc01ab1f Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 5 Feb 2017 18:15:39 +0000 Subject: [PATCH] Improve syntax: The element can only appear inside , so use . The element is optional and useless, so don't use it. Even if we would ever need or , would still be optional and useless; besides, we will likely never need or , simply because our languages don't support such functionality. --- html.c | 4 ++-- html.h | 4 ++-- man_html.c | 3 +-- mdoc_html.c | 22 +++++++++++++--------- tbl_html.c | 7 ++++--- 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 * Copyright (c) 2011-2015, 2017 Ingo Schwarze @@ -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 * Copyright (c) 2017 Ingo Schwarze @@ -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 * Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze @@ -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 * Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze @@ -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 * Copyright (c) 2014, 2015, 2017 Ingo Schwarze @@ -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 -- 2.47.1