source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: If the body of a man(7) .MT or .UR block is empty, do not emit a
@ 2022-08-02 12:03 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2022-08-02 12:03 UTC (permalink / raw)
  To: source

Log Message:
-----------
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 <a> 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 <alx dot manpages at gmail dot com>.

Modified Files:
--------------
    mandoc:
        man_validate.c
        mandoc.1
    mandoc/regress/man/MT:
        args.out_lint
    mandoc/regress/man/UR:
        args.out_lint

Revision Data
-------------
Index: args.out_lint
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/man/MT/args.out_lint,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lregress/man/MT/args.out_lint -Lregress/man/MT/args.out_lint -u -p -r1.3 -r1.4
--- regress/man/MT/args.out_lint
+++ regress/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
Index: mandoc.1
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mandoc.1,v
retrieving revision 1.262
retrieving revision 1.263
diff -Lmandoc.1 -Lmandoc.1 -u -p -r1.262 -r1.263
--- mandoc.1
+++ mandoc.1
@@ -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
Index: man_validate.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/man_validate.c,v
retrieving revision 1.156
retrieving revision 1.157
diff -Lman_validate.c -Lman_validate.c -u -p -r1.156 -r1.157
--- man_validate.c
+++ man_validate.c
@@ -373,13 +373,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]);
Index: args.out_lint
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/man/UR/args.out_lint,v
retrieving revision 1.5
retrieving revision 1.6
diff -Lregress/man/UR/args.out_lint -Lregress/man/UR/args.out_lint -u -p -r1.5 -r1.6
--- regress/man/UR/args.out_lint
+++ regress/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
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-02 12:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-02 12:03 mandoc: If the body of a man(7) .MT or .UR block is empty, do not emit a schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).