From 17758e0da9b52fb54e22c38cf77b36a01e52eb66 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Wed, 25 Feb 2009 12:09:20 +0000 Subject: Added "termpair" for symmetric flag-setting. --- mdocterm.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'mdocterm.c') diff --git a/mdocterm.c b/mdocterm.c index d4b27c9e..014a010f 100644 --- a/mdocterm.c +++ b/mdocterm.c @@ -410,28 +410,46 @@ body(struct termp *p, const struct mdoc_meta *meta, const struct mdoc_node *node) { int dochild; + struct termpair pair; /* Pre-processing. */ dochild = 1; + pair.type = 0; if (MDOC_TEXT != node->type) { if (termacts[node->tok].pre) - if ( ! (*termacts[node->tok].pre)(p, meta, node)) + if ( ! (*termacts[node->tok].pre)(p, &pair, meta, node)) dochild = 0; } else /* MDOC_TEXT == node->type */ word(p, node->data.text.string); /* Children. */ + switch (pair.type) { + case (TERMPAIR_FLAG): + p->flags |= pair.data.flag; + break; + default: + break; + } + if (dochild && node->child) body(p, meta, node->child); + switch (pair.type) { + case (TERMPAIR_FLAG): + p->flags &= ~pair.data.flag; + break; + default: + break; + } + /* Post-processing. */ if (MDOC_TEXT != node->type) if (termacts[node->tok].post) - (*termacts[node->tok].post)(p, meta, node); + (*termacts[node->tok].post)(p, &pair, meta, node); /* Siblings. */ -- cgit