summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-06-01 15:25:39 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-06-01 15:25:39 +0000
commit8aa141e07f78054e526f8f85ec8f12e47a40fbb9 (patch)
tree57a1e7e10365e92680ec141b62d421642ec90dc0
parent97d9e8867b464b881cf5d4f88296991990492d49 (diff)
downloadmandoc-8aa141e07f78054e526f8f85ec8f12e47a40fbb9.tar.gz
STYLE message about full stop at the end of .Nd; inspired by mdoclint(1)
-rw-r--r--mandoc.15
-rw-r--r--mandoc.h1
-rw-r--r--mdoc_validate.c6
-rw-r--r--read.c1
4 files changed, 13 insertions, 0 deletions
diff --git a/mandoc.1 b/mandoc.1
index 9069e608..58c0812b 100644
--- a/mandoc.1
+++ b/mandoc.1
@@ -763,6 +763,11 @@ macro that could be represented using
.Ic \&Fx ,
or
.Ic \&Dx .
+.It Sy "description line ends with a full stop"
+.Pq mdoc
+Do not use punctuation at the end of an
+.Ic \&Nd
+block.
.El
.Ss Warnings related to the document prologue
.Bl -ohang
diff --git a/mandoc.h b/mandoc.h
index 37859b91..37baee40 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -48,6 +48,7 @@ enum mandocerr {
MANDOCERR_MACRO_USELESS, /* useless macro: macro */
MANDOCERR_BX, /* consider using OS macro: macro */
+ MANDOCERR_ND_DOT, /* description line ends with a full stop */
MANDOCERR_WARNING, /* ===== start of warnings ===== */
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 1a9dce2b..98e6a77d 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1076,6 +1076,7 @@ static void
post_nd(POST_ARGS)
{
struct roff_node *n;
+ size_t sz;
n = mdoc->last;
@@ -1089,6 +1090,11 @@ post_nd(POST_ARGS)
if (n->child == NULL)
mandoc_msg(MANDOCERR_ND_EMPTY, mdoc->parse,
n->line, n->pos, "Nd");
+ else if (n->last->type == ROFFT_TEXT &&
+ (sz = strlen(n->last->string)) != 0 &&
+ n->last->string[sz - 1] == '.')
+ mandoc_msg(MANDOCERR_ND_DOT, mdoc->parse,
+ n->last->line, n->last->pos + sz - 1, NULL);
post_hyph(mdoc);
}
diff --git a/read.c b/read.c
index bd04a09c..e6d24444 100644
--- a/read.c
+++ b/read.c
@@ -90,6 +90,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"useless macro",
"consider using OS macro",
+ "description line ends with a full stop",
"generic warning",