=================================================================== RCS file: /cvs/mandoc/man_html.c,v retrieving revision 1.84 retrieving revision 1.88 diff -u -p -r1.84 -r1.88 --- mandoc/man_html.c 2011/11/18 17:05:50 1.84 +++ mandoc/man_html.c 2012/06/02 20:16:23 1.88 @@ -1,6 +1,6 @@ -/* $Id: man_html.c,v 1.84 2011/11/18 17:05:50 joerg Exp $ */ +/* $Id: man_html.c,v 1.88 2012/06/02 20:16:23 schwarze Exp $ */ /* - * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons + * Copyright (c) 2008-2012 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -58,26 +58,25 @@ static void print_man(MAN_ARGS); static void print_man_head(MAN_ARGS); static void print_man_nodelist(MAN_ARGS); static void print_man_node(MAN_ARGS); - static int a2width(const struct man_node *, struct roffsu *); - -static int man_alt_pre(MAN_ARGS); -static int man_br_pre(MAN_ARGS); -static int man_ign_pre(MAN_ARGS); -static int man_in_pre(MAN_ARGS); -static int man_literal_pre(MAN_ARGS); -static void man_root_post(MAN_ARGS); -static void man_root_pre(MAN_ARGS); static int man_B_pre(MAN_ARGS); static int man_HP_pre(MAN_ARGS); -static int man_I_pre(MAN_ARGS); static int man_IP_pre(MAN_ARGS); +static int man_I_pre(MAN_ARGS); +static int man_OP_pre(MAN_ARGS); static int man_PP_pre(MAN_ARGS); static int man_RS_pre(MAN_ARGS); static int man_SH_pre(MAN_ARGS); static int man_SM_pre(MAN_ARGS); static int man_SS_pre(MAN_ARGS); +static int man_alt_pre(MAN_ARGS); +static int man_br_pre(MAN_ARGS); +static int man_ign_pre(MAN_ARGS); +static int man_in_pre(MAN_ARGS); +static int man_literal_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 */ @@ -113,6 +112,9 @@ static const struct htmlman mans[MAN_MAX] = { { man_ign_pre, NULL }, /* AT */ { man_in_pre, NULL }, /* in */ { man_ign_pre, NULL }, /* ft */ + { man_OP_pre, NULL }, /* OP */ + { man_literal_pre, NULL }, /* EX */ + { man_literal_pre, NULL }, /* EE */ }; /* @@ -178,6 +180,8 @@ print_man_head(MAN_ARGS) { print_gen_head(h); + assert(m->title); + assert(m->msec); bufcat_fmt(h, "%s(%s)", m->title, m->msec); print_otag(h, TAG_TITLE, 0, NULL); print_text(h, h->buf); @@ -305,8 +309,9 @@ man_root_pre(MAN_ARGS) if (m->vol) (void)strlcat(b, m->vol, BUFSIZ); - snprintf(title, BUFSIZ - 1, "%s(%s)", m->title ? m->title : "", - m->msec ? m->msec : ""); + assert(m->title); + assert(m->msec); + snprintf(title, BUFSIZ - 1, "%s(%s)", m->title, m->msec); PAIR_SUMMARY_INIT(&tag[0], "Document Header"); PAIR_CLASS_INIT(&tag[1], "head"); @@ -360,8 +365,8 @@ man_root_post(MAN_ARGS) PAIR_CLASS_INIT(&tag[0], "foot-date"); print_otag(h, TAG_TD, 1, tag); - if (m->date) - print_text(h, m->date); + assert(m->date); + print_text(h, m->date); print_stagq(h, tt); PAIR_CLASS_INIT(&tag[0], "foot-os"); @@ -583,6 +588,37 @@ man_HP_pre(MAN_ARGS) /* ARGSUSED */ static int +man_OP_pre(MAN_ARGS) +{ + struct tag *tt; + struct htmlpair tag; + + print_text(h, "["); + h->flags |= HTML_NOSPACE; + PAIR_CLASS_INIT(&tag, "opt"); + tt = print_otag(h, TAG_SPAN, 1, &tag); + + if (NULL != (n = n->child)) { + print_otag(h, TAG_B, 0, NULL); + print_text(h, n->string); + } + + print_stagq(h, tt); + + if (NULL != n && NULL != n->next) { + print_otag(h, TAG_I, 0, NULL); + print_text(h, n->next->string); + } + + print_stagq(h, tt); + h->flags |= HTML_NOSPACE; + print_text(h, "]"); + return(0); +} + + +/* ARGSUSED */ +static int man_B_pre(MAN_ARGS) { @@ -604,7 +640,7 @@ static int man_literal_pre(MAN_ARGS) { - if (MAN_nf != n->tok) { + if (MAN_fi == n->tok || MAN_EE == n->tok) { print_otag(h, TAG_BR, 0, NULL); mh->fl &= ~MANH_LITERAL; } else