diff options
author | 2017-07-15 17:57:46 +0000 | |
---|---|---|
committer | 2017-07-15 17:57:46 +0000 | |
commit | a44f9822a98f5f92d75e4231acd17435c1f03729 (patch) | |
tree | 4ab5c4349353a984eb016b8463f75c769f9c5b1f | |
parent | Remove unused variable. (diff) | |
download | wireguard-openbsd-a44f9822a98f5f92d75e4231acd17435c1f03729.tar.xz wireguard-openbsd-a44f9822a98f5f92d75e4231acd17435c1f03729.zip |
In .Bl -tag and -hang, do not print a margin-left style attribute
for each individual item if the -width argument matches the default
of 6n. Suggested by Steffen Nurpmeso <steffen at sdaoden dot eu>
on <groff at GNU dot org> in April 2017.
-rw-r--r-- | usr.bin/mandoc/html.c | 32 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_html.c | 10 |
2 files changed, 23 insertions, 19 deletions
diff --git a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c index 61f0470e49c..71adc926a9b 100644 --- a/usr.bin/mandoc/html.c +++ b/usr.bin/mandoc/html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: html.c,v 1.88 2017/07/14 16:28:35 schwarze Exp $ */ +/* $OpenBSD: html.c,v 1.89 2017/07/15 17:57:46 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011-2015, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -622,24 +622,28 @@ print_otag(struct html *h, enum htmltag tag, const char *fmt, ...) su = va_arg(ap, struct roffsu *); break; case 'w': - if ((arg2 = va_arg(ap, char *)) == NULL) { - if (*fmt == '+') - fmt++; - if (*fmt == '-') - fmt++; - break; + if ((arg2 = va_arg(ap, char *)) != NULL) { + su = &mysu; + a2width(arg2, su); + } + if (*fmt == '*') { + if (su != NULL && su->unit == SCALE_EN && + su->scale > 5.9 && su->scale < 6.1) + su = NULL; + fmt++; } - su = &mysu; - a2width(arg2, su); if (*fmt == '+') { - /* Increase to make even bold text fit. */ - su->scale *= 1.2; - /* Add padding. */ - su->scale += 3.0; + if (su != NULL) { + /* Make even bold text fit. */ + su->scale *= 1.2; + /* Add padding. */ + su->scale += 3.0; + } fmt++; } if (*fmt == '-') { - su->scale *= -1.0; + if (su != NULL) + su->scale *= -1.0; fmt++; } break; diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c index d89e30adb83..337b918bebc 100644 --- a/usr.bin/mandoc/mdoc_html.c +++ b/usr.bin/mandoc/mdoc_html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_html.c,v 1.168 2017/07/15 17:29:26 schwarze Exp $ */ +/* $OpenBSD: mdoc_html.c,v 1.169 2017/07/15 17:57:46 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -730,7 +730,7 @@ mdoc_it_pre(MDOC_ARGS) print_otag(h, TAG_B, "c", cattr); break; case ROFFT_BODY: - print_otag(h, TAG_DD, "csw+l", cattr, + print_otag(h, TAG_DD, "csw*+l", cattr, bl->norm->Bl.width); break; default: @@ -744,7 +744,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, "csw+-l", + t = print_otag(h, TAG_DT, "csw*+-l", cattr, bl->norm->Bl.width); print_text(h, "\\ "); print_tagq(h, t); @@ -752,7 +752,7 @@ mdoc_it_pre(MDOC_ARGS) print_text(h, "\\ "); print_tagq(h, t); } - print_otag(h, TAG_DT, "csw+-l", cattr, + print_otag(h, TAG_DT, "csw*+-l", cattr, bl->norm->Bl.width); break; case ROFFT_BODY: @@ -858,7 +858,7 @@ mdoc_bl_pre(MDOC_ARGS) case LIST_tag: if (bl->offs) print_otag(h, TAG_DIV, "cswl", "Bl-tag", bl->offs); - print_otag(h, TAG_DL, "csw+l", bl->comp ? + print_otag(h, TAG_DL, "csw*+l", bl->comp ? "Bl-tag Bl-compact" : "Bl-tag", bl->width); return 1; case LIST_column: |