void print_tbl(struct html *h, const struct tbl_span *sp) { const struct tbl_head *hp; const struct tbl_dat *dp; struct htmlpair tag; struct tag *tt; /* Inhibit printing of spaces: we do padding ourselves. */ if (NULL == h->tblt) html_tblopen(h, sp); assert(h->tblt); h->flags |= HTML_NONOSPACE; h->flags |= HTML_NOSPACE; tt = print_otag(h, TAG_TR, 0, NULL); switch (sp->pos) { case (TBL_SPAN_HORIZ): /* FALLTHROUGH */ case (TBL_SPAN_DHORIZ): PAIR_INIT(&tag, ATTR_COLSPAN, "0"); print_otag(h, TAG_TD, 1, &tag); break; default: dp = sp->first; for (hp = sp->head; hp; hp = hp->next) { print_stagq(h, tt); print_otag(h, TAG_TD, 0, NULL); if (NULL == dp) break; if (TBL_CELL_DOWN != dp->layout->pos) if (dp->string) print_text(h, dp->string); dp = dp->next; } break; } print_tagq(h, tt); h->flags &= ~HTML_NONOSPACE; if (TBL_SPAN_LAST & sp->flags) { assert(h->tbl.cols); free(h->tbl.cols); h->tbl.cols = NULL; print_tblclose(h); } }
void print_tbl(struct html *h, const struct tbl_span *sp) { const struct tbl_dat *dp; struct htmlpair tag; struct tag *tt; int ic; /* Inhibit printing of spaces: we do padding ourselves. */ if (h->tblt == NULL) html_tblopen(h, sp); assert(h->tblt); h->flags |= HTML_NONOSPACE; h->flags |= HTML_NOSPACE; tt = print_otag(h, TAG_TR, 0, NULL); switch (sp->pos) { case TBL_SPAN_HORIZ: case TBL_SPAN_DHORIZ: PAIR_INIT(&tag, ATTR_COLSPAN, "0"); print_otag(h, TAG_TD, 1, &tag); break; default: dp = sp->first; for (ic = 0; ic < sp->opts->cols; ic++) { print_stagq(h, tt); print_otag(h, TAG_TD, 0, NULL); if (dp == NULL || dp->layout->col > ic) continue; if (dp->layout->pos != TBL_CELL_DOWN) if (dp->string != NULL) print_text(h, dp->string); dp = dp->next; } break; } print_tagq(h, tt); h->flags &= ~HTML_NONOSPACE; if (sp->next == NULL) { assert(h->tbl.cols); free(h->tbl.cols); h->tbl.cols = NULL; print_tblclose(h); } }