=================================================================== RCS file: /cvs/mandoc/tree.c,v retrieving revision 1.57 retrieving revision 1.60 diff -u -p -r1.57 -r1.60 --- mandoc/tree.c 2014/10/10 12:19:25 1.57 +++ mandoc/tree.c 2014/11/28 05:51:32 1.60 @@ -1,6 +1,6 @@ -/* $Id: tree.c,v 1.57 2014/10/10 12:19:25 schwarze Exp $ */ +/* $Id: tree.c,v 1.60 2014/11/28 05:51:32 schwarze Exp $ */ /* - * Copyright (c) 2008, 2009, 2011 Kristaps Dzonsons + * Copyright (c) 2008, 2009, 2011, 2014 Kristaps Dzonsons * Copyright (c) 2013, 2014 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any @@ -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) @@ -199,12 +200,10 @@ print_man(const struct man_node *n, int indent) case MAN_BODY: t = "block-body"; break; - case MAN_TAIL: - t = "block-tail"; - break; case MAN_TBL: - /* FALLTHROUGH */ + break; case MAN_EQN: + t = "eqn"; break; default: abort(); @@ -221,8 +220,6 @@ print_man(const struct man_node *n, int indent) /* FALLTHROUGH */ case MAN_HEAD: /* FALLTHROUGH */ - case MAN_TAIL: - /* FALLTHROUGH */ case MAN_BODY: p = man_macronames[n->tok]; break; @@ -230,8 +227,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 +239,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 +248,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)