diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2011-02-06 17:33:22 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2011-02-06 17:33:22 +0000 |
commit | a6928409603f10c73b69d4cc2c551365dd354355 (patch) | |
tree | c0a885462a050f80d2d6dd4f23a2a5987ef4ca85 /usr.bin | |
parent | 8f2e7efff9716e926aceb6c52cffa81e1eac647a (diff) |
If .Ns is specified on its own line, ignore it, like groff does;
from kristaps@.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mandoc/main.c | 3 | ||||
-rw-r--r-- | usr.bin/mandoc/mandoc.h | 3 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_html.c | 5 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_term.c | 5 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_validate.c | 15 |
5 files changed, 23 insertions, 8 deletions
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c index 30cd1db3cba..3f26a6ce6a9 100644 --- a/usr.bin/mandoc/main.c +++ b/usr.bin/mandoc/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.71 2011/01/25 12:24:26 schwarze Exp $ */ +/* $Id: main.c,v 1.72 2011/02/06 17:33:20 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org> @@ -131,6 +131,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { /* related to macros and nesting */ "skipping obsolete macro", "skipping paragraph macro", + "skipping no-space macro", "blocks badly nested", "child violates parent syntax", "nested displays are not portable", diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h index 923b3f774a7..6165e156caf 100644 --- a/usr.bin/mandoc/mandoc.h +++ b/usr.bin/mandoc/mandoc.h @@ -1,4 +1,4 @@ -/* $Id: mandoc.h,v 1.31 2011/01/16 19:27:25 schwarze Exp $ */ +/* $Id: mandoc.h,v 1.32 2011/02/06 17:33:20 schwarze Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -68,6 +68,7 @@ enum mandocerr { /* related to macros and nesting */ MANDOCERR_MACROOBS, /* skipping obsolete macro */ MANDOCERR_IGNPAR, /* skipping paragraph macro */ + MANDOCERR_IGNNS, /* skipping no-space macro */ MANDOCERR_SCOPENEST, /* blocks badly nested */ MANDOCERR_CHILD, /* child violates parent syntax */ MANDOCERR_NESTEDDISP, /* nested displays are not portable */ diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c index 5aec02fa59d..d57108e71a2 100644 --- a/usr.bin/mandoc/mdoc_html.c +++ b/usr.bin/mandoc/mdoc_html.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.50 2011/01/31 03:04:26 schwarze Exp $ */ +/* $Id: mdoc_html.c,v 1.51 2011/02/06 17:33:20 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -776,7 +776,8 @@ static int mdoc_ns_pre(MDOC_ARGS) { - h->flags |= HTML_NOSPACE; + if ( ! (MDOC_LINE & n->flags)) + h->flags |= HTML_NOSPACE; return(1); } diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index 5fc657f2070..572e93c45b0 100644 --- a/usr.bin/mandoc/mdoc_term.c +++ b/usr.bin/mandoc/mdoc_term.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.126 2011/01/30 18:28:01 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.127 2011/02/06 17:33:20 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org> @@ -1147,7 +1147,8 @@ static int termp_ns_pre(DECL_ARGS) { - p->flags |= TERMP_NOSPACE; + if ( ! (MDOC_LINE & n->flags)) + p->flags |= TERMP_NOSPACE; return(1); } diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c index 7c7a0d046b8..5f61829cb60 100644 --- a/usr.bin/mandoc/mdoc_validate.c +++ b/usr.bin/mandoc/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.87 2011/01/30 18:28:01 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.88 2011/02/06 17:33:21 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -99,6 +99,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); @@ -143,6 +144,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 }; @@ -244,7 +246,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 */ @@ -1739,6 +1741,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) { |