From 3fec44d9300e7b532fd53472f9ad052381c17bc7 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Fri, 12 May 2017 17:58:21 +0000 Subject: Make the tag column in .Bl -tag lists wider: 1. I forgot about the 2n padding between tag and body. 2. The factor 1.1 was too small for bold fold, make it *1.15 + 1n. Ugliness spotted by tb@. --- html.c | 16 +++++++++++----- mandoc_html.3 | 22 +++++++++++++++------- mdoc_html.c | 10 +++++----- 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/html.c b/html.c index e424754b..55ef965f 100644 --- a/html.c +++ b/html.c @@ -1,4 +1,4 @@ -/* $Id: html.c,v 1.210 2017/03/15 11:29:53 schwarze Exp $ */ +/* $Id: html.c,v 1.211 2017/05/12 17:58:21 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * Copyright (c) 2011-2015, 2017 Ingo Schwarze @@ -609,15 +609,21 @@ print_otag(struct html *h, enum htmltag tag, const char *fmt, ...) SCALE_VS_INIT(su, i); break; case 'w': - case 'W': if ((arg2 = va_arg(ap, char *)) == NULL) break; su = &mysu; a2width(arg2, su); - /* Increase width to make even bold text fit. */ - su->scale *= 1.1; - if (fmt[-1] == 'W') + if (*fmt == '+') { + /* Increase to make even bold text fit. */ + su->scale *= 1.15; + /* Add padding. */ + su->scale += 3.0; + fmt++; + } + if (*fmt == '-') { su->scale *= -1.0; + fmt++; + } break; default: abort(); diff --git a/mandoc_html.3 b/mandoc_html.3 index 1382a2f8..bd3f1b58 100644 --- a/mandoc_html.3 +++ b/mandoc_html.3 @@ -1,4 +1,4 @@ -.\" $Id: mandoc_html.3,v 1.7 2017/03/15 11:29:53 schwarze Exp $ +.\" $Id: mandoc_html.3,v 1.8 2017/05/12 17:58:21 schwarze Exp $ .\" .\" Copyright (c) 2014, 2017 Ingo Schwarze .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: March 15 2017 $ +.Dd $Mdocdate: May 12 2017 $ .Dt MANDOC_HTML 3 .Os .Sh NAME @@ -204,7 +204,7 @@ Instead, the rest of the format string consists of pairs of argument type letters and style name letters. .El .Pp -Argument type letters each require on argument as follows: +Argument type letters each require one argument as follows: .Bl -tag -width 1n -offset indent .It Cm h Requires one @@ -233,10 +233,18 @@ width specifier. If the argument is .Dv NULL , nothing is printed for this pair. -.It Cm W -Similar to -.Cm w , -but makes the width negative by multiplying it with \(mi1. +.Pp +The +.Cm w +argument type letter can optionally be followed by one or two +modifier letters. +The modifier +.Cm + +increases the width by 10% to make even bold text fit +and adds two units for padding between columns. +The modifier +.Cm \- +makes the width negative by multiplying it with \-1. .El .Pp Style name letters decide what to do with the preceding argument: diff --git a/mdoc_html.c b/mdoc_html.c index 2ad35035..a2488a52 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.286 2017/05/09 14:10:01 schwarze Exp $ */ +/* $Id: mdoc_html.c,v 1.287 2017/05/12 17:58:21 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze @@ -768,7 +768,7 @@ mdoc_it_pre(MDOC_ARGS) (n->parent->prev == NULL || n->parent->prev->body == NULL || n->parent->prev->body->child != NULL)) { - t = print_otag(h, TAG_DT, "csWl", + t = print_otag(h, TAG_DT, "csw+-l", cattr, bl->norm->Bl.width); print_text(h, "\\ "); print_tagq(h, t); @@ -776,7 +776,7 @@ mdoc_it_pre(MDOC_ARGS) print_text(h, "\\ "); print_tagq(h, t); } - print_otag(h, TAG_DT, "csWl", cattr, + print_otag(h, TAG_DT, "csw+-l", cattr, bl->norm->Bl.width); break; case ROFFT_BODY: @@ -839,7 +839,7 @@ mdoc_bl_pre(MDOC_ARGS) 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, "sw+w", bl->cols[i]); print_otag(h, TAG_COL, "swW", bl->cols[i]); print_tagq(h, t); return 0; @@ -886,7 +886,7 @@ mdoc_bl_pre(MDOC_ARGS) cattr = "Bl-tag"; if (bl->offs) print_otag(h, TAG_DIV, "cswl", cattr, bl->offs); - print_otag(h, TAG_DL, "cswl", cattr, bl->width); + print_otag(h, TAG_DL, "csw+l", cattr, bl->width); return 1; case LIST_column: elemtype = TAG_TABLE; -- cgit v1.2.3-56-ge451