summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-07-15 17:57:51 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-07-15 17:57:51 +0000
commit7cad5a257f6181e7aae5ca0002589081a02dd064 (patch)
tree3d881057024b8ea6b95c3c3035d42824ff69e745
parent48a3d96ced4dc84ed0590b190e638ee2b76458e5 (diff)
downloadmandoc-7cad5a257f6181e7aae5ca0002589081a02dd064.tar.gz
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--html.c30
-rw-r--r--mandoc_html.39
-rw-r--r--mdoc_html.c8
3 files changed, 27 insertions, 20 deletions
diff --git a/html.c b/html.c
index c3a66b8e..1f1d8729 100644
--- a/html.c
+++ b/html.c
@@ -624,24 +624,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/mandoc_html.3 b/mandoc_html.3
index d7c3f45a..6ec35cd9 100644
--- a/mandoc_html.3
+++ b/mandoc_html.3
@@ -231,12 +231,15 @@ nothing is printed for this pair.
.Pp
The
.Cm w
-argument type letter can optionally be followed by one or two
+argument type letter can optionally be followed by one, two, or three
modifier letters.
The modifier
+.Cm *
+suppresses printing of the pair if the argument matches 6n.
+The modifier
.Cm +
-increases the width by 10% to make even bold text fit
-and adds two units for padding between columns.
+increases the width by 20% to make even bold text fit
+and adds three units for padding between columns.
The modifier
.Cm \-
makes the width negative by multiplying it with \-1.
diff --git a/mdoc_html.c b/mdoc_html.c
index 3ef5169e..7a972038 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -732,7 +732,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:
@@ -746,7 +746,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);
@@ -754,7 +754,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:
@@ -860,7 +860,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: