summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mdoc_macro.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/mdoc_macro.c b/mdoc_macro.c
index c04f7a3e..763866da 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -527,8 +527,9 @@ blk_exp_close(MACRO_PROT_ARGS)
struct roff_node *itblk; /* An It block starting later. */
struct roff_node *later; /* A sub-block starting later. */
struct roff_node *n; /* Search back to our block. */
+ struct roff_node *target; /* For find_pending(). */
- int j, lastarg, maxargs, nl;
+ int j, lastarg, maxargs, nl, pending;
enum margserr ac;
int atok, ntok;
char *p;
@@ -690,8 +691,19 @@ blk_exp_close(MACRO_PROT_ARGS)
break;
}
- if (n != NULL)
- rew_pending(mdoc, n);
+ if (n != NULL) {
+ if (n != mdoc->last && n->flags & MDOC_BROKEN) {
+ target = n;
+ do
+ target = target->parent;
+ while ( ! (target->flags & MDOC_ENDED));
+ pending = find_pending(mdoc, ntok, line, ppos,
+ target);
+ } else
+ pending = 0;
+ if ( ! pending)
+ rew_pending(mdoc, n);
+ }
if (nl)
append_delims(mdoc, line, pos, buf);
}