source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: If the body of a man(7) .MT or .UR block is empty, do not emit a
Date: Tue, 2 Aug 2022 07:03:02 -0500 (EST)	[thread overview]
Message-ID: <3368ec4f26a3ab33@mandoc.bsd.lv> (raw)

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


                 reply	other threads:[~2022-08-02 12:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3368ec4f26a3ab33@mandoc.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@mandoc.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).