void html_man(void *arg, const struct roff_man *man) { struct html *h; struct tag *t; h = (struct html *)arg; if ((h->oflags & HTML_FRAGMENT) == 0) { print_gen_decls(h); print_otag(h, TAG_HTML, ""); t = print_otag(h, TAG_HEAD, ""); print_man_head(&man->meta, man->first, h); print_tagq(h, t); print_otag(h, TAG_BODY, ""); } man_root_pre(&man->meta, man->first, h); t = print_otag(h, TAG_DIV, "c", "manual-text"); print_man_nodelist(&man->meta, man->first->child, h); print_tagq(h, t); man_root_post(&man->meta, man->first, h); print_tagq(h, NULL); }
static void print_man_node(MAN_ARGS) { int child; struct tag *t; child = 1; t = h->tags.head; switch (n->type) { case MAN_ROOT: man_root_pre(man, n, mh, h); break; case MAN_TEXT: if ('\0' == *n->string) { print_paragraph(h); return; } if (n->flags & MAN_LINE && (*n->string == ' ' || (n->prev != NULL && mh->fl & MANH_LITERAL && ! (h->flags & HTML_NONEWLINE)))) print_otag(h, TAG_BR, 0, NULL); print_text(h, n->string); return; case MAN_EQN: print_eqn(h, n->eqn); break; case MAN_TBL: /* * This will take care of initialising all of the table * state data for the first table, then tearing it down * for the last one. */ print_tbl(h, n->span); return; default: /* * Close out scope of font prior to opening a macro * scope. */ if (HTMLFONT_NONE != h->metac) { h->metal = h->metac; h->metac = HTMLFONT_NONE; } /* * Close out the current table, if it's open, and unset * the "meta" table state. This will be reopened on the * next table element. */ if (h->tblt) { print_tblclose(h); t = h->tags.head; } if (mans[n->tok].pre) child = (*mans[n->tok].pre)(man, n, mh, h); break; } if (child && n->child) print_man_nodelist(man, n->child, mh, h); /* This will automatically close out any font scope. */ print_stagq(h, t); switch (n->type) { case MAN_ROOT: man_root_post(man, n, mh, h); break; case MAN_EQN: break; default: if (mans[n->tok].post) (*mans[n->tok].post)(man, n, mh, h); break; } }
static void print_man_node(MAN_ARGS) { int child; struct tag *t; child = 1; t = h->tags.head; switch (n->type) { case (MAN_ROOT): man_root_pre(man, n, mh, h); break; case (MAN_TEXT): /* * If we have a blank line, output a vertical space. * If we have a space as the first character, break * before printing the line's data. */ if ('\0' == *n->string) { print_otag(h, TAG_P, 0, NULL); return; } if (' ' == *n->string && MAN_LINE & n->flags) print_otag(h, TAG_BR, 0, NULL); else if (MANH_LITERAL & mh->fl && n->prev) print_otag(h, TAG_BR, 0, NULL); print_text(h, n->string); return; case (MAN_EQN): print_eqn(h, n->eqn); break; case (MAN_TBL): /* * This will take care of initialising all of the table * state data for the first table, then tearing it down * for the last one. */ print_tbl(h, n->span); return; default: /* * Close out scope of font prior to opening a macro * scope. */ if (HTMLFONT_NONE != h->metac) { h->metal = h->metac; h->metac = HTMLFONT_NONE; } /* * Close out the current table, if it's open, and unset * the "meta" table state. This will be reopened on the * next table element. */ if (h->tblt) { print_tblclose(h); t = h->tags.head; } if (mans[n->tok].pre) child = (*mans[n->tok].pre)(man, n, mh, h); break; } if (child && n->child) print_man_nodelist(man, n->child, mh, h); /* This will automatically close out any font scope. */ print_stagq(h, t); switch (n->type) { case (MAN_ROOT): man_root_post(man, n, mh, h); break; case (MAN_EQN): break; default: if (mans[n->tok].post) (*mans[n->tok].post)(man, n, mh, h); break; } }