summaryrefslogtreecommitdiffstatshomepage
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
commit24ae04ef71e468c65e2d2c64545b44c7804324f5 (patch)
treec06a27b6bfd11e6f4c42e0e7f2c2eaae2ede09e7
parent13147b8cddc9c00830cdafc301f4af3492ad67f5 (diff)
downloadmandoc-24ae04ef71e468c65e2d2c64545b44c7804324f5.tar.gz
mandoc-24ae04ef71e468c65e2d2c64545b44c7804324f5.tar.zst
mandoc-24ae04ef71e468c65e2d2c64545b44c7804324f5.zip
termpair flags unset before post, after body (suggested by schwarze@openbsd).
-rw-r--r--mdoc_term.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index f290a91d..71764322 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.45 2009/07/17 12:40:48 kristaps Exp $ */
+/* $Id: mdoc_term.c,v 1.46 2009/07/19 08:18:28 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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;