[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 17/17: tmac/an-old.tmac: Add style checks.
From: |
G. Branden Robinson |
Subject: |
[groff] 17/17: tmac/an-old.tmac: Add style checks. |
Date: |
Fri, 13 Nov 2020 21:58:45 -0500 (EST) |
gbranden pushed a commit to branch master
in repository groff.
commit 25d2a812faf52e4d952769920ccfbe5e61cb1b43
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Nov 14 13:25:26 2020 +1100
tmac/an-old.tmac: Add style checks.
Add register, CHECKSTYLE, to capture user preference for emission of
style-related diagnostics. Defaults off.
Not documented yet because I expect there to be some discussion on the
mailing list over whether it should be and/or what the register should
be called.
Whatever emerges from that discussion can and should be parallelized in
support and form with diagnostics in our mdoc(7) implementation, which
has some style-oriented diagnostics that issue at the same level as more
serious problems.
* tmac/an-old.tmac: Initialize CHECKSTYLE to false if not already set.
(an-style-warn): New macro emits diagnostic of type "style" when
called if CHECKSTYLE register is true.
(TH, RI, IR, IB, BI, RB, BR): Call an-style-warn if fewer than two
arguments are seen.
---
tmac/an-old.tmac | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/tmac/an-old.tmac b/tmac/an-old.tmac
index 65f3a20..8fecafe 100644
--- a/tmac/an-old.tmac
+++ b/tmac/an-old.tmac
@@ -46,6 +46,11 @@
. tm \*[an-old]:\\n[.F]:\\n[.c]: warning: \\$*
..
.
+.de an-style-warn
+. if \\n[CHECKSTYLE] \
+. tm \*[an-old]:\\n[.F]:\\n[.c]: style: \\$*
+..
+.
.nr need_eo_h 0
.nr need_col2 0
.
@@ -110,6 +115,8 @@
.
.\" .TH title section extra1 extra2 extra3
.de1 TH
+. if (\\n[.$] < 2) \
+. an-style-warn .\\$0 expects 2 to 5 arguments, got \\n[.$]
. if \\n[an-html] \{\
. DEVTAG-TL
. nop \\$1
@@ -472,6 +479,8 @@
..
.
.de1 RI
+. if (\\n[.$] < 2) \
+. an-style-warn .\\$0 expects at least 2 arguments, got \\n[.$]
. if \\n[.$] \{\
. ds an-result \&\f[R]\\$1\"
. shift
@@ -486,6 +495,8 @@
..
.
.de1 IR
+. if (\\n[.$] < 2) \
+. an-style-warn .\\$0 expects at least 2 arguments, got \\n[.$]
. if \\n[.$] \{\
. ds an-result \&\f[I]\,\\$1\f[R]\"
. shift
@@ -500,6 +511,8 @@
..
.
.de1 IB
+. if (\\n[.$] < 2) \
+. an-style-warn .\\$0 expects at least 2 arguments, got \\n[.$]
. if \\n[.$] \{\
. ds an-result \&\f[I]\,\\$1\"
. shift
@@ -514,6 +527,8 @@
..
.
.de1 BI
+. if (\\n[.$] < 2) \
+. an-style-warn .\\$0 expects at least 2 arguments, got \\n[.$]
. if \\n[.$] \{\
. ds an-result \&\f[B]\\$1\"
. shift
@@ -528,6 +543,8 @@
..
.
.de1 RB
+. if (\\n[.$] < 2) \
+. an-style-warn .\\$0 expects at least 2 arguments, got \\n[.$]
. ds an-result \&\"
. while (\\n[.$] >= 2) \{\
. as an-result \f[R]\\$1\f[B]\\$2\"
@@ -539,6 +556,8 @@
..
.
.de1 BR
+. if (\\n[.$] < 2) \
+. an-style-warn .\\$0 expects at least 2 arguments, got \\n[.$]
. ds an-result \&\"
. while (\\n[.$] >= 2) \{\
. as an-result \f[B]\\$1\f[R]\\$2\"
@@ -682,6 +701,10 @@
.if r ps4html \
. nr C 1
.
+.\" emit diagnostics for man page style problems
+.if !r CHECKSTYLE \
+. nr CHECKSTYLE 0
+.
.\" full capitalization of section headings
.if !r CS \
. nr CS 0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 17/17: tmac/an-old.tmac: Add style checks.,
G. Branden Robinson <=