summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2017-06-27 12:17:36 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2017-06-27 12:17:36 +0000
commitfc3f88d1377c7bffa72b592c383a452c6267a2d1 (patch)
tree1dc885c67b44f8f19459b1920ca04d616fe24cf9 /usr.bin/mandoc
parente42e596c0d7b439f21422d484a24a670984ed0c1 (diff)
warn about .Ns macros that have no effect because they are followed
by an isolated closing delimiter; inspired by mdoclint
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/mandoc.18
-rw-r--r--usr.bin/mandoc/mdoc_validate.c9
2 files changed, 11 insertions, 6 deletions
diff --git a/usr.bin/mandoc/mandoc.1 b/usr.bin/mandoc/mandoc.1
index 931aabfa428..232ba78cdac 100644
--- a/usr.bin/mandoc/mandoc.1
+++ b/usr.bin/mandoc/mandoc.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: mandoc.1,v 1.131 2017/06/25 17:42:37 schwarze Exp $
+.\" $OpenBSD: mandoc.1,v 1.132 2017/06/27 12:17:35 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: June 25 2017 $
+.Dd $Mdocdate: June 27 2017 $
.Dt MANDOC 1
.Os
.Sh NAME
@@ -1175,7 +1175,9 @@ The paragraph macro is moved after the end of the list.
.Pq mdoc
An input line begins with an
.Ic \&Ns
-macro.
+macro, or the next argument after an
+.Ic \&Ns
+macro is an isolated closing delimiter.
The macro is ignored.
.It Sy "blocks badly nested"
.Pq mdoc
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index 0b45e79303b..04b4324c2a7 100644
--- a/usr.bin/mandoc/mdoc_validate.c
+++ b/usr.bin/mandoc/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_validate.c,v 1.258 2017/06/25 17:42:37 schwarze Exp $ */
+/* $OpenBSD: mdoc_validate.c,v 1.259 2017/06/27 12:17:35 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -1968,10 +1968,13 @@ post_hyph(POST_ARGS)
static void
post_ns(POST_ARGS)
{
+ struct roff_node *n;
- if (mdoc->last->flags & NODE_LINE)
+ n = mdoc->last;
+ if (n->flags & NODE_LINE ||
+ (n->next != NULL && n->next->flags & NODE_DELIMC))
mandoc_msg(MANDOCERR_NS_SKIP, mdoc->parse,
- mdoc->last->line, mdoc->last->pos, NULL);
+ n->line, n->pos, NULL);
}
static void