aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_validate.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-02-02 21:40:45 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-02-02 21:40:45 +0000
commite9d24264e27dc7cfcd1fc87cd2e50cc710121ed5 (patch)
treee45a33bb7cba55f4a325e4e49cd0380a16a0f11a /mdoc_validate.c
parent17d423d4ef829d89f4e0673f7324d66e126702f0 (diff)
downloadmandoc-e9d24264e27dc7cfcd1fc87cd2e50cc710121ed5.tar.gz
mandoc-e9d24264e27dc7cfcd1fc87cd2e50cc710121ed5.tar.zst
mandoc-e9d24264e27dc7cfcd1fc87cd2e50cc710121ed5.zip
If `Ns' is specified on its own line, it should be ignored. This is
shitty groff behaviour. Do the same, but raise a warning to this effect. This from a TODO noted by schwarze@.
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index fc00b93a..86cf2309 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.154 2011/01/25 15:46:05 kristaps Exp $ */
+/* $Id: mdoc_validate.c,v 1.155 2011/02/02 21:40:45 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -104,6 +104,7 @@ static int post_eoln(POST_ARGS);
static int post_it(POST_ARGS);
static int post_lb(POST_ARGS);
static int post_nm(POST_ARGS);
+static int post_ns(POST_ARGS);
static int post_os(POST_ARGS);
static int post_ignpar(POST_ARGS);
static int post_prol(POST_ARGS);
@@ -148,6 +149,7 @@ static v_post posts_lb[] = { post_lb, NULL };
static v_post posts_nd[] = { berr_ge1, NULL };
static v_post posts_nm[] = { post_nm, NULL };
static v_post posts_notext[] = { ewarn_eq0, NULL };
+static v_post posts_ns[] = { post_ns, NULL };
static v_post posts_os[] = { post_os, post_prol, NULL };
static v_post posts_rs[] = { post_rs, NULL };
static v_post posts_sh[] = { post_ignpar, hwarn_ge1, bwarn_ge1, post_sh, NULL };
@@ -249,7 +251,7 @@ const struct valids mdoc_valids[MDOC_MAX] = {
{ NULL, NULL }, /* Fx */
{ NULL, NULL }, /* Ms */
{ NULL, posts_notext }, /* No */
- { NULL, posts_notext }, /* Ns */
+ { NULL, posts_ns }, /* Ns */
{ NULL, NULL }, /* Nx */
{ NULL, NULL }, /* Ox */
{ NULL, NULL }, /* Pc */
@@ -1744,6 +1746,15 @@ post_rs(POST_ARGS)
}
static int
+post_ns(POST_ARGS)
+{
+
+ if (MDOC_LINE & mdoc->last->flags)
+ mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_IGNNS);
+ return(1);
+}
+
+static int
post_sh(POST_ARGS)
{