diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2015-04-05 23:04:23 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2015-04-05 23:04:23 +0000 |
commit | e68e5a83c1cc0f2087d87461a2bff538309551e6 (patch) | |
tree | fba33489752ec6b613802bf3a3a4e812bffbcb79 | |
parent | 20cf8f731e223b996dc79196e7576b5e8e64dd89 (diff) |
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).
-rw-r--r-- | usr.bin/mandoc/mdoc_macro.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c index 92a99a6de81..da67f34be1d 100644 --- a/usr.bin/mandoc/mdoc_macro.c +++ b/usr.bin/mandoc/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_macro.c,v 1.143 2015/04/05 22:43:40 schwarze Exp $ */ +/* $OpenBSD: mdoc_macro.c,v 1.144 2015/04/05 23:04:22 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -525,8 +525,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; @@ -688,8 +689,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); } |