- switch (type) {
- case (LIST_item):
- return(0);
- case (LIST_ohang):
- print_otag(h, TAG_DIV, 0, &tag);
- return(1);
- case (LIST_column):
- break;
- default:
- bufcat_su(h, "min-width", width);
- SCALE_INVERT(width);
- bufcat_su(h, "margin-left", width);
- if (n->next && n->next->child)
- bufcat_style(h, "float", "left");
-
- /* XXX: buffer if we run into body. */
- SCALE_HS_INIT(width, 1);
- bufcat_su(h, "margin-right", width);
- PAIR_STYLE_INIT(&tag, h);
- print_otag(h, TAG_DIV, 1, &tag);
- break;
- }
-
- switch (type) {
- case (LIST_diag):
- PAIR_CLASS_INIT(&tag, "diag");
- print_otag(h, TAG_SPAN, 1, &tag);
- break;
- case (LIST_enum):
- ord = h->ords.head;
- assert(ord);
- nbuf[BUFSIZ - 1] = 0;
- (void)snprintf(nbuf, BUFSIZ - 1, "%d.", ord->pos++);
- print_text(h, nbuf);
- return(0);
- case (LIST_dash):
- print_text(h, "\\(en");
- return(0);
- case (LIST_hyphen):
- print_text(h, "\\(hy");
- return(0);
- case (LIST_bullet):
- print_text(h, "\\(bu");
- return(0);
- default:
- break;
- }
-
- return(1);
-}
-
-
-static int
-mdoc_it_pre(MDOC_ARGS)
-{
- int i, wp, comp;
- const struct mdoc_node *bl, *nn;
- struct roffsu width, offs;
- enum mdoc_list type;
-
- /*
- * XXX: be very careful in changing anything, here. Lists in
- * mandoc have many peculiarities; furthermore, they don't
- * translate well into HTML and require a bit of mangling.
- */
-
- bl = n->parent->parent;
- if (MDOC_BLOCK != n->type)
- bl = bl->parent;
-
- type = bl->data.list;
-
- /* Set default width and offset. */
-
- SCALE_HS_INIT(&offs, 0);
-
- switch (type) {
- case (LIST_enum):
- /* FALLTHROUGH */
- case (LIST_dash):
- /* FALLTHROUGH */
- case (LIST_hyphen):
- /* FALLTHROUGH */
- case (LIST_bullet):
- SCALE_HS_INIT(&width, 2);
- break;
- default:
- SCALE_HS_INIT(&width, INDENT);
- break;
- }
-
- /* Get width, offset, and compact arguments. */
-
- wp = -1;
- for (comp = i = 0; bl->args && i < (int)bl->args->argc; i++)
- switch (bl->args->argv[i].arg) {
- case (MDOC_Column):
- wp = i; /* Save for later. */
- break;
- case (MDOC_Width):
- a2width(bl->args->argv[i].value[0], &width);
- break;
- case (MDOC_Offset):
- a2offs(bl->args->argv[i].value[0], &offs);
- break;
- case (MDOC_Compact):
- comp = 1;
- break;
- default:
- break;
- }
-
- /* Override width in some cases. */
-
- switch (type) {
- case (LIST_ohang):
- /* FALLTHROUGH */
- case (LIST_item):
- /* FALLTHROUGH */
- case (LIST_inset):
- /* FALLTHROUGH */
- case (LIST_diag):
- SCALE_HS_INIT(&width, 0);
- break;
- default:
- if (0 == width.scale)
- SCALE_HS_INIT(&width, INDENT);
- break;
- }
-
- if (LIST_column == type && MDOC_BODY == n->type) {
- nn = n->parent->child;
- for (i = 0; nn && nn != n; nn = nn->next)
- if (MDOC_BODY == nn->type)
- i++;
- if (i < (int)bl->args->argv[wp].sz)
- a2width(bl->args->argv[wp].value[i], &width);
- }
-
- if (MDOC_HEAD == n->type)
- return(mdoc_it_head_pre(m, n, h, type, &width));
- else if (MDOC_BODY == n->type)
- return(mdoc_it_body_pre(m, n, h, type, &width));
-
- return(mdoc_it_block_pre(m, n, h, type, comp, &offs, &width));
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_bl_pre(MDOC_ARGS)
-{
- struct ord *ord;
-
- if (MDOC_HEAD == n->type)
- return(0);
- if (MDOC_BLOCK != n->type)
- return(1);
- if (LIST_enum != n->data.list)
- return(1);
-
- ord = malloc(sizeof(struct ord));
- if (NULL == ord) {
- perror(NULL);
- exit(EXIT_FAILURE);
- }
- ord->cookie = n;
- ord->pos = 1;
- ord->next = h->ords.head;
- h->ords.head = ord;
- return(1);
-}
-
-
-/* ARGSUSED */
-static void
-mdoc_bl_post(MDOC_ARGS)
-{
- struct ord *ord;
-
- if (MDOC_BLOCK != n->type)
- return;
- if (LIST_enum != n->data.list)
- return;
-
- ord = h->ords.head;
- assert(ord);
- h->ords.head = ord->next;
- free(ord);
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_ex_pre(MDOC_ARGS)
-{
- const struct mdoc_node *nn;
- struct tag *t;
- struct htmlpair tag;