+
+
+/* ARGSUSED */
+static int
+mdoc_brq_pre(MDOC_ARGS)
+{
+
+ if (MDOC_BODY != n->type)
+ return(1);
+ print_text(h, "\\(lC");
+ h->flags |= HTML_NOSPACE;
+ return(1);
+}
+
+
+/* ARGSUSED */
+static void
+mdoc_brq_post(MDOC_ARGS)
+{
+
+ if (MDOC_BODY != n->type)
+ return;
+ h->flags |= HTML_NOSPACE;
+ print_text(h, "\\(rC");
+}
+
+
+/* ARGSUSED */
+static int
+mdoc_lk_pre(MDOC_ARGS)
+{
+ const struct mdoc_node *nn;
+ struct htmlpair tag[2];
+
+ nn = n->child;
+
+ tag[0].key = ATTR_CLASS;
+ tag[0].val = "link-ext";
+ tag[1].key = ATTR_HREF;
+ tag[1].val = nn->string;
+
+ print_otag(h, TAG_A, 2, tag);
+
+ if (NULL == nn->next)
+ return(1);
+
+ for (nn = nn->next; nn; nn = nn->next)
+ print_text(h, nn->string);
+
+ return(0);
+}
+
+
+/* ARGSUSED */
+static int
+mdoc_mt_pre(MDOC_ARGS)
+{
+ struct htmlpair tag[2];
+ struct tag *t;
+ const struct mdoc_node *nn;
+
+ tag[0].key = ATTR_CLASS;
+ tag[0].val = "link-mail";
+
+ for (nn = n->child; nn; nn = nn->next) {
+ bufinit();
+ bufcat("mailto:");
+ bufcat(nn->string);
+
+ tag[1].key = ATTR_HREF;
+ tag[1].val = buf;
+
+ t = print_otag(h, TAG_A, 2, tag);
+ print_text(h, nn->string);
+ print_tagq(h, t);
+ }
+
+ return(0);
+}
+
+
+/* ARGSUSED */
+static int
+mdoc_fo_pre(MDOC_ARGS)
+{
+ struct htmlpair tag;
+
+ if (MDOC_BODY == n->type) {
+ h->flags |= HTML_NOSPACE;
+ print_text(h, "(");
+ h->flags |= HTML_NOSPACE;
+ return(1);
+ } else if (MDOC_BLOCK == n->type)
+ return(1);
+
+ tag.key = ATTR_CLASS;
+ tag.val = "fname";
+ print_otag(h, TAG_SPAN, 1, &tag);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static void
+mdoc_fo_post(MDOC_ARGS)
+{
+ if (MDOC_BODY != n->type)
+ return;
+ h->flags |= HTML_NOSPACE;
+ print_text(h, ")");
+ h->flags |= HTML_NOSPACE;
+ print_text(h, ";");
+}
+
+
+/* ARGSUSED */
+static int
+mdoc_in_pre(MDOC_ARGS)
+{
+ const struct mdoc_node *nn;
+ struct htmlpair tag;
+
+ if (SEC_SYNOPSIS == n->sec) {
+ if (n->next && MDOC_In != n->next->tok) {
+ tag.key = ATTR_STYLE;
+ tag.val = "margin-bottom: 1em;";
+ print_otag(h, TAG_DIV, 1, &tag);
+ } else
+ print_otag(h, TAG_DIV, 0, NULL);
+ }
+
+ tag.key = ATTR_CLASS;
+ tag.val = "includes";
+
+ print_otag(h, TAG_SPAN, 1, &tag);
+
+ if (SEC_SYNOPSIS == n->sec)
+ print_text(h, "#include");
+
+ print_text(h, "<");
+ h->flags |= HTML_NOSPACE;
+
+ /* XXX -- see warning in termp_in_post(). */
+
+ for (nn = n->child; nn; nn = nn->next)
+ print_mdoc_node(m, nn, h);
+
+ h->flags |= HTML_NOSPACE;
+ print_text(h, ">");
+
+ return(0);
+}
+
+
+/* ARGSUSED */
+static int
+mdoc_ic_pre(MDOC_ARGS)
+{
+ struct htmlpair tag;
+
+ tag.key = ATTR_CLASS;
+ tag.val = "cmd";
+
+ print_otag(h, TAG_SPAN, 1, &tag);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
+mdoc_rv_pre(MDOC_ARGS)
+{
+ const struct mdoc_node *nn;
+ struct htmlpair tag;
+ struct tag *t;
+
+ print_otag(h, TAG_DIV, 0, NULL);
+
+ print_text(h, "The");
+
+ for (nn = n->child; nn; nn = nn->next) {
+ tag.key = ATTR_CLASS;
+ tag.val = "fname";
+ t = print_otag(h, TAG_SPAN, 1, &tag);
+ print_text(h, nn->string);
+ print_tagq(h, t);
+
+ h->flags |= HTML_NOSPACE;
+ if (nn->next && NULL == nn->next->next)
+ print_text(h, "(), and");
+ else if (nn->next)
+ print_text(h, "(),");
+ else
+ print_text(h, "()");
+ }
+
+ if (n->child->next)
+ print_text(h, "functions return");
+ else
+ print_text(h, "function returns");
+
+ print_text(h, "the value 0 if successful; otherwise the value "
+ "-1 is returned and the global variable");
+
+ tag.key = ATTR_CLASS;
+ tag.val = "var";
+ t = print_otag(h, TAG_SPAN, 1, &tag);
+ print_text(h, "errno");
+ print_tagq(h, t);
+ print_text(h, "is set to indicate the error.");
+ return(0);
+}
+
+
+/* ARGSUSED */
+static int
+mdoc_va_pre(MDOC_ARGS)
+{
+ struct htmlpair tag;
+
+ tag.key = ATTR_CLASS;
+ tag.val = "var";
+ print_otag(h, TAG_SPAN, 1, &tag);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
+mdoc_bq_pre(MDOC_ARGS)
+{
+
+ if (MDOC_BODY != n->type)
+ return(1);
+ print_text(h, "\\(lB");
+ h->flags |= HTML_NOSPACE;
+ return(1);
+}
+
+
+/* ARGSUSED */
+static void
+mdoc_bq_post(MDOC_ARGS)
+{
+
+ if (MDOC_BODY != n->type)
+ return;
+ h->flags |= HTML_NOSPACE;
+ print_text(h, "\\(rB");
+}
+
+
+/* ARGSUSED */
+static int
+mdoc_ap_pre(MDOC_ARGS)
+{
+
+ h->flags |= HTML_NOSPACE;
+ print_text(h, "\\(aq");
+ h->flags |= HTML_NOSPACE;
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
+mdoc_bf_pre(MDOC_ARGS)
+{
+ int i;
+ struct htmlpair tag[2];
+
+ if (MDOC_HEAD == n->type)
+ return(0);
+ else if (MDOC_BLOCK != n->type)
+ return(1);
+
+ tag[0].key = ATTR_CLASS;
+ tag[0].val = NULL;
+
+ if (n->head->child) {
+ if ( ! strcmp("Em", n->head->child->string))
+ tag[0].val = "emph";
+ else if ( ! strcmp("Sy", n->head->child->string))
+ tag[0].val = "symb";
+ else if ( ! strcmp("Li", n->head->child->string))
+ tag[0].val = "lit";
+ } else {
+ assert(n->args);
+ for (i = 0; i < (int)n->args->argc; i++)
+ switch (n->args->argv[i].arg) {
+ case (MDOC_Symbolic):
+ tag[0].val = "symb";
+ break;
+ case (MDOC_Literal):
+ tag[0].val = "lit";
+ break;
+ case (MDOC_Emphasis):
+ tag[0].val = "emph";
+ break;
+ default:
+ break;
+ }
+ }
+
+ /* FIXME: div's have spaces stripped--we want them. */
+
+ assert(tag[0].val);
+ tag[1].key = ATTR_STYLE;
+ tag[1].val = "display: inline; margin-right: 1em;";
+ print_otag(h, TAG_DIV, 2, tag);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
+mdoc_ms_pre(MDOC_ARGS)
+{
+ struct htmlpair tag;
+
+ tag.key = ATTR_CLASS;
+ tag.val = "symb";
+ print_otag(h, TAG_SPAN, 1, &tag);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
+mdoc_pf_pre(MDOC_ARGS)
+{
+
+ h->flags |= HTML_IGNDELIM;
+ return(1);
+}
+
+
+/* ARGSUSED */
+static void
+mdoc_pf_post(MDOC_ARGS)
+{
+
+ h->flags &= ~HTML_IGNDELIM;
+ h->flags |= HTML_NOSPACE;
+}
+
+
+/* ARGSUSED */
+static int
+mdoc_rs_pre(MDOC_ARGS)
+{
+ struct htmlpair tag;
+
+ if (MDOC_BLOCK != n->type)
+ return(1);
+
+ if (n->prev && SEC_SEE_ALSO == n->sec) {
+ tag.key = ATTR_STYLE;
+ tag.val = "margin-top: 1em;";
+ print_otag(h, TAG_DIV, 1, &tag);
+ }
+
+ tag.key = ATTR_CLASS;
+ tag.val = "ref";
+ print_otag(h, TAG_SPAN, 1, &tag);
+ return(1);
+}
+
+
+
+/* ARGSUSED */
+static int
+mdoc_li_pre(MDOC_ARGS)
+{
+ struct htmlpair tag;
+
+ tag.key = ATTR_CLASS;
+ tag.val = "lit";
+
+ print_otag(h, TAG_SPAN, 1, &tag);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
+mdoc_sy_pre(MDOC_ARGS)
+{
+ struct htmlpair tag;
+
+ tag.key = ATTR_CLASS;
+ tag.val = "symb";
+
+ print_otag(h, TAG_SPAN, 1, &tag);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
+mdoc_bt_pre(MDOC_ARGS)
+{
+
+ print_text(h, "is currently in beta test.");
+ return(0);
+}
+
+
+/* ARGSUSED */
+static int
+mdoc_ud_pre(MDOC_ARGS)
+{
+
+ print_text(h, "currently under development.");
+ return(0);
+}
+
+
+/* ARGSUSED */
+static int
+mdoc_lb_pre(MDOC_ARGS)
+{
+ struct htmlpair tag;
+
+ tag.key = ATTR_CLASS;
+ tag.val = "lib";
+
+ if (SEC_SYNOPSIS == n->sec)
+ print_otag(h, TAG_DIV, 0, NULL);
+
+ print_otag(h, TAG_SPAN, 1, &tag);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
+mdoc__x_pre(MDOC_ARGS)
+{
+ struct htmlpair tag;
+
+ tag.key = ATTR_CLASS;
+
+ switch (n->tok) {
+ case(MDOC__A):
+ tag.val = "ref-auth";
+ break;
+ case(MDOC__B):
+ tag.val = "ref-book";
+ break;
+ case(MDOC__C):
+ tag.val = "ref-city";
+ break;
+ case(MDOC__D):
+ tag.val = "ref-date";
+ break;
+ case(MDOC__I):
+ tag.val = "ref-issue";
+ break;
+ case(MDOC__J):
+ tag.val = "ref-jrnl";
+ break;
+ case(MDOC__N):
+ tag.val = "ref-num";
+ break;
+ case(MDOC__O):
+ tag.val = "ref-opt";
+ break;
+ case(MDOC__P):
+ tag.val = "ref-page";
+ break;
+ case(MDOC__Q):
+ tag.val = "ref-corp";
+ break;
+ case(MDOC__R):
+ tag.val = "ref-rep";
+ break;
+ case(MDOC__T):
+ print_text(h, "\\(lq");
+ h->flags |= HTML_NOSPACE;
+ tag.val = "ref-title";
+ break;
+ case(MDOC__V):
+ tag.val = "ref-vol";
+ break;
+ default:
+ abort();
+ /* NOTREACHED */
+ }
+
+ print_otag(h, TAG_SPAN, 1, &tag);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static void
+mdoc__x_post(MDOC_ARGS)
+{
+
+ h->flags |= HTML_NOSPACE;
+ switch (n->tok) {
+ case (MDOC__T):
+ print_text(h, "\\(rq");
+ h->flags |= HTML_NOSPACE;
+ break;
+ default:
+ break;
+ }
+ print_text(h, n->next ? "," : ".");
+}