summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2011-02-06 22:25:37 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2011-02-06 22:25:37 +0000
commitc12284a87f6464cb76f414396466c8d21b762e3d (patch)
tree80acc883b0c41900eaa91e68f5d9d704cfde713c /usr.bin
parentf39b167a786f1221a985d195cfe02986edb66af4 (diff)
Some pre-handlers produce output, so reorder the code to set up
keep flags before they are called. Without this bugfix, .Bk was ineffective in some cases. "looks reasonable" kristaps@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/mandoc/mdoc_term.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c
index 572e93c45b0..88f238b543c 100644
--- a/usr.bin/mandoc/mdoc_term.c
+++ b/usr.bin/mandoc/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.127 2011/02/06 17:33:20 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.128 2011/02/06 22:25:36 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -308,22 +308,6 @@ print_mdoc_node(DECL_ARGS)
memset(&npair, 0, sizeof(struct termpair));
npair.ppair = pair;
-
- switch (n->type) {
- case (MDOC_TEXT):
- if (' ' == *n->string && MDOC_LINE & n->flags)
- term_newln(p);
- term_word(p, n->string);
- break;
- case (MDOC_TBL):
- term_tbl(p, n->span);
- break;
- default:
- if (termacts[n->tok].pre && ENDBODY_NOT == n->end)
- chld = (*termacts[n->tok].pre)
- (p, &npair, m, n);
- break;
- }
/*
* Keeps only work until the end of a line. If a keep was
@@ -355,6 +339,27 @@ print_mdoc_node(DECL_ARGS)
(n->parent && MDOC_SYNPRETTY & n->parent->flags)))
p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP);
+ /*
+ * After the keep flags have been set up, we may now
+ * produce output. Note that some pre-handlers do so.
+ */
+
+ switch (n->type) {
+ case (MDOC_TEXT):
+ if (' ' == *n->string && MDOC_LINE & n->flags)
+ term_newln(p);
+ term_word(p, n->string);
+ break;
+ case (MDOC_TBL):
+ term_tbl(p, n->span);
+ break;
+ default:
+ if (termacts[n->tok].pre && ENDBODY_NOT == n->end)
+ chld = (*termacts[n->tok].pre)
+ (p, &npair, m, n);
+ break;
+ }
+
if (chld && n->child)
print_mdoc_nodelist(p, &npair, m, n->child);