aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit5325cd99ac197268bd26af0ee01d0539cb78cb61 (patch)
treeeb5e96196b19e9df6350a30ca814eda4bee9d06d
parentad7197291eca5fd8e810a5cebb0f9c81a323c637 (diff)
downloadmandoc-5325cd99ac197268bd26af0ee01d0539cb78cb61.tar.gz
mandoc-5325cd99ac197268bd26af0ee01d0539cb78cb61.tar.zst
mandoc-5325cd99ac197268bd26af0ee01d0539cb78cb61.zip
STYLE message about full stop at the end of .Nd; inspired by mdoclint(1)
-rw-r--r--mandoc.19
-rw-r--r--mandoc.h3
-rw-r--r--mdoc_validate.c8
-rw-r--r--read.c3
4 files changed, 18 insertions, 5 deletions
diff --git a/mandoc.1 b/mandoc.1
index 6ec18a96..b0865f93 100644
--- a/mandoc.1
+++ b/mandoc.1
@@ -1,4 +1,4 @@
-.\" $Id: mandoc.1,v 1.191 2017/05/31 15:31:00 schwarze Exp $
+.\" $Id: mandoc.1,v 1.192 2017/06/01 15:25:39 schwarze Exp $
.\"
.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
.\" Copyright (c) 2012, 2014-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: May 31 2017 $
+.Dd $Mdocdate: June 1 2017 $
.Dt MANDOC 1
.Os
.Sh NAME
@@ -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 7038d691..f18d2d12 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc.h,v 1.218 2017/05/31 15:31:00 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.219 2017/06/01 15:25:39 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -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 d50e95e2..69e6f603 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.329 2017/05/31 15:31:00 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.330 2017/06/01 15:25:39 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -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 6bc08463..c9559abc 100644
--- a/read.c
+++ b/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.167 2017/05/31 15:31:00 schwarze Exp $ */
+/* $Id: read.c,v 1.168 2017/06/01 15:25:39 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -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",