summaryrefslogtreecommitdiffstats
path: root/mdoc_macro.c
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
commit6862e8749f0f36b9cf18b2973941968370edc45b (patch)
tree20ceabedd7cfc9ca48bcfb0a5c94928a7cd2590e /mdoc_macro.c
parent22de92d482148bc13bae2597fc718ce50c54b419 (diff)
downloadmandoc-6862e8749f0f36b9cf18b2973941968370edc45b.tar.gz
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).
Diffstat (limited to 'mdoc_macro.c')
-rw-r--r--mdoc_macro.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/mdoc_macro.c b/mdoc_macro.c
index 51c78ad4..39deb70a 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -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;