aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-04-05 14:43:36 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-04-05 14:43:36 +0000
commitf47f21f91f490734013253d54dd03f8dde6c3c91 (patch)
treee09ac87267881dd0e81375fbc175cdebd8b1f795
parent0d96afe1010f7bb41f5428a3a50a231adbee22ee (diff)
downloadmandoc-f47f21f91f490734013253d54dd03f8dde6c3c91.tar.gz
mandoc-f47f21f91f490734013253d54dd03f8dde6c3c91.tar.zst
mandoc-f47f21f91f490734013253d54dd03f8dde6c3c91.zip
Arguments to end macros of broken partial explicit blocks
must go inside the breaking block. For example, in .It Ic cmd Oo .Ar optional_arg Oc Ar mandatory_arg the mandatory_arg is still inside the .It block. Used for example by mutella(1).
-rw-r--r--mdoc_macro.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/mdoc_macro.c b/mdoc_macro.c
index bd3bf3e2..9d29406b 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_macro.c,v 1.185 2015/04/02 22:48:17 schwarze Exp $ */
+/* $Id: mdoc_macro.c,v 1.186 2015/04/05 14:43:36 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -256,7 +256,9 @@ rew_last(struct mdoc *mdoc, const struct roff_node *to)
{
struct roff_node *n, *np;
- assert(to);
+ if (to->flags & MDOC_VALID)
+ return;
+
mdoc->next = MDOC_NEXT_SIBLING;
while (mdoc->last != to) {
/*
@@ -625,10 +627,8 @@ blk_exp_close(MACRO_PROT_ARGS)
for (j = 0; ; j++) {
lastarg = *pos;
- if (j == maxargs && n != NULL) {
- rew_pending(mdoc, n);
- n = NULL;
- }
+ if (j == maxargs && n != NULL)
+ rew_last(mdoc, n);
ac = mdoc_args(mdoc, line, pos, buf, tok, &p);
if (ac == ARGS_PUNCT || ac == ARGS_EOLN)
@@ -643,10 +643,8 @@ blk_exp_close(MACRO_PROT_ARGS)
continue;
}
- if (n != NULL) {
- rew_pending(mdoc, n);
- n = NULL;
- }
+ if (n != NULL)
+ rew_last(mdoc, n);
mdoc->flags &= ~MDOC_NEWLINE;
mdoc_macro(mdoc, ntok, line, lastarg, pos, buf);
break;