diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-02-06 22:02:58 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-02-06 22:02:58 +0000 |
commit | 7b8e2174fd0e7158995a5790c05254f664943dcc (patch) | |
tree | aa19a7b18778510790f6b700129ecb8960351d29 | |
parent | da98c7539daf0f47de95ebfe6c514b48047dcea0 (diff) | |
download | mandoc-7b8e2174fd0e7158995a5790c05254f664943dcc.tar.gz |
Let the line-number of a tbl_span be remembered.
-rw-r--r-- | man.c | 3 | ||||
-rw-r--r-- | mandoc.h | 1 | ||||
-rw-r--r-- | mdoc.c | 3 | ||||
-rw-r--r-- | tbl_data.c | 17 | ||||
-rw-r--r-- | tree.c | 7 |
5 files changed, 15 insertions, 16 deletions
@@ -305,8 +305,7 @@ man_span_alloc(struct man *m, const struct tbl_span *span) { struct man_node *n; - /* FIXME: grab from span */ - n = man_node_alloc(m, 0, 0, MAN_TBL, MAN_MAX); + n = man_node_alloc(m, span->line, 0, MAN_TBL, MAN_MAX); n->span = span; if ( ! man_node_append(m, n)) @@ -260,6 +260,7 @@ struct tbl_span { struct tbl_row *layout; /* layout row */ struct tbl_dat *first; struct tbl_dat *last; + int line; /* parse line */ int flags; #define TBL_SPAN_FIRST (1 << 0) #define TBL_SPAN_LAST (1 << 1) @@ -551,8 +551,7 @@ mdoc_span_alloc(struct mdoc *m, const struct tbl_span *sp) { struct mdoc_node *n; - /* FIXME: grab from tbl_span. */ - n = node_alloc(m, 0, 0, MDOC_MAX, MDOC_TBL); + n = node_alloc(m, sp->line, 0, MDOC_MAX, MDOC_TBL); n->span = sp; if ( ! node_append(m, n)) @@ -29,10 +29,10 @@ #include "libmandoc.h" #include "libroff.h" -static int data(struct tbl_node *, struct tbl_span *, - int, const char *, int *); -static struct tbl_span *newspan(struct tbl_node *, struct tbl_row *); - +static int data(struct tbl_node *, struct tbl_span *, + int, const char *, int *); +static struct tbl_span *newspan(struct tbl_node *, int, + struct tbl_row *); static int data(struct tbl_node *tbl, struct tbl_span *dp, @@ -176,11 +176,12 @@ tbl_cdata(struct tbl_node *tbl, int ln, const char *p) } static struct tbl_span * -newspan(struct tbl_node *tbl, struct tbl_row *rp) +newspan(struct tbl_node *tbl, int line, struct tbl_row *rp) { struct tbl_span *dp; dp = mandoc_calloc(1, sizeof(struct tbl_span)); + dp->line = line; dp->tbl = &tbl->opts; dp->layout = rp; dp->head = tbl->first_head; @@ -226,11 +227,11 @@ tbl_data(struct tbl_node *tbl, int ln, const char *p) rp && rp->first; rp = rp->next) { switch (rp->first->pos) { case (TBL_CELL_HORIZ): - dp = newspan(tbl, rp); + dp = newspan(tbl, ln, rp); dp->pos = TBL_SPAN_HORIZ; continue; case (TBL_CELL_DHORIZ): - dp = newspan(tbl, rp); + dp = newspan(tbl, ln, rp); dp->pos = TBL_SPAN_DHORIZ; continue; default: @@ -248,7 +249,7 @@ tbl_data(struct tbl_node *tbl, int ln, const char *p) assert(rp); - dp = newspan(tbl, rp); + dp = newspan(tbl, ln, rp); if ( ! strcmp(p, "_")) { dp->pos = TBL_SPAN_HORIZ; @@ -266,8 +266,6 @@ print_span(const struct tbl_span *sp, int indent) for (i = 0; i < indent; i++) putchar('\t'); - printf("tbl: "); - switch (sp->pos) { case (TBL_SPAN_HORIZ): putchar('-'); @@ -300,7 +298,8 @@ print_span(const struct tbl_span *sp, int indent) if (NULL == dp->layout) putchar('*'); putchar(']'); - if (dp->next) - putchar(' '); + putchar(' '); } + + printf("(tbl) %d:1", sp->line); } |