+
+
+/* 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];
+ struct roffsu su;
+
+ if (MDOC_HEAD == n->type)
+ return(0);
+ else if (MDOC_BLOCK != n->type)
+ return(1);
+
+ PAIR_CLASS_INIT(&tag[0], "lit");
+
+ if (n->head->child) {
+ if ( ! strcmp("Em", n->head->child->string))
+ PAIR_CLASS_INIT(&tag[0], "emph");
+ else if ( ! strcmp("Sy", n->head->child->string))
+ PAIR_CLASS_INIT(&tag[0], "symb");
+ else if ( ! strcmp("Li", n->head->child->string))
+ PAIR_CLASS_INIT(&tag[0], "lit");
+ } else {
+ assert(n->args);
+ for (i = 0; i < (int)n->args->argc; i++)
+ switch (n->args->argv[i].arg) {
+ case (MDOC_Symbolic):
+ PAIR_CLASS_INIT(&tag[0], "symb");
+ break;
+ case (MDOC_Literal):
+ PAIR_CLASS_INIT(&tag[0], "lit");
+ break;
+ case (MDOC_Emphasis):
+ PAIR_CLASS_INIT(&tag[0], "emph");
+ break;
+ default:
+ break;
+ }
+ }
+
+ /* FIXME: div's have spaces stripped--we want them. */
+
+ bufcat_style(h, "display", "inline");
+ SCALE_HS_INIT(&su, 1);
+ bufcat_su(h, "margin-right", &su);
+ PAIR_STYLE_INIT(&tag[1], h);
+ print_otag(h, TAG_DIV, 2, tag);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
+mdoc_ms_pre(MDOC_ARGS)
+{
+ struct htmlpair tag;
+
+ PAIR_CLASS_INIT(&tag, "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;
+ struct roffsu su;
+
+ if (MDOC_BLOCK != n->type)
+ return(1);
+
+ if (n->prev && SEC_SEE_ALSO == n->sec) {
+ SCALE_VS_INIT(&su, 1);
+ bufcat_su(h, "margin-top", &su);
+ PAIR_STYLE_INIT(&tag, h);
+ print_otag(h, TAG_DIV, 1, &tag);
+ }
+
+ PAIR_CLASS_INIT(&tag, "ref");
+ print_otag(h, TAG_SPAN, 1, &tag);
+ return(1);
+}
+
+
+
+/* ARGSUSED */
+static int
+mdoc_li_pre(MDOC_ARGS)
+{
+ struct htmlpair tag;
+
+ PAIR_CLASS_INIT(&tag, "lit");
+ print_otag(h, TAG_SPAN, 1, &tag);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
+mdoc_sy_pre(MDOC_ARGS)
+{
+ struct htmlpair tag;
+
+ PAIR_CLASS_INIT(&tag, "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;
+
+ if (SEC_SYNOPSIS == n->sec)
+ print_otag(h, TAG_DIV, 0, NULL);
+ PAIR_CLASS_INIT(&tag, "lib");
+ print_otag(h, TAG_SPAN, 1, &tag);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
+mdoc__x_pre(MDOC_ARGS)
+{
+ struct htmlpair tag[2];
+
+ switch (n->tok) {
+ case(MDOC__A):
+ PAIR_CLASS_INIT(&tag[0], "ref-auth");
+ break;
+ case(MDOC__B):
+ PAIR_CLASS_INIT(&tag[0], "ref-book");
+ break;
+ case(MDOC__C):
+ PAIR_CLASS_INIT(&tag[0], "ref-city");
+ break;
+ case(MDOC__D):
+ PAIR_CLASS_INIT(&tag[0], "ref-date");
+ break;
+ case(MDOC__I):
+ PAIR_CLASS_INIT(&tag[0], "ref-issue");
+ break;
+ case(MDOC__J):
+ PAIR_CLASS_INIT(&tag[0], "ref-jrnl");
+ break;
+ case(MDOC__N):
+ PAIR_CLASS_INIT(&tag[0], "ref-num");
+ break;
+ case(MDOC__O):
+ PAIR_CLASS_INIT(&tag[0], "ref-opt");
+ break;
+ case(MDOC__P):
+ PAIR_CLASS_INIT(&tag[0], "ref-page");
+ break;
+ case(MDOC__Q):
+ PAIR_CLASS_INIT(&tag[0], "ref-corp");
+ break;
+ case(MDOC__R):
+ PAIR_CLASS_INIT(&tag[0], "ref-rep");
+ break;
+ case(MDOC__T):
+ PAIR_CLASS_INIT(&tag[0], "ref-title");
+ print_text(h, "\\(lq");
+ h->flags |= HTML_NOSPACE;
+ break;
+ case(MDOC__U):
+ PAIR_CLASS_INIT(&tag[0], "link-ref");
+ break;
+ case(MDOC__V):
+ PAIR_CLASS_INIT(&tag[0], "ref-vol");
+ break;
+ default:
+ abort();
+ /* NOTREACHED */
+ }
+
+ if (MDOC__U != n->tok) {
+ print_otag(h, TAG_SPAN, 1, tag);
+ return(1);
+ }
+
+ PAIR_HREF_INIT(&tag[1], n->child->string);
+ print_otag(h, TAG_A, 2, 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 ? "," : ".");
+}