summaryrefslogtreecommitdiffstats
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-07-19 08:18:28 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-07-19 08:18:28 +0000
commitb239c4da3004b4ac8a3048244ecc012838739291 (patch)
tree0134c1b4c4195b4cef2c568e375a59ff474ef115 /mdoc_term.c
parentbf7cb186e6909c3518109a75ff9c7693b43bc2f2 (diff)
downloadmandoc-b239c4da3004b4ac8a3048244ecc012838739291.tar.gz
termpair flags unset before post, after body (suggested by schwarze@openbsd).
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index e100f376..4cb7e66e 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -364,6 +364,13 @@ print_node(DECL_ARGS)
npair.flag = 0;
npair.count = 0;
+ /*
+ * Note on termpair. This allows a pre function to set a termp
+ * flag that is automatically unset after the body, but before
+ * the post function. Thus, if a pre uses a termpair flag, it
+ * must be reapplied in the post for use.
+ */
+
if (MDOC_TEXT != node->type) {
if (termacts[node->tok].pre)
if ( ! (*termacts[node->tok].pre)(p, &npair, meta, node))
@@ -378,6 +385,8 @@ print_node(DECL_ARGS)
if (dochild && node->child)
print_body(p, &npair, meta, node->child);
+ p->flags &= ~npair.flag;
+
/* Post-processing. */
if (MDOC_TEXT != node->type)
@@ -386,7 +395,6 @@ print_node(DECL_ARGS)
p->offset = offset;
p->rmargin = rmargin;
- p->flags &= ~npair.flag;
}
@@ -1814,8 +1822,9 @@ static void
termp_in_post(DECL_ARGS)
{
- p->flags |= TERMP_NOSPACE;
+ p->flags |= TERMP_NOSPACE | ttypes[TTYPE_INCLUDE];
term_word(p, ">");
+ p->flags &= ~ttypes[TTYPE_INCLUDE];
if (SEC_SYNOPSIS != node->sec)
return;