summaryrefslogtreecommitdiffstats
path: root/tree.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-01-02 20:34:05 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-01-02 20:34:05 +0000
commitacbea5cc811c026741e14c43e082ea541d143fba (patch)
treea0ca5c254d6b5287bf5222a94071986f6e362eae /tree.c
parentf279bc4a434881f935cf80613c8aa4e477c45f13 (diff)
downloadmandoc-acbea5cc811c026741e14c43e082ea541d143fba.tar.gz
Fix table to print nicely (merging error). Also have -Ttree push out some
header stuff.
Diffstat (limited to 'tree.c')
-rw-r--r--tree.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/tree.c b/tree.c
index 02c1be43..67a74e01 100644
--- a/tree.c
+++ b/tree.c
@@ -30,7 +30,7 @@
static void print_mdoc(const struct mdoc_node *, int);
static void print_man(const struct man_node *, int);
-static void print_span(const struct tbl_span *);
+static void print_span(const struct tbl_span *, int);
/* ARGSUSED */
@@ -136,13 +136,13 @@ print_mdoc(const struct mdoc_node *n, int indent)
/* NOTREACHED */
}
- for (i = 0; i < indent; i++)
- putchar('\t');
-
if (n->span) {
assert(NULL == p);
- print_span(n->span);
+ print_span(n->span, indent);
} else {
+ for (i = 0; i < indent; i++)
+ putchar('\t');
+
printf("%s (%s)", p, t);
for (i = 0; i < (int)argc; i++) {
@@ -228,14 +228,14 @@ print_man(const struct man_node *n, int indent)
/* NOTREACHED */
}
- for (i = 0; i < indent; i++)
- putchar('\t');
-
if (n->span) {
assert(NULL == p);
- print_span(n->span);
- } else
+ print_span(n->span, indent);
+ } else {
+ for (i = 0; i < indent; i++)
+ putchar('\t');
printf("%s (%s) %d:%d", p, t, n->line, n->pos);
+ }
putchar('\n');
@@ -246,9 +246,26 @@ print_man(const struct man_node *n, int indent)
}
static void
-print_span(const struct tbl_span *sp)
+print_span(const struct tbl_span *sp, int indent)
{
const struct tbl_dat *dp;
+ const struct tbl_head *hp;
+ int i;
+
+ if (TBL_SPAN_FIRST & sp->flags) {
+ for (i = 0; i < indent; i++)
+ putchar('\t');
+ printf("tbl-head: ");
+ for (hp = sp->head; hp; hp = hp->next) {
+ printf("[%d]", hp->width);
+ if (hp->next)
+ putchar(' ');
+ }
+ putchar('\n');
+ }
+
+ for (i = 0; i < indent; i++)
+ putchar('\t');
printf("tbl: ");