=================================================================== RCS file: /cvs/mandoc/mdoc_html.c,v retrieving revision 1.250 retrieving revision 1.254 diff -u -p -r1.250 -r1.254 --- mandoc/mdoc_html.c 2017/01/18 19:22:22 1.250 +++ mandoc/mdoc_html.c 2017/01/19 15:48:39 1.254 @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.250 2017/01/18 19:22:22 schwarze Exp $ */ +/* $Id: mdoc_html.c,v 1.254 2017/01/19 15:48:39 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze @@ -48,6 +48,7 @@ struct htmlmdoc { void (*post)(MDOC_ARGS); }; +static char *make_id(const struct roff_node *); static void print_mdoc_head(MDOC_ARGS); static void print_mdoc_node(MDOC_ARGS); static void print_mdoc_nodelist(MDOC_ARGS); @@ -299,25 +300,25 @@ void html_mdoc(void *arg, const struct roff_man *mdoc) { struct html *h; - struct tag *t, *tt; + struct tag *t; 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_mdoc_head(&mdoc->meta, mdoc->first->child, 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"); + } mdoc_root_pre(&mdoc->meta, mdoc->first->child, h); + t = print_otag(h, TAG_DIV, "c", "manual-text"); print_mdoc_nodelist(&mdoc->meta, mdoc->first->child, h); - mdoc_root_post(&mdoc->meta, mdoc->first->child, h); print_tagq(h, t); + mdoc_root_post(&mdoc->meta, mdoc->first->child, h); + print_tagq(h, NULL); } static void @@ -384,8 +385,6 @@ print_mdoc_node(MDOC_ARGS) h->flags |= HTML_NOSPACE; return; case ROFFT_EQN: - if (n->flags & NODE_LINE) - putchar('\n'); print_eqn(h, n->eqn); break; case ROFFT_TBL: @@ -494,7 +493,7 @@ mdoc_root_pre(MDOC_ARGS) return 1; } -char * +static char * make_id(const struct roff_node *n) { const struct roff_node *nch; @@ -523,7 +522,6 @@ mdoc_sh_pre(MDOC_ARGS) switch (n->type) { case ROFFT_BLOCK: - print_otag(h, TAG_DIV, "c", "section"); return 1; case ROFFT_BODY: if (n->sec == SEC_AUTHORS) @@ -534,10 +532,10 @@ mdoc_sh_pre(MDOC_ARGS) } if ((id = make_id(n)) != NULL) { - print_otag(h, TAG_H1, "i", id); + print_otag(h, TAG_H1, "ci", "Sh", id); free(id); } else - print_otag(h, TAG_H1, ""); + print_otag(h, TAG_H1, "c", "Sh"); return 1; } @@ -547,17 +545,14 @@ mdoc_ss_pre(MDOC_ARGS) { char *id; - if (n->type == ROFFT_BLOCK) { - print_otag(h, TAG_DIV, "c", "subsection"); + if (n->type != ROFFT_HEAD) return 1; - } else if (n->type == ROFFT_BODY) - return 1; if ((id = make_id(n)) != NULL) { - print_otag(h, TAG_H2, "i", id); + print_otag(h, TAG_H2, "ci", "Ss", id); free(id); } else - print_otag(h, TAG_H2, ""); + print_otag(h, TAG_H2, "c", "Ss"); return 1; } @@ -641,11 +636,11 @@ mdoc_xr_pre(MDOC_ARGS) return 0; if (h->base_man) - print_otag(h, TAG_A, "chM", "link-man", + print_otag(h, TAG_A, "chM", "Xr", n->child->string, n->child->next == NULL ? NULL : n->child->next->string); else - print_otag(h, TAG_A, "c", "link-man"); + print_otag(h, TAG_A, "c", "Xr"); n = n->child; print_text(h, n->string); @@ -868,12 +863,11 @@ mdoc_sx_pre(MDOC_ARGS) { char *id; - print_otag(h, TAG_I, "c", "link-sec"); if ((id = make_id(n)) != NULL) { - print_otag(h, TAG_A, "chR", "link-sec", id); + print_otag(h, TAG_A, "chR", "Sx", id); free(id); } else - print_otag(h, TAG_A, "c", "link-sec"); + print_otag(h, TAG_A, "c", "Sx"); return 1; }