groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 25/51: [mdoc]: Warn if Dd, Dt called without arguments.


From: G. Branden Robinson
Subject: [groff] 25/51: [mdoc]: Warn if Dd, Dt called without arguments.
Date: Sun, 11 Sep 2022 08:15:52 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit da5ad142d88d167dd57b722d96b1ca0b2a0bbbbf
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Sep 6 23:03:13 2022 -0500

    [mdoc]: Warn if Dd, Dt called without arguments.
    
    * tmac/mdoc/doc-common (Dt, Dd): Emit diagnostic warnings if macros
      called with no arguments.
    
    Fixes <https://savannah.gnu.org/bugs/?62774> (5/7).
    
    I dislike this diagnostic message format, but it's consistent with
    existing groff mdoc practice.
---
 ChangeLog            | 7 +++++++
 tmac/mdoc/doc-common | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index c11b859d3..5d386f9dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-09-06  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * tmac/mdoc/doc-common (Dt, Dd): Emit diagnostic warnings if
+       macros called with no arguments.
+
+       Fixes <https://savannah.gnu.org/bugs/?62774> (5/7).
+
 2022-09-06  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [mdoc]: Fix code style nit: stop using Control+G as an escape
diff --git a/tmac/mdoc/doc-common b/tmac/mdoc/doc-common
index de230d34b..988bdd5cd 100644
--- a/tmac/mdoc/doc-common
+++ b/tmac/mdoc/doc-common
@@ -340,6 +340,9 @@
 .
 .eo
 .de Dt
+.  if !\n[.$] \
+.    tm mdoc warning: .Dt directive expects one or more arguments \
+(#\n[.c])
 .  if !"\$1"" \
 .    ds doc-document-title "\$1
 .
@@ -902,6 +905,8 @@
 .
 .eo
 .de Dd
+.  if !\n[.$] \
+.    tm mdoc warning: .Dd directive expects an argument (#\n[.c])
 .  if \n[.$] \{\
 .    ie "\$1"$Mdocdate:" .ds doc-date-string \$2\~\$3, \$4\"
 .    el                  .ds doc-date-string \$*\"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]