=================================================================== RCS file: /cvs/mandoc/man_html.c,v retrieving revision 1.122 retrieving revision 1.128 diff -u -p -r1.122 -r1.128 --- mandoc/man_html.c 2017/01/17 01:47:51 1.122 +++ mandoc/man_html.c 2017/01/20 23:51:00 1.128 @@ -1,4 +1,4 @@ -/* $Id: man_html.c,v 1.122 2017/01/17 01:47:51 schwarze Exp $ */ +/* $Id: man_html.c,v 1.128 2017/01/20 23:51:00 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons * Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze @@ -148,38 +148,38 @@ html_man(void *arg, const struct roff_man *man) { struct mhtml mh; struct html *h; - struct tag *t, *tt; + struct tag *t; memset(&mh, 0, sizeof(mh)); h = (struct html *)arg; - if ( ! (HTML_FRAGMENT & h->oflags)) { + if ((h->oflags & HTML_FRAGMENT) == 0) { print_gen_decls(h); - t = print_otag(h, TAG_HTML, ""); - tt = print_otag(h, TAG_HEAD, ""); + print_otag(h, TAG_HTML, ""); + t = print_otag(h, TAG_HEAD, ""); print_man_head(&man->meta, man->first, &mh, h); - print_tagq(h, tt); + print_tagq(h, t); print_otag(h, TAG_BODY, ""); - print_otag(h, TAG_DIV, "c", "mandoc"); - } else - t = print_otag(h, TAG_DIV, "c", "mandoc"); + } - print_man_nodelist(&man->meta, man->first, &mh, h); + man_root_pre(&man->meta, man->first, &mh, h); + t = print_otag(h, TAG_DIV, "c", "manual-text"); + print_man_nodelist(&man->meta, man->first->child, &mh, h); print_tagq(h, t); - putchar('\n'); + man_root_post(&man->meta, man->first, &mh, h); + print_tagq(h, NULL); } static void print_man_head(MAN_ARGS) { + char *cp; print_gen_head(h); - assert(man->title); - assert(man->msec); - bufinit(h); - bufcat_fmt(h, "%s(%s)", man->title, man->msec); + mandoc_asprintf(&cp, "%s(%s)", man->title, man->msec); print_otag(h, TAG_TITLE, ""); - print_text(h, h->buf); + print_text(h, cp); + free(cp); } static void @@ -202,9 +202,6 @@ print_man_node(MAN_ARGS) t = h->tags.head; switch (n->type) { - case ROFFT_ROOT: - man_root_pre(man, n, mh, h); - break; case ROFFT_TEXT: if ('\0' == *n->string) { print_paragraph(h); @@ -217,8 +214,6 @@ print_man_node(MAN_ARGS) print_text(h, n->string); return; case ROFFT_EQN: - if (n->flags & NODE_LINE) - putchar('\n'); print_eqn(h, n->eqn); break; case ROFFT_TBL: @@ -260,9 +255,6 @@ print_man_node(MAN_ARGS) print_stagq(h, t); switch (n->type) { - case ROFFT_ROOT: - man_root_post(man, n, mh, h); - break; case ROFFT_EQN: break; default: @@ -359,12 +351,11 @@ man_SH_pre(MAN_ARGS) { if (n->type == ROFFT_BLOCK) { mh->fl &= ~MANH_LITERAL; - print_otag(h, TAG_DIV, "c", "section"); return 1; } else if (n->type == ROFFT_BODY) return 1; - print_otag(h, TAG_H1, ""); + print_otag(h, TAG_H1, "c", "Sh"); return 1; } @@ -438,12 +429,11 @@ man_SS_pre(MAN_ARGS) { if (n->type == ROFFT_BLOCK) { mh->fl &= ~MANH_LITERAL; - print_otag(h, TAG_DIV, "c", "subsection"); return 1; } else if (n->type == ROFFT_BODY) return 1; - print_otag(h, TAG_H2, ""); + print_otag(h, TAG_H2, "c", "Ss"); return 1; } @@ -516,7 +506,7 @@ man_HP_pre(MAN_ARGS) sui.scale = -sum.scale; print_bvspace(h, n); - print_otag(h, TAG_DIV, "csului", "spacer", &sum, &sui); + print_otag(h, TAG_DIV, "csului", "Pp", &sum, &sui); return 1; } @@ -527,7 +517,7 @@ man_OP_pre(MAN_ARGS) print_text(h, "["); h->flags |= HTML_NOSPACE; - tt = print_otag(h, TAG_SPAN, "c", "opt"); + tt = print_otag(h, TAG_SPAN, "c", "Op"); if (NULL != (n = n->child)) { print_otag(h, TAG_B, ""); @@ -613,7 +603,7 @@ man_UR_pre(MAN_ARGS) assert(n->type == ROFFT_HEAD); if (n->child != NULL) { assert(n->child->type == ROFFT_TEXT); - print_otag(h, TAG_A, "ch", "link-ext", n->child->string); + print_otag(h, TAG_A, "ch", "Lk", n->child->string); } assert(n->next->type == ROFFT_BODY);