summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-10-20 01:43:48 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-10-20 01:43:48 +0000
commit1ef973217e594b4c3a9888b786a447856f0de8db (patch)
tree4047f586c1ff6c2dd355f94c1558b1fae578054d
parent47f1b2773dddb73cd779684c5e4b8a48464b8bad (diff)
downloadmandoc-1ef973217e594b4c3a9888b786a447856f0de8db.tar.gz
show the {MDOC,MAN}_EQN node, it contains interesting information,
in particular line and column numbers and flags; but hide the uninteresting EQN_ROOT box
-rw-r--r--tree.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/tree.c b/tree.c
index 14d06def..70d8c2ea 100644
--- a/tree.c
+++ b/tree.c
@@ -88,8 +88,9 @@ print_mdoc(const struct mdoc_node *n, int indent)
t = "text";
break;
case MDOC_TBL:
- /* FALLTHROUGH */
+ break;
case MDOC_EQN:
+ t = "eqn";
break;
default:
abort();
@@ -124,8 +125,9 @@ print_mdoc(const struct mdoc_node *n, int indent)
}
break;
case MDOC_TBL:
- /* FALLTHROUGH */
+ break;
case MDOC_EQN:
+ p = "EQ";
break;
case MDOC_ROOT:
p = "root";
@@ -138,9 +140,6 @@ print_mdoc(const struct mdoc_node *n, int indent)
if (n->span) {
assert(NULL == p && NULL == t);
print_span(n->span, indent);
- } else if (n->eqn) {
- assert(NULL == p && NULL == t);
- print_box(n->eqn->root, indent);
} else {
for (i = 0; i < indent; i++)
putchar('\t');
@@ -166,6 +165,8 @@ print_mdoc(const struct mdoc_node *n, int indent)
putchar('\n');
}
+ if (n->eqn)
+ print_box(n->eqn->root->first, indent + 1);
if (n->child)
print_mdoc(n->child, indent + 1);
if (n->next)
@@ -203,8 +204,9 @@ print_man(const struct man_node *n, int indent)
t = "block-tail";
break;
case MAN_TBL:
- /* FALLTHROUGH */
+ break;
case MAN_EQN:
+ t = "eqn";
break;
default:
abort();
@@ -230,8 +232,9 @@ print_man(const struct man_node *n, int indent)
p = "root";
break;
case MAN_TBL:
- /* FALLTHROUGH */
+ break;
case MAN_EQN:
+ p = "EQ";
break;
default:
abort();
@@ -241,9 +244,6 @@ print_man(const struct man_node *n, int indent)
if (n->span) {
assert(NULL == p && NULL == t);
print_span(n->span, indent);
- } else if (n->eqn) {
- assert(NULL == p && NULL == t);
- print_box(n->eqn->root, indent);
} else {
for (i = 0; i < indent; i++)
putchar('\t');
@@ -253,6 +253,8 @@ print_man(const struct man_node *n, int indent)
printf("%d:%d\n", n->line, n->pos + 1);
}
+ if (n->eqn)
+ print_box(n->eqn->root->first, indent + 1);
if (n->child)
print_man(n->child, indent + 1);
if (n->next)