From 24ae04ef71e468c65e2d2c64545b44c7804324f5 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Sun, 19 Jul 2009 08:18:28 +0000 Subject: termpair flags unset before post, after body (suggested by schwarze@openbsd). --- mdoc_term.c | 15 ++++++++++++--- 1 file 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 * @@ -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; -- cgit v1.2.3-56-ge451