[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 11/15: [mdoc]: Improve diagnostic message format (5/4).
From: |
G. Branden Robinson |
Subject: |
[groff] 11/15: [mdoc]: Improve diagnostic message format (5/4). |
Date: |
Sun, 17 Mar 2024 17:59:38 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit 28ed2f4067a68a22cc5f21ae33f1bfe391f221a0
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Mar 16 12:31:34 2024 -0500
[mdoc]: Improve diagnostic message format (5/4).
* tmac/mdoc/doc-common (LP, PP, pp, SH): Use new `doc-warn` macro
instead of hand-crafting diagnostic message with `tm` request.
Continues fixing <https://savannah.gnu.org/bugs/?52463>, which I should
have known would not stay dead for long. (And which I won't be
surprised to see scrabble forth from the grave again.)
---
ChangeLog | 10 ++++++++++
tmac/doc.tmac | 35 ++++++++++++++++-------------------
tmac/mdoc/doc-common | 8 ++++----
tmac/mdoc/doc-syms | 30 +++++++++++++-----------------
4 files changed, 43 insertions(+), 40 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5f93ce7b5..9750fd181 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-03-16 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * tmac/mdoc/doc-common (LP, PP, pp, SH): Use new `doc-warn`
+ macro instead of hand-crafting diagnostic message with `tm`
+ request.
+
+ Continues fixing <https://savannah.gnu.org/bugs/?52463>, which I
+ should have known would not stay dead for long. (And which I
+ won't be surprised to see scrabble forth from the grave again.)
+
2024-03-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/doc.tmac (Xr): When formatting PDF, automatically attempt
diff --git a/tmac/doc.tmac b/tmac/doc.tmac
index e69a55393..b299349ed 100644
--- a/tmac/doc.tmac
+++ b/tmac/doc.tmac
@@ -2877,11 +2877,10 @@
. ds doc-macro-name Bk
.
. if \n[doc-keep-type] \
-. tm .Bk: nesting keeps not implemented yet. (#\n[.c])
-.
+. doc-warn .Bk: nesting keeps not implemented yet
. ie "\$1"-lines" \{\
. nr doc-keep-type 2
-. tm .Bk -lines: Not implemented yet. (#\n[.c])
+. doc-warn .Bk -lines: not implemented yet
. \}
. el \{ .ie "\$1"-words" \{\
. nr doc-keep-type 1
@@ -3029,8 +3028,8 @@
. ds doc-macro-name Bd
.
. if !\n[.$] \{\
-. tm1 "Usage: .Bd {-literal | -filled | -ragged | -centered | -unfilled}
-. tm1 " [-offset [string]] [-compact] [-file name] (#\n[.c])
+. doc-report-usage .Bd {-literal | -filled | -ragged | -centered | \
+-unfilled} [-offset [string]] [-compact] [-file name]
. return
. \}
.
@@ -3368,7 +3367,6 @@ macro
. el \{\
. doc-warn unknown list type '\$1' (or missing list type) in .Bl \
macro
-. tm
. nr doc-arg-ptr 0
. \}\}\}\}\}\}\}\}\}\}\}
.
@@ -3421,12 +3419,12 @@ macro
.
.eo
.de doc-Bl-usage
-. tm1 "Usage: .Bl {-hang | -ohang | -tag | -diag | -inset}
-. tm1 " [-width <string>]
-. tm1 " [-offset <string>] [-compact]
-. tm1 " .Bl -column [-offset <string>] <string1> <string2> ...
-. tm1 " .Bl {-item | -enum [-nested] | -bullet | -hyphen | -dash}
-. tm1 " [-offset <string>] [-compact] (#\n[.c])
+. doc-report-usage .Bl {-hang | -ohang | -tag | -diag | -inset} \
+[-width <string>] [-offset <string>] [-compact]
+. doc-report-usage .Bl -column [-offset <string>] <string1> <string2> \
+...
+. doc-report-usage .Bl {-item | -enum [-nested] | -bullet | -hyphen | \
+-dash} [-offset <string>] [-compact]
..
.ec
.
@@ -4903,8 +4901,8 @@ arguments
. doc-reset-args
. \}
. el \{\
-. tm1 "Usage: Ta must follow column entry: e.g.
-. tm1 " .It column_string [Ta [column_string ...]] (#\n[.c])
+. doc-report-usage Ta must follow column entry: e.g., \
+\&.It column_string [Ta [column_string ...]]
. \}
..
.ec
@@ -6828,8 +6826,7 @@ arguments
. doc-parse-args \$@
. \}\}\}
. el \{\
-. tm1 "Usage: .An {-nosplit | -split}
-. tm1 " .An author_name ... (#\n[.c])
+. doc-report-usage .An {-nosplit | -split} .An author_name ...
. \}\}
.
. if \n[doc-in-authors-section] \{\
@@ -7169,10 +7166,10 @@ arguments
.
.eo
.de doc-defunct-macro
-. doc-err .\$0 defunct
+. tmc \*[doc]:\n[.F]:\n[.c]: error: '\$0' macro is defunct
. if d doc-\$0-usage \
-. tmc , \*[doc-\$0-usage]
-. tm1 " (#\n[.c])
+. tmc ; \*[doc-\$0-usage]
+. tm
..
.ec
.
diff --git a/tmac/mdoc/doc-common b/tmac/mdoc/doc-common
index ab75f3aca..da36d50ce 100644
--- a/tmac/mdoc/doc-common
+++ b/tmac/mdoc/doc-common
@@ -1232,28 +1232,28 @@
.
.eo
.de LP
-. tm Not a \-mdoc command: .LP (#\n[.c])
+. doc-warn \$0 is not an mdoc macro name
..
.ec
.
.
.eo
.de PP
-. tm Not a \-mdoc command: .PP (#\n[.c])
+. doc-warn \$0 is not an mdoc macro name
..
.ec
.
.
.eo
.de pp
-. tm Not a \-mdoc command: .pp (#\n[.c])
+. doc-warn \$0 is not an mdoc macro name
..
.ec
.
.
.eo
.de SH
-. tm Not a \-mdoc command: .SH (#\n[.c])
+. doc-warn \$0 is not an mdoc macro name
..
.ec
.
diff --git a/tmac/mdoc/doc-syms b/tmac/mdoc/doc-syms
index 1f38513e5..4db4373b3 100644
--- a/tmac/mdoc/doc-syms
+++ b/tmac/mdoc/doc-syms
@@ -236,8 +236,8 @@
. ie d doc-str-At-\*[doc-arg\n[doc-arg-ptr]] \
. ds doc-str-At1 "\*[doc-str-At-\*[doc-arg\n[doc-arg-ptr]]]
. el \{\
-. tmc mdoc warning: .At: Unknown AT&T UNIX version
-. tm1 " '\*[doc-arg\n[doc-arg-ptr]]' (#\n[.c])
+. doc-warn .At: Unknown AT&T Unix version \
+'\*[doc-arg\n[doc-arg-ptr]]'
. nr doc-arg-ptr -1
. \}\}
. el \
@@ -301,8 +301,8 @@
. ie d doc-operating-system-DragonFly-\*[doc-arg\n[doc-arg-ptr]] \
. as doc-str-Dx1
\~\*[doc-operating-system-DragonFly-\*[doc-arg\n[doc-arg-ptr]]]
. el \{\
-. tmc mdoc warning: .Dx: Unknown DragonFly version
-. tm1 " '\*[doc-arg\n[doc-arg-ptr]]' (#\n[.c])
+. doc-warn .Dx: Unknown DragonFly version \
+'\*[doc-arg\n[doc-arg-ptr]]'
. as doc-str-Dx1 \~\*[doc-arg\n[doc-arg-ptr]]
. \}\}
. el \
@@ -366,8 +366,8 @@
. ie d doc-operating-system-FreeBSD-\*[doc-arg\n[doc-arg-ptr]] \
. as doc-str-Fx1
\~\*[doc-operating-system-FreeBSD-\*[doc-arg\n[doc-arg-ptr]]]
. el \{\
-. tmc mdoc warning: .Fx: Unknown FreeBSD version
-. tm1 " '\*[doc-arg\n[doc-arg-ptr]]' (#\n[.c])
+. doc-warn .Fx: Unknown FreeBSD version \
+'\*[doc-arg\n[doc-arg-ptr]]' (#\n[.c])
. as doc-str-Fx1 \~\*[doc-arg\n[doc-arg-ptr]]
. \}\}
. el \
@@ -432,8 +432,8 @@
. ie d doc-operating-system-NetBSD-\*[doc-arg\n[doc-arg-ptr]] \
. as doc-str-Nx1
\~\*[doc-operating-system-NetBSD-\*[doc-arg\n[doc-arg-ptr]]]
. el \{\
-. tmc mdoc warning: .Nx: Unknown NetBSD version
-. tm1 " '\*[doc-arg\n[doc-arg-ptr]]' (#\n[.c])
+. doc-warn .Nx: Unknown NetBSD version \
+'\*[doc-arg\n[doc-arg-ptr]]' (#\n[.c])
. as doc-str-Nx1 \~\*[doc-arg\n[doc-arg-ptr]]
. \}\}
. el \
@@ -736,10 +736,8 @@
. ie d doc-str-St-\*[doc-arg\n[doc-arg-ptr]] \
. ds doc-str-St1 "\*[doc-str-St-\*[doc-arg\n[doc-arg-ptr]]]
. el \{\
-. tmc "mdoc warning: .St: Unknown standard abbreviation
-. tm1 " '\*[doc-arg\n[doc-arg-ptr]]' (#\n[.c])
-. tm1 " Please refer to the groff_mdoc(7) manpage for a
-. tm1 " list of available standard abbreviations.
+. doc-warn .St: Unknown standard abbreviation \
+'\*[doc-arg\n[doc-arg-ptr]]'
. \}\}
. el \
. doc-St-usage
@@ -761,9 +759,7 @@
.
.eo
.de doc-St-usage
-. tm1 "Usage: .St standard (#\n[.c])
-. tm1 " Please refer to the groff_mdoc(7) manpage for a list of
-. tm1 " available standard abbreviations.
+. doc-report-usage .St standard
..
.ec
.
@@ -879,8 +875,8 @@
. ie d doc-str-Lb-\*[doc-arg\n[doc-arg-ptr]] \
. ds doc-str-Lb1 "\*[doc-str-Lb-\*[doc-arg\n[doc-arg-ptr]]]
. el \{\
-. tmc "mdoc warning: .Lb: no description for library
-. tm1 " '\*[doc-arg\n[doc-arg-ptr]]' available (#\n[.c])
+. doc-warn .Lb: no description available for library \
+'\*[doc-arg\n[doc-arg-ptr]]'
. ds doc-str-Lb1 library \*[Lq]\*[doc-arg\n[doc-arg-ptr]]\*[Rq]
. \}
.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 11/15: [mdoc]: Improve diagnostic message format (5/4).,
G. Branden Robinson <=