static int mdoc_sh_pre(MDOC_ARGS) { struct htmlpair tag; switch (n->type) { case MDOC_BLOCK: PAIR_CLASS_INIT(&tag, "section"); print_otag(h, TAG_DIV, 1, &tag); return(1); case MDOC_BODY: if (n->sec == SEC_AUTHORS) h->flags &= ~(HTML_SPLIT|HTML_NOSPLIT); return(1); default: break; } bufinit(h); bufcat(h, "x"); for (n = n->child; n && MDOC_TEXT == n->type; ) { bufcat_id(h, n->string); if (NULL != (n = n->next)) bufcat_id(h, " "); } if (NULL == n) { PAIR_ID_INIT(&tag, h->buf); print_otag(h, TAG_H1, 1, &tag); } else print_otag(h, TAG_H1, 0, NULL); return(1); }
static int mdoc_ss_pre(MDOC_ARGS) { struct htmlpair tag; if (MDOC_BLOCK == n->type) { PAIR_CLASS_INIT(&tag, "subsection"); print_otag(h, TAG_DIV, 1, &tag); return(1); } else if (MDOC_BODY == n->type) return(1); bufinit(h); bufcat(h, "x"); for (n = n->child; n && MDOC_TEXT == n->type; ) { bufcat_id(h, n->string); if (NULL != (n = n->next)) bufcat_id(h, " "); } if (NULL == n) { PAIR_ID_INIT(&tag, h->buf); print_otag(h, TAG_H2, 1, &tag); } else print_otag(h, TAG_H2, 0, NULL); return(1); }
/* ARGSUSED */ static int mdoc_sh_pre(MDOC_ARGS) { struct htmlpair tag; if (MDOC_BLOCK == n->type) { PAIR_CLASS_INIT(&tag, "section"); print_otag(h, TAG_DIV, 1, &tag); return(1); } else if (MDOC_BODY == n->type) return(1); bufinit(h); for (n = n->child; n; n = n->next) { bufcat_id(h, n->string); if (n->next) bufcat_id(h, " "); } PAIR_ID_INIT(&tag, h->buf); print_otag(h, TAG_H1, 1, &tag); return(1); }
/* ARGSUSED */ static int mdoc_ss_pre(MDOC_ARGS) { struct htmlpair tag; char buf[BUFSIZ]; if (MDOC_BLOCK == n->type) { PAIR_CLASS_INIT(&tag, "subsection"); print_otag(h, TAG_DIV, 1, &tag); return(1); } else if (MDOC_BODY == n->type) return(1); buf[0] = '\0'; for (n = n->child; n; n = n->next) { html_idcat(buf, n->string, BUFSIZ); if (n->next) html_idcat(buf, " ", BUFSIZ); } PAIR_ID_INIT(&tag, buf); print_otag(h, TAG_H2, 1, &tag); return(1); }
/* ARGSUSED */ static int mdoc_fn_pre(MDOC_ARGS) { struct tag *t; struct htmlpair tag[2]; char nbuf[BUFSIZ]; const char *sp, *ep; int sz, i, pretty; pretty = MDOC_SYNPRETTY & n->flags; synopsis_pre(h, n); /* Split apart into type and name. */ assert(n->child->string); sp = n->child->string; ep = strchr(sp, ' '); if (NULL != ep) { PAIR_CLASS_INIT(&tag[0], "ftype"); t = print_otag(h, TAG_I, 1, tag); while (ep) { sz = MIN((int)(ep - sp), BUFSIZ - 1); (void)memcpy(nbuf, sp, (size_t)sz); nbuf[sz] = '\0'; print_text(h, nbuf); sp = ++ep; ep = strchr(sp, ' '); } print_tagq(h, t); } PAIR_CLASS_INIT(&tag[0], "fname"); /* * FIXME: only refer to IDs that we know exist. */ #if 0 if (MDOC_SYNPRETTY & n->flags) { nbuf[0] = '\0'; html_idcat(nbuf, sp, BUFSIZ); PAIR_ID_INIT(&tag[1], nbuf); } else { strlcpy(nbuf, "#", BUFSIZ); html_idcat(nbuf, sp, BUFSIZ); PAIR_HREF_INIT(&tag[1], nbuf); } #endif t = print_otag(h, TAG_B, 1, tag); if (sp) { strlcpy(nbuf, sp, BUFSIZ); print_text(h, nbuf); } print_tagq(h, t); h->flags |= HTML_NOSPACE; print_text(h, "("); bufinit(h); PAIR_CLASS_INIT(&tag[0], "farg"); bufcat_style(h, "white-space", "nowrap"); PAIR_STYLE_INIT(&tag[1], h); for (n = n->child->next; n; n = n->next) { i = 1; if (MDOC_SYNPRETTY & n->flags) i = 2; t = print_otag(h, TAG_I, i, tag); print_text(h, n->string); print_tagq(h, t); if (n->next) { h->flags |= HTML_NOSPACE; print_text(h, ","); } } h->flags |= HTML_NOSPACE; print_text(h, ")"); if (pretty) { h->flags |= HTML_NOSPACE; print_text(h, ";"); } return(0); }