-/* ARGSUSED */
-static int
-mdoc_tbl_head_pre(MDOC_ARGS, int t, int w)
-{
- struct htmlpair tag;
- struct ord *ord;
- char nbuf[BUFSIZ];
-
- switch (t) {
- case (MDOC_Item):
- /* FALLTHROUGH */
- case (MDOC_Ohang):
- print_otag(h, TAG_DIV, 0, NULL);
- break;
- case (MDOC_Column):
- buffmt(h, "min-width: %dem;", w);
- bufcat(h, "clear: none;");
- if (n->next && MDOC_HEAD == n->next->type)
- bufcat(h, "float: left;");
- tag.key = ATTR_STYLE;
- tag.val = h->buf;
- print_otag(h, TAG_DIV, 1, &tag);
- break;
- default:
- buffmt(h, "margin-left: -%dem; min-width: %dem;",
- w, w ? w - 1 : 0);
- bufcat(h, "clear: left;");
- if (n->next && n->next->child)
- bufcat(h, "float: left;");
- bufcat(h, "padding-right: 1em;");
- tag.key = ATTR_STYLE;
- tag.val = h->buf;
- print_otag(h, TAG_DIV, 1, &tag);
- break;
- }
-
- switch (t) {
- case (MDOC_Diag):
- tag.key = ATTR_CLASS;
- tag.val = "diag";
- print_otag(h, TAG_SPAN, 1, &tag);
- break;
- case (MDOC_Enum):
- ord = SLIST_FIRST(&h->ords);
- assert(ord);
- nbuf[BUFSIZ - 1] = 0;
- (void)snprintf(nbuf, BUFSIZ - 1, "%d.", ord->pos++);
- print_text(h, nbuf);
- return(0);
- case (MDOC_Dash):
- print_text(h, "\\(en");
- return(0);
- case (MDOC_Hyphen):
- print_text(h, "\\(hy");
- return(0);
- case (MDOC_Bullet):
- print_text(h, "\\(bu");
- return(0);
- default:
- break;
+ if (MDOC_HEAD == n->type) {
+ switch (type) {
+ case LIST_bullet:
+ /* FALLTHROUGH */
+ case LIST_dash:
+ /* FALLTHROUGH */
+ case LIST_item:
+ /* FALLTHROUGH */
+ case LIST_hyphen:
+ /* FALLTHROUGH */
+ case LIST_enum:
+ return(0);
+ case LIST_diag:
+ /* FALLTHROUGH */
+ case LIST_hang:
+ /* FALLTHROUGH */
+ case LIST_inset:
+ /* FALLTHROUGH */
+ case LIST_ohang:
+ /* FALLTHROUGH */
+ case LIST_tag:
+ SCALE_VS_INIT(&su, ! bl->norm->Bl.comp);
+ bufcat_su(h, "margin-top", &su);
+ PAIR_STYLE_INIT(&tag[1], h);
+ print_otag(h, TAG_DT, 2, tag);
+ if (LIST_diag != type)
+ break;
+ PAIR_CLASS_INIT(&tag[0], "diag");
+ print_otag(h, TAG_B, 1, tag);
+ break;
+ case LIST_column:
+ break;
+ default:
+ break;
+ }
+ } else if (MDOC_BODY == n->type) {
+ switch (type) {
+ case LIST_bullet:
+ /* FALLTHROUGH */
+ case LIST_hyphen:
+ /* FALLTHROUGH */
+ case LIST_dash:
+ /* FALLTHROUGH */
+ case LIST_enum:
+ /* FALLTHROUGH */
+ case LIST_item:
+ SCALE_VS_INIT(&su, ! bl->norm->Bl.comp);
+ bufcat_su(h, "margin-top", &su);
+ PAIR_STYLE_INIT(&tag[1], h);
+ print_otag(h, TAG_LI, 2, tag);
+ break;
+ case LIST_diag:
+ /* FALLTHROUGH */
+ case LIST_hang:
+ /* FALLTHROUGH */
+ case LIST_inset:
+ /* FALLTHROUGH */
+ case LIST_ohang:
+ /* FALLTHROUGH */
+ case LIST_tag:
+ if (NULL == bl->norm->Bl.width) {
+ print_otag(h, TAG_DD, 1, tag);
+ break;
+ }
+ a2width(bl->norm->Bl.width, &su);
+ bufcat_su(h, "margin-left", &su);
+ PAIR_STYLE_INIT(&tag[1], h);
+ print_otag(h, TAG_DD, 2, tag);
+ break;
+ case LIST_column:
+ SCALE_VS_INIT(&su, ! bl->norm->Bl.comp);
+ bufcat_su(h, "margin-top", &su);
+ PAIR_STYLE_INIT(&tag[1], h);
+ print_otag(h, TAG_TD, 2, tag);
+ break;
+ default:
+ break;
+ }
+ } else {
+ switch (type) {
+ case LIST_column:
+ print_otag(h, TAG_TR, 1, tag);
+ break;
+ default:
+ break;
+ }