version 1.25, 2018/11/24 23:03:18 |
version 1.26, 2018/11/25 19:24:20 |
Line 101 print_tblclose(struct html *h) |
|
Line 101 print_tblclose(struct html *h) |
|
void |
void |
print_tbl(struct html *h, const struct tbl_span *sp) |
print_tbl(struct html *h, const struct tbl_span *sp) |
{ |
{ |
const struct tbl_dat *dp; |
const struct tbl_dat *dp; |
struct tag *tt; |
struct tag *tt; |
const char *halign, *valign; |
const char *hspans, *vspans, *halign, *valign; |
int ic; |
char hbuf[4], vbuf[4]; |
|
|
/* Inhibit printing of spaces: we do padding ourselves. */ |
/* Inhibit printing of spaces: we do padding ourselves. */ |
|
|
Line 124 print_tbl(struct html *h, const struct tbl_span *sp) |
|
Line 124 print_tbl(struct html *h, const struct tbl_span *sp) |
|
print_otag(h, TAG_TD, "?", "colspan", "0"); |
print_otag(h, TAG_TD, "?", "colspan", "0"); |
break; |
break; |
default: |
default: |
dp = sp->first; |
for (dp = sp->first; dp != NULL; dp = dp->next) { |
for (ic = 0; ic < sp->opts->cols; ic++) { |
|
print_stagq(h, tt); |
print_stagq(h, tt); |
if (dp == NULL || dp->layout->col > ic) { |
switch (dp->layout->pos) { |
print_otag(h, TAG_TD, ""); |
case TBL_CELL_SPAN: |
|
case TBL_CELL_DOWN: |
continue; |
continue; |
|
default: |
|
break; |
} |
} |
|
|
|
/* Determine the attribute values. */ |
|
|
|
if (dp->hspans > 0) { |
|
(void)snprintf(hbuf, sizeof(hbuf), |
|
"%d", dp->hspans + 1); |
|
hspans = hbuf; |
|
} else |
|
hspans = NULL; |
|
if (dp->vspans > 0) { |
|
(void)snprintf(vbuf, sizeof(vbuf), |
|
"%d", dp->vspans + 1); |
|
vspans = vbuf; |
|
} else |
|
vspans = NULL; |
|
|
switch (dp->layout->pos) { |
switch (dp->layout->pos) { |
case TBL_CELL_CENTRE: |
case TBL_CELL_CENTRE: |
halign = "center"; |
halign = "center"; |
Line 149 print_tbl(struct html *h, const struct tbl_span *sp) |
|
Line 167 print_tbl(struct html *h, const struct tbl_span *sp) |
|
valign = "bottom"; |
valign = "bottom"; |
else |
else |
valign = NULL; |
valign = NULL; |
|
|
|
/* Print the element and the attributes. */ |
|
|
if (halign == NULL && valign == NULL) |
if (halign == NULL && valign == NULL) |
print_otag(h, TAG_TD, ""); |
print_otag(h, TAG_TD, "??", |
|
"colspan", hspans, "rowspan", vspans); |
else if (halign == NULL) |
else if (halign == NULL) |
print_otag(h, TAG_TD, "s", |
print_otag(h, TAG_TD, "??s", |
|
"colspan", hspans, "rowspan", vspans, |
"vertical-align", valign); |
"vertical-align", valign); |
else if (valign == NULL) |
else if (valign == NULL) |
print_otag(h, TAG_TD, "s", |
print_otag(h, TAG_TD, "??s", |
|
"colspan", hspans, "rowspan", vspans, |
"text-align", halign); |
"text-align", halign); |
else |
else |
print_otag(h, TAG_TD, "ss", |
print_otag(h, TAG_TD, "??ss", |
|
"colspan", hspans, "rowspan", vspans, |
"vertical-align", valign, |
"vertical-align", valign, |
"text-align", halign); |
"text-align", halign); |
if (dp->layout->pos != TBL_CELL_DOWN) |
if (dp->string != NULL) |
if (dp->string != NULL) |
print_text(h, dp->string); |
print_text(h, dp->string); |
|
dp = dp->next; |
|
} |
} |
break; |
break; |
} |
} |