From: schwarze Date: Tue, 2 Aug 2022 11:55:51 +0000 (+0000) Subject: If the body of a man(7) .MT or .UR block is empty, do not emit a warning. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=372f315ddea8f8333a9d16819b65168c1c2a5540;p=openbsd If the body of a man(7) .MT or .UR block is empty, do not emit a warning. Leaving the body empty is legitimate in this case if the author only wants to display a mail address or URI without providing a link text. Output modules already handle this correctly: terminal output shows just the URI without an accompanying text, HTML output uses the URI for *both* the href= attribute and as the content of the element. The documentation was also wrong and claimed that an .MT or .UR block with an empty body would produce no output. As explained above, this isn't true. Bogus warning reported by Alejandro Colomar . --- diff --git a/regress/usr.bin/mandoc/man/MT/args.out_lint b/regress/usr.bin/mandoc/man/MT/args.out_lint index b06ec906691..bd2d3be43f2 100644 --- a/regress/usr.bin/mandoc/man/MT/args.out_lint +++ b/regress/usr.bin/mandoc/man/MT/args.out_lint @@ -1,5 +1,3 @@ mandoc: args.in:28:11: ERROR: skipping excess arguments: MT ... second mandoc: args.in:33:11: ERROR: skipping excess arguments: MT ... second -mandoc: args.in:19:2: WARNING: empty block: MT mandoc: args.in:23:2: WARNING: missing resource identifier, using "": MT -mandoc: args.in:33:2: WARNING: empty block: MT diff --git a/regress/usr.bin/mandoc/man/UR/args.out_lint b/regress/usr.bin/mandoc/man/UR/args.out_lint index b1525e0f3b2..1df8c355d3b 100644 --- a/regress/usr.bin/mandoc/man/UR/args.out_lint +++ b/regress/usr.bin/mandoc/man/UR/args.out_lint @@ -1,5 +1,3 @@ mandoc: args.in:28:11: ERROR: skipping excess arguments: UR ... second mandoc: args.in:33:11: ERROR: skipping excess arguments: UR ... second -mandoc: args.in:19:2: WARNING: empty block: UR mandoc: args.in:23:2: WARNING: missing resource identifier, using "": UR -mandoc: args.in:33:2: WARNING: empty block: UR diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c index 32cb55a301f..56c3f46c400 100644 --- a/usr.bin/mandoc/man_validate.c +++ b/usr.bin/mandoc/man_validate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_validate.c,v 1.126 2021/08/10 12:36:42 schwarze Exp $ */ +/* $OpenBSD: man_validate.c,v 1.127 2022/08/02 11:55:51 schwarze Exp $ */ /* * Copyright (c) 2010, 2012-2020 Ingo Schwarze * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons @@ -371,13 +371,11 @@ post_UR(CHKARGS) if (n->type == ROFFT_HEAD && n->child == NULL) mandoc_msg(MANDOCERR_UR_NOHEAD, n->line, n->pos, "%s", roff_name[n->tok]); - check_part(man, n); } static void check_part(CHKARGS) { - if (n->type == ROFFT_BODY && n->child == NULL) mandoc_msg(MANDOCERR_BLK_EMPTY, n->line, n->pos, "%s", roff_name[n->tok]); diff --git a/usr.bin/mandoc/mandoc.1 b/usr.bin/mandoc/mandoc.1 index 1880c30636c..931370665f6 100644 --- a/usr.bin/mandoc/mandoc.1 +++ b/usr.bin/mandoc/mandoc.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mandoc.1,v 1.188 2022/06/28 04:36:29 jsg Exp $ +.\" $OpenBSD: mandoc.1,v 1.189 2022/08/02 11:55:51 schwarze Exp $ .\" .\" Copyright (c) 2012, 2014-2022 Ingo Schwarze .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons @@ -15,7 +15,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: June 28 2022 $ +.Dd $Mdocdate: August 2 2022 $ .Dt MANDOC 1 .Os .Sh NAME @@ -1473,10 +1473,8 @@ A .Ic \&Bl , .Ic \&D1 , .Ic \&Dl , -.Ic \&MT , -.Ic \&RS , or -.Ic \&UR +.Ic \&RS block contains nothing in its body and will produce no output. .It Sy "empty argument, using 0n" .Pq mdoc