diff options
author | 2014-10-20 01:43:06 +0000 | |
---|---|---|
committer | 2014-10-20 01:43:06 +0000 | |
commit | 25fe02ef2653ba32ae89b6254fd27dc5e5b2a6e0 (patch) | |
tree | da36159230096cc0b3c9cbb65f1d0bcf465317fb | |
parent | typo; deraadt (diff) | |
download | wireguard-openbsd-25fe02ef2653ba32ae89b6254fd27dc5e5b2a6e0.tar.xz wireguard-openbsd-25fe02ef2653ba32ae89b6254fd27dc5e5b2a6e0.zip |
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-- | usr.bin/mandoc/tree.c | 24 |
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) |