From 1ae734e36db4e307c4154074daa6f5583a00fa3a Mon Sep 17 00:00:00 2001 From: schwarze Date: Thu, 9 Sep 2021 14:45:18 +0000 Subject: [PATCH] If the layout or data of an individual cell in a tbl(7) contains only "_", "-", or "=", requesting a horizontal line to be drawn across the middle of the cell, print
in that cell in HTML output. That is arguably slightly ugly because HTML 5 regards
as semantic markup, meaning "thematic break". If somebody knowns a better way to render a horizontal line across the middle of a table cell with pure HTML and CSS, and without implying a specific meaning, please tell me. Missing feature reported by . --- usr.bin/mandoc/html.c | 3 ++- usr.bin/mandoc/html.h | 3 ++- usr.bin/mandoc/tbl_html.c | 9 +++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c index 799d06508a4..1e996daf439 100644 --- a/usr.bin/mandoc/html.c +++ b/usr.bin/mandoc/html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: html.c,v 1.145 2021/08/10 12:36:42 schwarze Exp $ */ +/* $OpenBSD: html.c,v 1.146 2021/09/09 14:45:18 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * Copyright (c) 2011-2015, 2017-2021 Ingo Schwarze @@ -89,6 +89,7 @@ static const struct htmldata htmltags[TAG_MAX] = { {"span", HTML_INPHRASE | HTML_TOPHRASE}, {"var", HTML_INPHRASE | HTML_TOPHRASE}, {"br", HTML_INPHRASE | HTML_NOSTACK | HTML_NLALL}, + {"hr", HTML_INPHRASE | HTML_NOSTACK}, {"mark", HTML_INPHRASE }, {"math", HTML_INPHRASE | HTML_NLALL | HTML_INDENT}, {"mrow", 0}, diff --git a/usr.bin/mandoc/html.h b/usr.bin/mandoc/html.h index dcce339fe8c..06ba51e7d72 100644 --- a/usr.bin/mandoc/html.h +++ b/usr.bin/mandoc/html.h @@ -1,4 +1,4 @@ -/* $OpenBSD: html.h,v 1.70 2020/04/18 20:28:46 schwarze Exp $ */ +/* $OpenBSD: html.h,v 1.71 2021/09/09 14:45:18 schwarze Exp $ */ /* * Copyright (c) 2017, 2018, 2019, 2020 Ingo Schwarze * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons @@ -51,6 +51,7 @@ enum htmltag { TAG_SPAN, TAG_VAR, TAG_BR, + TAG_HR, TAG_MARK, TAG_MATH, TAG_MROW, diff --git a/usr.bin/mandoc/tbl_html.c b/usr.bin/mandoc/tbl_html.c index d92a09182e2..acad113d7da 100644 --- a/usr.bin/mandoc/tbl_html.c +++ b/usr.bin/mandoc/tbl_html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tbl_html.c,v 1.31 2021/08/10 12:36:42 schwarze Exp $ */ +/* $OpenBSD: tbl_html.c,v 1.32 2021/09/09 14:45:18 schwarze Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons * Copyright (c) 2014,2015,2017,2018,2021 Ingo Schwarze @@ -239,7 +239,12 @@ print_tbl(struct html *h, const struct tbl_span *sp) "vertical-align", valign, "text-align", halign, "border-right-style", rborder); - if (dp->string != NULL) { + if (dp->layout->pos == TBL_CELL_HORIZ || + dp->layout->pos == TBL_CELL_DHORIZ || + dp->pos == TBL_DATA_HORIZ || + dp->pos == TBL_DATA_DHORIZ) + print_otag(h, TAG_HR, ""); + else if (dp->string != NULL) { save_font = h->metac; html_setfont(h, dp->layout->font); if (dp->layout->pos == TBL_CELL_LONG) -- 2.20.1