From e870afcbdc7daf017837e9e2069000d1c6bc5f58 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 5 Apr 2015 23:04:41 +0000 Subject: If a partial explicit block extending to the next input line follows the end macro of a broken block, put all of it into the breaking block. Needed for example by mutella(1). --- mdoc_macro.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/mdoc_macro.c b/mdoc_macro.c index 90f487aa..61d9148d 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_macro.c,v 1.187 2015/04/05 22:44:20 schwarze Exp $ */ +/* $Id: mdoc_macro.c,v 1.188 2015/04/05 23:04:41 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010, 2012-2015 Ingo Schwarze @@ -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); } -- cgit v1.2.3-56-ge451