summaryrefslogtreecommitdiffstatshomepage
path: root/mdocterm.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-02-25 12:09:20 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-02-25 12:09:20 +0000
commit3da36abba778bbb6f652585d4c8d476dcee854a4 (patch)
tree2cf242413bd3cb6cf4d827156e8d9c7bddbb73ce /mdocterm.c
parentc951a3baf41ca0fd6820e85f468a6d6f4a07a2f9 (diff)
downloadmandoc-3da36abba778bbb6f652585d4c8d476dcee854a4.tar.gz
mandoc-3da36abba778bbb6f652585d4c8d476dcee854a4.tar.zst
mandoc-3da36abba778bbb6f652585d4c8d476dcee854a4.zip
Added "termpair" for symmetric flag-setting.
Diffstat (limited to 'mdocterm.c')
-rw-r--r--mdocterm.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/mdocterm.c b/mdocterm.c
index b8a6e664..105fce27 100644
--- a/mdocterm.c
+++ b/mdocterm.c
@@ -1,4 +1,4 @@
- /* $Id: mdocterm.c,v 1.8 2009/02/24 14:52:55 kristaps Exp $ */
+ /* $Id: mdocterm.c,v 1.9 2009/02/25 12:09:20 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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. */