-
-/* ARGSUSED */
-static void
-mdoc_root_post(MDOC_ARGS)
-{
- struct tm tm;
- struct htmlpair tag[2];
- struct tag *t, *tt;
- char b[BUFSIZ];
-
- (void)localtime_r(&m->date, &tm);
-
- if (0 == strftime(b, BUFSIZ - 1, "%B %e, %Y", &tm))
- err(EXIT_FAILURE, "strftime");
-
- tag[0].key = ATTR_CLASS;
- tag[0].val = "footer";
- tag[1].key = ATTR_STYLE;
- tag[1].val = "width: 100%;";
- t = print_otag(h, TAG_TABLE, 2, tag);
- tt = print_otag(h, TAG_TR, 0, NULL);
-
- tag[0].key = ATTR_STYLE;
- tag[0].val = "width: 50%;";
- print_otag(h, TAG_TD, 1, tag);
- print_text(h, b);
- print_stagq(h, tt);
-
- tag[0].key = ATTR_STYLE;
- tag[0].val = "width: 50%; text-align: right;";
- print_otag(h, TAG_TD, 1, tag);
- print_text(h, m->os);
- print_tagq(h, t);
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_root_pre(MDOC_ARGS)
-{
- struct htmlpair tag[2];
- struct tag *t, *tt;
- char b[BUFSIZ], title[BUFSIZ];
-
- (void)strlcpy(b, m->vol, BUFSIZ);
-
- if (m->arch) {
- (void)strlcat(b, " (", BUFSIZ);
- (void)strlcat(b, m->arch, BUFSIZ);
- (void)strlcat(b, ")", BUFSIZ);
- }
-
- (void)snprintf(title, BUFSIZ - 1,
- "%s(%d)", m->title, m->msec);
-
- tag[0].key = ATTR_CLASS;
- tag[0].val = "body";
- t = print_otag(h, TAG_DIV, 1, tag);
-
- tag[0].key = ATTR_CLASS;
- tag[0].val = "header";
- tag[1].key = ATTR_STYLE;
- tag[1].val = "width: 100%;";
- print_otag(h, TAG_TABLE, 2, tag);
- tt = print_otag(h, TAG_TR, 0, NULL);
-
- tag[0].key = ATTR_STYLE;
- tag[0].val = "width: 33%;";
- print_otag(h, TAG_TD, 1, tag);
- print_text(h, b);
- print_stagq(h, tt);
-
- tag[0].key = ATTR_STYLE;
- tag[0].val = "width: 33%; text-align: center;";
- print_otag(h, TAG_TD, 1, tag);
- print_text(h, title);
- print_stagq(h, tt);
-
- tag[0].key = ATTR_STYLE;
- tag[0].val = "width: 33%; text-align: right;";
- print_otag(h, TAG_TD, 1, tag);
- print_text(h, b);
- print_stagq(h, t);
-
- return(1);
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_sh_pre(MDOC_ARGS)
-{
- struct htmlpair tag[2];
- const struct mdoc_node *nn;
-
- if (MDOC_HEAD == n->type) {
- tag[0].key = ATTR_CLASS;
- tag[0].val = "sec-head";
- print_otag(h, TAG_DIV, 1, tag);
- print_otag(h, TAG_SPAN, 1, tag);
-
- for (nn = n->child; nn; nn = nn->next) {
- bufcat(nn->string);
- if (nn->next)
- bufcat(" ");
- }
- tag[0].key = ATTR_NAME;
- tag[0].val = buf;
- print_otag(h, TAG_A, 1, tag);
- return(1);
- } else if (MDOC_BLOCK == n->type) {
- tag[0].key = ATTR_CLASS;
- tag[0].val = "sec-block";
-
- if (n->prev && NULL == n->prev->body->child) {
- print_otag(h, TAG_DIV, 1, tag);
- return(1);
- }
-
- bufcat("margin-top: 1em;");
- if (NULL == n->next)
- bufcat("margin-bottom: 1em;");
-
- tag[1].key = ATTR_STYLE;
- tag[1].val = buf;
-
- print_otag(h, TAG_DIV, 2, tag);
- return(1);
- }
-
- buffmt("margin-left: %dem;", INDENT);
-
- tag[0].key = ATTR_CLASS;
- tag[0].val = "sec-body";
- tag[1].key = ATTR_STYLE;
- tag[1].val = buf;
-
- print_otag(h, TAG_DIV, 2, tag);
- return(1);
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_ss_pre(MDOC_ARGS)
-{
- struct htmlpair tag[2];
- int i;
- const struct mdoc_node *nn;
-
- i = 0;
-
- if (MDOC_BODY == n->type) {
- tag[i].key = ATTR_CLASS;
- tag[i++].val = "ssec-body";
- if (n->parent->next && n->child) {
- bufcat("margin-bottom: 1em;");
- tag[i].key = ATTR_STYLE;
- tag[i++].val = buf;
- }
- print_otag(h, TAG_DIV, i, tag);
- return(1);
- } else if (MDOC_BLOCK == n->type) {
- tag[i].key = ATTR_CLASS;
- tag[i++].val = "ssec-block";
- if (n->prev) {
- bufcat("margin-top: 1em;");
- tag[i].key = ATTR_STYLE;
- tag[i++].val = buf;
- }
- print_otag(h, TAG_DIV, i, tag);
- return(1);
- }
-
- buffmt("margin-left: -%dem;", INDENT - HALFINDENT);
-
- tag[0].key = ATTR_CLASS;
- tag[0].val = "ssec-head";
- tag[1].key = ATTR_STYLE;
- tag[1].val = buf;
-
- print_otag(h, TAG_DIV, 2, tag);
- print_otag(h, TAG_SPAN, 1, tag);
-
- bufinit();
- for (nn = n->child; nn; nn = nn->next) {
- bufcat(nn->string);
- if (nn->next)
- bufcat(" ");
- }
- tag[0].key = ATTR_NAME;
- tag[0].val = buf;
- print_otag(h, TAG_A, 1, tag);
-
- return(1);
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_fl_pre(MDOC_ARGS)
-{
- struct htmlpair tag;
-
- tag.key = ATTR_CLASS;
- tag.val = "flag";
-
- print_otag(h, TAG_SPAN, 1, &tag);
- if (MDOC_Fl == n->tok) {
- print_text(h, "\\-");
- h->flags |= HTML_NOSPACE;
- }
- return(1);
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_pp_pre(MDOC_ARGS)
-{
- struct htmlpair tag;
-
- tag.key = ATTR_STYLE;
- tag.val = "clear: both; height: 1em;";
- print_otag(h, TAG_DIV, 1, &tag);
- return(0);
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_nd_pre(MDOC_ARGS)
-{
- struct htmlpair tag;
-
- if (MDOC_BODY != n->type)
- return(1);
-
- /* XXX - this can contain block elements! */
- print_text(h, "\\(em");
- tag.key = ATTR_CLASS;
- tag.val = "desc-body";
- print_otag(h, TAG_SPAN, 1, &tag);
- return(1);
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_op_pre(MDOC_ARGS)
-{
- struct htmlpair tag;
-
- if (MDOC_BODY != n->type)
- return(1);
-
- /* XXX - this can contain block elements! */
- print_text(h, "\\(lB");
- tag.key = ATTR_CLASS;
- tag.val = "opt";
- print_otag(h, TAG_SPAN, 1, &tag);
- return(1);
-}
-
-
-/* ARGSUSED */
-static void
-mdoc_op_post(MDOC_ARGS)
-{
-
- if (MDOC_BODY != n->type)
- return;
- h->flags |= HTML_NOSPACE;
- print_text(h, "\\(rB");
-}
-
-
-static int
-mdoc_nm_pre(MDOC_ARGS)
-{
- struct htmlpair tag;
-
- if ( ! (HTML_NEWLINE & h->flags))
- if (SEC_SYNOPSIS == n->sec) {
- tag.key = ATTR_STYLE;
- tag.val = "clear: both;";
- print_otag(h, TAG_BR, 1, &tag);
- }
-
- tag.key = ATTR_CLASS;
- tag.val = "name";
-
- print_otag(h, TAG_SPAN, 1, &tag);
- if (NULL == n->child)
- print_text(h, m->name);
-
- return(1);
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_xr_pre(MDOC_ARGS)
-{
- struct htmlpair tag[2];
- const char *name, *sec;
- const struct mdoc_node *nn;
-
- nn = n->child;
- name = nn && nn->string ? nn->string : "";
- nn = nn ? nn->next : NULL;
- sec = nn && nn->string ? nn->string : "";
-
- buffmt("%s%s%s.html", name, name && sec ? "." : "", sec);
-
- tag[0].key = ATTR_CLASS;
- tag[0].val = "link-man";
- tag[1].key = ATTR_HREF;
- tag[1].val = buf;
- print_otag(h, TAG_A, 2, tag);
-
- nn = n->child;
- print_text(h, nn->string);
- if (NULL == (nn = nn->next))
- return(0);
-
- h->flags |= HTML_NOSPACE;
- print_text(h, "(");
- h->flags |= HTML_NOSPACE;
- print_text(h, nn->string);
- h->flags |= HTML_NOSPACE;
- print_text(h, ")");
-
- return(0);
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_ns_pre(MDOC_ARGS)
-{
-
- h->flags |= HTML_NOSPACE;
- return(1);
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_ar_pre(MDOC_ARGS)
-{
- struct htmlpair tag;
-
- tag.key = ATTR_CLASS;
- tag.val = "arg";
-
- print_otag(h, TAG_SPAN, 1, &tag);
- return(1);
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_xx_pre(MDOC_ARGS)
-{
- const char *pp;
- struct htmlpair tag;
-
- switch (n->tok) {
- case (MDOC_Bsx):
- pp = "BSDI BSD/OS";
- break;
- case (MDOC_Dx):
- pp = "DragonFlyBSD";
- break;
- case (MDOC_Fx):
- pp = "FreeBSD";
- break;
- case (MDOC_Nx):
- pp = "NetBSD";
- break;
- case (MDOC_Ox):
- pp = "OpenBSD";
- break;
- case (MDOC_Ux):
- pp = "UNIX";
- break;
- default:
- return(1);
- }
-
- tag.key = ATTR_CLASS;
- tag.val = "unix";
-
- print_otag(h, TAG_SPAN, 1, &tag);
- print_text(h, pp);
- return(1);
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_tbl_block_pre(MDOC_ARGS, int t, int w, int o, int c)
-{
- struct htmlpair tag;
-
- switch (t) {
- case (MDOC_Column):
- /* FALLTHROUGH */
- case (MDOC_Item):
- /* FALLTHROUGH */
- case (MDOC_Ohang):
- buffmt("margin-left: %dem; clear: both;", o);
- break;
- default:
- buffmt("margin-left: %dem; clear: both;", w + o);
- break;
- }
-
- if ( ! c && n->prev && n->prev->body->child)
- bufcat("padding-top: 1em;");
-
- tag.key = ATTR_STYLE;
- tag.val = buf;
- print_otag(h, TAG_DIV, 1, &tag);
- return(1);
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_tbl_body_pre(MDOC_ARGS, int t, int w)
-{
-
- print_otag(h, TAG_DIV, 0, NULL);
- return(1);
-}
-
-
-/* ARGSUSED */
-static int
-mdoc_tbl_head_pre(MDOC_ARGS, int t, int w)