aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2011-02-06 22:33:38 +0000
committerIngo Schwarze <schwarze@openbsd.org>2011-02-06 22:33:38 +0000
commitebcafa00a9a7b3da8e91fdf0f0d0ea03e2a38e7d (patch)
treebd34153b31da0d89cea5e4acec9980b22bb0bbd4 /mdoc_term.c
parent4c463a931a128500d4e57522a82cadb5fcc3ea30 (diff)
downloadmandoc-ebcafa00a9a7b3da8e91fdf0f0d0ea03e2a38e7d.tar.gz
mandoc-ebcafa00a9a7b3da8e91fdf0f0d0ea03e2a38e7d.tar.zst
mandoc-ebcafa00a9a7b3da8e91fdf0f0d0ea03e2a38e7d.zip
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 'mdoc_term.c')
-rw-r--r--mdoc_term.c47
1 files changed, 26 insertions, 21 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index e84d56d2..a6f9c80b 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,6 +1,6 @@
-/* $Id: mdoc_term.c,v 1.216 2011/02/06 21:44:36 kristaps Exp $ */
+/* $Id: mdoc_term.c,v 1.217 2011/02/06 22:33:38 schwarze Exp $ */
/*
- * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
+ * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
@@ -312,24 +312,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_EQN):
- 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
@@ -361,6 +343,29 @@ 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_EQN):
+ 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);
@@ -2191,7 +2196,7 @@ termp__t_post(DECL_ARGS)
* If we're in an `Rs' and there's a journal present, then quote
* us instead of underlining us (for disambiguation).
*/
- if (n->parent && MDOC_Rs == n->parent->tok &&
+ if (n->parent && MDOC_Rs == n->parent->tok &&
n->parent->norm->Rs.quote_T)
termp_quote_post(p, pair, m, n);