diff options
author | 2015-04-05 23:04:22 +0000 | |
---|---|---|
committer | 2015-04-05 23:04:22 +0000 | |
commit | 417e9c8319621cf71d0b2593f4eb74b04fb86939 (patch) | |
tree | bab4c55e59e02bbbd190ccfaaa6a2d7c628fe951 /usr.bin/mandoc/mdoc_macro.c | |
parent | Reduce code duplication, no functional change: (diff) | |
download | wireguard-openbsd-417e9c8319621cf71d0b2593f4eb74b04fb86939.tar.xz wireguard-openbsd-417e9c8319621cf71d0b2593f4eb74b04fb86939.zip |
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).
Diffstat (limited to 'usr.bin/mandoc/mdoc_macro.c')
-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); } |