diff options
-rw-r--r-- | man.7 | 28 | ||||
-rw-r--r-- | man_macro.c | 26 | ||||
-rw-r--r-- | mandoc.1 | 21 | ||||
-rw-r--r-- | mandoc.h | 3 | ||||
-rw-r--r-- | read.c | 3 |
5 files changed, 68 insertions, 13 deletions
@@ -1,7 +1,7 @@ -.\" $Id: man.7,v 1.128 2014/12/28 15:23:33 schwarze Exp $ +.\" $Id: man.7,v 1.129 2015/01/24 01:58:33 schwarze Exp $ .\" .\" Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv> -.\" Copyright (c) 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org> +.\" Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org> .\" Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org> .\" .\" Permission to use, copy, modify, and distribute this software for any @@ -16,7 +16,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: December 28 2014 $ +.Dd $Mdocdate: January 24 2015 $ .Dt MAN 7 .Os .Sh NAME @@ -555,9 +555,29 @@ and .Ss \&RE Explicitly close out the scope of a prior .Sx \&RS . -The default left margin is restored to the state of the original +The default left margin is restored to the state before that .Sx \&RS invocation. +.Pp +The syntax is as follows: +.Bd -filled -offset indent +.Pf \. Sx \&RE +.Op Ar level +.Ed +.Pp +Without an argument, the most recent +.Sx \&RS +block is closed out. +If +.Ar level +is 1, all open +.Sx \&RS +blocks are closed out. +Otherwise, +.Ar level No \(mi 1 +nested +.Sx \&RS +blocks remain open. .Ss \&RI Text is rendered alternately in roman (the default font) and italics. Whitespace between arguments is omitted in output. diff --git a/man_macro.c b/man_macro.c index f1796f3c..042d133d 100644 --- a/man_macro.c +++ b/man_macro.c @@ -1,7 +1,7 @@ -/* $Id: man_macro.c,v 1.92 2014/12/16 17:26:00 schwarze Exp $ */ +/* $Id: man_macro.c,v 1.93 2015/01/24 01:58:33 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> - * Copyright (c) 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2012, 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2013 Franco Fichtner <franco@lastsummer.de> * * Permission to use, copy, modify, and distribute this software for any @@ -279,10 +279,30 @@ blk_close(MACRO_PROT_ARGS) { enum mant ntok; const struct man_node *nn; + char *p; + int nrew, target; + nrew = 1; switch (tok) { case MAN_RE: ntok = MAN_RS; + if ( ! man_args(man, line, pos, buf, &p)) + break; + for (nn = man->last->parent; nn; nn = nn->parent) + if (nn->tok == ntok && nn->type == MAN_BLOCK) + nrew++; + target = strtol(p, &p, 10); + if (*p != '\0') + mandoc_vmsg(MANDOCERR_ARG_EXCESS, man->parse, + line, p - buf, "RE ... %s", p); + if (target == 0) + target = 1; + nrew -= target; + if (nrew < 1) { + mandoc_vmsg(MANDOCERR_RE_NOTOPEN, man->parse, + line, ppos, "RE %d", target); + return; + } break; case MAN_UE: ntok = MAN_UR; @@ -293,7 +313,7 @@ blk_close(MACRO_PROT_ARGS) } for (nn = man->last->parent; nn; nn = nn->parent) - if (nn->tok == ntok && nn->type == MAN_BLOCK) + if (nn->tok == ntok && nn->type == MAN_BLOCK && ! --nrew) break; if (nn == NULL) { @@ -1,4 +1,4 @@ -.\" $Id: mandoc.1,v 1.134 2015/01/20 22:45:07 schwarze Exp $ +.\" $Id: mandoc.1,v 1.135 2015/01/24 01:58:33 schwarze Exp $ .\" .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> .\" Copyright (c) 2012, 2014, 2015 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: January 20 2015 $ +.Dd $Mdocdate: January 24 2015 $ .Dt MANDOC 1 .Os .Sh NAME @@ -1369,6 +1369,16 @@ right delimiter or closing brace, or the end of an equation, table, or .Xr roff 7 conditional request is encountered but no matching block is open. The offending request or macro is discarded. +.It Sy "fewer RS blocks open, skipping" +.Pq man +The +.Ic \&RE +macro is invoked with an argument, but less than the specified number of +.Ic \&RS +blocks is open. +The +.Ic \&RE +macro is discarded. .It Sy "inserting missing end of block" .Pq mdoc , tbl Various @@ -1537,10 +1547,13 @@ macro, or a block closing request is invoked with at least one argument. All arguments are ignored. .It Sy "skipping excess arguments" -.Pq mdoc , roff +.Pq mdoc , man , roff The .Ic \&Bf -macro is invoked with more than one argument, or a request of the +macro is invoked with more than one argument, the +.Ic \&RE +macro is invoked with more than one argument +or with a non-integer argument, or a request of the .Ic \&de family is invoked with more than two arguments. The excess arguments are ignored. @@ -1,4 +1,4 @@ -/* $Id: mandoc.h,v 1.185 2015/01/22 21:38:16 schwarze Exp $ */ +/* $Id: mandoc.h,v 1.186 2015/01/24 01:58:33 schwarze Exp $ */ /* * Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -151,6 +151,7 @@ enum mandocerr { MANDOCERR_IT_STRAY, /* skipping item outside list: It ... */ MANDOCERR_TA_STRAY, /* skipping column outside column list: Ta */ MANDOCERR_BLK_NOTOPEN, /* skipping end of block that is not open */ + MANDOCERR_RE_NOTOPEN, /* fewer RS blocks open, skipping: RE arg */ MANDOCERR_BLK_BROKEN, /* inserting missing end of block: macro ... */ MANDOCERR_BLK_NOEND, /* appending missing end of block: macro */ @@ -1,4 +1,4 @@ -/* $Id: read.c,v 1.114 2015/01/22 21:38:16 schwarze Exp $ */ +/* $Id: read.c,v 1.115 2015/01/24 01:58:33 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -195,6 +195,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "skipping item outside list", "skipping column outside column list", "skipping end of block that is not open", + "fewer RS blocks open, skipping", "inserting missing end of block", "appending missing end of block", |