summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-10-20 01:43:07 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-10-20 01:43:07 +0000
commit062550907f527e7daf82c77bd52c1079e6473f6c (patch)
tree2b50ea5691a31e2e362a85d2fc4b7678f0a3704d /usr.bin
parent7a1c64665df7fadb5fc3e4ba04a466a13f5c3209 (diff)
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
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/mandoc/tree.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/usr.bin/mandoc/tree.c b/usr.bin/mandoc/tree.c
index 54178b2cfc5..a43d7ce1a67 100644
--- a/usr.bin/mandoc/tree.c
+++ b/usr.bin/mandoc/tree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tree.c,v 1.25 2014/10/13 21:05:59 chl Exp $ */
+/* $OpenBSD: tree.c,v 1.26 2014/10/20 01:43:06 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -86,8 +86,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();
@@ -122,8 +123,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";
@@ -136,9 +138,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');
@@ -164,6 +163,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)
@@ -201,8 +202,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();
@@ -228,8 +230,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();
@@ -239,9 +242,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');
@@ -251,6 +251,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)