=================================================================== RCS file: /cvs/mandoc/mdoc_html.c,v retrieving revision 1.178 retrieving revision 1.179 diff -u -p -r1.178 -r1.179 --- mandoc/mdoc_html.c 2011/08/26 09:03:17 1.178 +++ mandoc/mdoc_html.c 2011/10/05 21:35:17 1.179 @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.178 2011/08/26 09:03:17 kristaps Exp $ */ +/* $Id: mdoc_html.c,v 1.179 2011/10/05 21:35:17 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * @@ -262,17 +262,9 @@ static const char * const lists[LIST_MAX] = { void html_mdoc(void *arg, const struct mdoc *m) { - struct html *h; - struct tag *t; - h = (struct html *)arg; - - print_gen_decls(h); - t = print_otag(h, TAG_HTML, 0, NULL); - print_mdoc(mdoc_meta(m), mdoc_node(m), h); - print_tagq(h, t); - - printf("\n"); + print_mdoc(mdoc_meta(m), mdoc_node(m), (struct html *)arg); + putchar('\n'); } @@ -360,13 +352,22 @@ a2offs(const char *p, struct roffsu *su) static void print_mdoc(MDOC_ARGS) { - struct tag *t; + struct tag *t, *tt; + struct htmlpair tag; - t = print_otag(h, TAG_HEAD, 0, NULL); - print_mdoc_head(m, n, h); - print_tagq(h, t); + PAIR_CLASS_INIT(&tag, "mandoc"); - t = print_otag(h, TAG_BODY, 0, NULL); + if ( ! (HTML_FRAGMENT & h->oflags)) { + print_gen_decls(h); + t = print_otag(h, TAG_HTML, 0, NULL); + tt = print_otag(h, TAG_HEAD, 0, NULL); + print_mdoc_head(m, n, h); + print_tagq(h, tt); + print_otag(h, TAG_BODY, 0, NULL); + print_otag(h, TAG_DIV, 1, &tag); + } else + t = print_otag(h, TAG_DIV, 1, &tag); + print_mdoc_nodelist(m, n, h); print_tagq(h, t); }