- if (0 == width.scale)
- SCALE_HS_INIT(&width, INDENT);
- break;
- }
-
- /* Flip to body/block processing. */
-
- if (MDOC_BODY == n->type)
- return(mdoc_it_body_pre(m, n, h, type));
- if (MDOC_BLOCK == n->type)
- return(mdoc_it_block_pre(m, n, h, type, comp,
- &offs, &width));
-
- /* Override column widths. */
-
- if (MDOC_Column == type) {
- nn = n->parent->child;
- for (i = 0; nn && nn != n; nn = nn->next, i++)
- /* Counter... */ ;
- if (i < (int)bl->args->argv[wp].sz)
- a2width(bl->args->argv[wp].value[i], &width);
- }
-
- return(mdoc_it_head_pre(m, n, h, type, &width));
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_bl_pre(MDOC_ARGS)
-{
- struct ord *ord;
-
- if (MDOC_BLOCK != n->type)
- return(1);
- if (MDOC_Enum != a2list(n))
- return(1);
-
- ord = malloc(sizeof(struct ord));
- if (NULL == ord)
- err(EXIT_FAILURE, "malloc");
- 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 (MDOC_Enum != a2list(n))
- 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;
-
- PAIR_CLASS_INIT(&tag, "utility");
-
- print_text(h, "The");
- for (nn = n->child; nn; nn = nn->next) {
- t = print_otag(h, TAG_SPAN, 1, &tag);
- print_text(h, nn->string);
- print_tagq(h, t);
-
- h->flags |= HTML_NOSPACE;
-
- if (nn->next && NULL == nn->next->next)
- print_text(h, ", and");
- else if (nn->next)
- print_text(h, ",");
- else
- h->flags &= ~HTML_NOSPACE;
- }
-
- if (n->child->next)
- print_text(h, "utilities exit");
- else
- print_text(h, "utility exits");
-
- print_text(h, "0 on success, and >0 if an error occurs.");
- return(0);
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_dq_pre(MDOC_ARGS)
-{
-
- if (MDOC_BODY != n->type)
- return(1);
- print_text(h, "\\(lq");
- h->flags |= HTML_NOSPACE;
- return(1);
-}
-
-
-/* ARGSUSED */
-static void
-mdoc_dq_post(MDOC_ARGS)
-{
-
- if (MDOC_BODY != n->type)
- return;
- h->flags |= HTML_NOSPACE;
- print_text(h, "\\(rq");
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_pq_pre(MDOC_ARGS)
-{
-
- if (MDOC_BODY != n->type)
- return(1);
- print_text(h, "\\&(");
- h->flags |= HTML_NOSPACE;
- return(1);
-}
-
-
-/* ARGSUSED */
-static void
-mdoc_pq_post(MDOC_ARGS)
-{
-
- if (MDOC_BODY != n->type)
- return;
- print_text(h, ")");
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_sq_pre(MDOC_ARGS)
-{
-
- if (MDOC_BODY != n->type)
- return(1);
- print_text(h, "\\(oq");
- h->flags |= HTML_NOSPACE;
- return(1);
-}
-
-
-/* ARGSUSED */
-static void
-mdoc_sq_post(MDOC_ARGS)
-{
-
- if (MDOC_BODY != n->type)
- return;
- h->flags |= HTML_NOSPACE;
- print_text(h, "\\(aq");
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_em_pre(MDOC_ARGS)
-{
- struct htmlpair tag;
-
- PAIR_CLASS_INIT(&tag, "emph");
- print_otag(h, TAG_SPAN, 1, &tag);
- return(1);
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_d1_pre(MDOC_ARGS)
-{
- struct htmlpair tag[2];
- struct roffsu su;
-
- if (MDOC_BLOCK != n->type)
- return(1);
-
- /* FIXME: D1 shouldn't be literal. */
-
- SCALE_VS_INIT(&su, INDENT - 2);
- bufcat_su(h, "margin-left", &su);
- PAIR_CLASS_INIT(&tag[0], "lit");
- PAIR_STYLE_INIT(&tag[1], h);
- print_otag(h, TAG_DIV, 2, tag);
- return(1);
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_sx_pre(MDOC_ARGS)
-{
- struct htmlpair tag[2];
- const struct mdoc_node *nn;
- char buf[BUFSIZ];
-
- /* FIXME: duplicates? */
-
- (void)strlcpy(buf, "#", BUFSIZ);
- for (nn = n->child; nn; nn = nn->next) {
- (void)strlcat(buf, nn->string, BUFSIZ);
- if (nn->next)
- (void)strlcat(buf, "_", BUFSIZ);