=================================================================== RCS file: /cvs/mandoc/man_html.c,v retrieving revision 1.134 retrieving revision 1.137 diff -u -p -r1.134 -r1.137 --- mandoc/man_html.c 2017/03/15 11:29:53 1.134 +++ mandoc/man_html.c 2017/05/04 17:48:28 1.137 @@ -1,4 +1,4 @@ -/* $Id: man_html.c,v 1.134 2017/03/15 11:29:53 schwarze Exp $ */ +/* $Id: man_html.c,v 1.137 2017/05/04 17:48:28 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons * Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze @@ -71,8 +71,7 @@ static int man_in_pre(MAN_ARGS); static void man_root_post(MAN_ARGS); static void man_root_pre(MAN_ARGS); -static const struct htmlman mans[MAN_MAX] = { - { man_br_pre, NULL }, /* br */ +static const struct htmlman __mans[MAN_MAX - MAN_TH] = { { NULL, NULL }, /* TH */ { man_SH_pre, NULL }, /* SH */ { man_SS_pre, NULL }, /* SS */ @@ -111,6 +110,7 @@ static const struct htmlman mans[MAN_MAX] = { { NULL, NULL }, /* UE */ { man_ign_pre, NULL }, /* ll */ }; +static const struct htmlman *const mans = __mans - MAN_TH; /* @@ -304,6 +304,18 @@ print_man_node(MAN_ARGS) print_tblclose(h); t = h->tag; + if (n->tok < ROFF_MAX) { + switch(n->tok) { + case ROFF_br: + man_br_pre(man, n, h); + break; + default: + abort(); + } + break; + } + + assert(n->tok >= MAN_TH && n->tok < MAN_MAX); if (mans[n->tok].pre) child = (*mans[n->tok].pre)(man, n, h); @@ -440,7 +452,8 @@ man_SH_pre(MAN_ARGS) if (n->type == ROFFT_HEAD) { id = html_make_id(n); print_otag(h, TAG_H1, "cTi", "Sh", id); - print_otag(h, TAG_A, "chR", "selflink", id); + if (id != NULL) + print_otag(h, TAG_A, "chR", "selflink", id); free(id); } return 1; @@ -509,7 +522,8 @@ man_SS_pre(MAN_ARGS) if (n->type == ROFFT_HEAD) { id = html_make_id(n); print_otag(h, TAG_H2, "cTi", "Ss", id); - print_otag(h, TAG_A, "chR", "selflink", id); + if (id != NULL) + print_otag(h, TAG_A, "chR", "selflink", id); free(id); } return 1;