+
+static int
+mdoc_quote_pre(MDOC_ARGS)
+{
+ struct htmlpair tag;
+
+ if (n->type != ROFFT_BODY)
+ return(1);
+
+ switch (n->tok) {
+ case MDOC_Ao:
+ /* FALLTHROUGH */
+ case MDOC_Aq:
+ print_text(h, n->nchild == 1 &&
+ n->child->tok == MDOC_Mt ? "<" : "\\(la");
+ break;
+ case MDOC_Bro:
+ /* FALLTHROUGH */
+ case MDOC_Brq:
+ print_text(h, "\\(lC");
+ break;
+ case MDOC_Bo:
+ /* FALLTHROUGH */
+ case MDOC_Bq:
+ print_text(h, "\\(lB");
+ break;
+ case MDOC_Oo:
+ /* FALLTHROUGH */
+ case MDOC_Op:
+ print_text(h, "\\(lB");
+ h->flags |= HTML_NOSPACE;
+ PAIR_CLASS_INIT(&tag, "opt");
+ print_otag(h, TAG_SPAN, 1, &tag);
+ break;
+ case MDOC_En:
+ if (NULL == n->norm->Es ||
+ NULL == n->norm->Es->child)
+ return(1);
+ print_text(h, n->norm->Es->child->string);
+ break;
+ case MDOC_Do:
+ /* FALLTHROUGH */
+ case MDOC_Dq:
+ /* FALLTHROUGH */
+ case MDOC_Qo:
+ /* FALLTHROUGH */
+ case MDOC_Qq:
+ print_text(h, "\\(lq");
+ break;
+ case MDOC_Po:
+ /* FALLTHROUGH */
+ case MDOC_Pq:
+ print_text(h, "(");
+ break;
+ case MDOC_Ql:
+ print_text(h, "\\(oq");
+ h->flags |= HTML_NOSPACE;
+ PAIR_CLASS_INIT(&tag, "lit");
+ print_otag(h, TAG_CODE, 1, &tag);
+ break;
+ case MDOC_So:
+ /* FALLTHROUGH */
+ case MDOC_Sq:
+ print_text(h, "\\(oq");
+ break;
+ default:
+ abort();
+ /* NOTREACHED */
+ }
+
+ h->flags |= HTML_NOSPACE;
+ return(1);
+}
+
+static void
+mdoc_quote_post(MDOC_ARGS)
+{
+
+ if (n->type != ROFFT_BODY && n->type != ROFFT_ELEM)
+ return;
+
+ h->flags |= HTML_NOSPACE;
+
+ switch (n->tok) {
+ case MDOC_Ao:
+ /* FALLTHROUGH */
+ case MDOC_Aq:
+ print_text(h, n->nchild == 1 &&
+ n->child->tok == MDOC_Mt ? ">" : "\\(ra");
+ break;
+ case MDOC_Bro:
+ /* FALLTHROUGH */
+ case MDOC_Brq:
+ print_text(h, "\\(rC");
+ break;
+ case MDOC_Oo:
+ /* FALLTHROUGH */
+ case MDOC_Op:
+ /* FALLTHROUGH */
+ case MDOC_Bo:
+ /* FALLTHROUGH */
+ case MDOC_Bq:
+ print_text(h, "\\(rB");
+ break;
+ case MDOC_En:
+ if (n->norm->Es == NULL ||
+ n->norm->Es->child == NULL ||
+ n->norm->Es->child->next == NULL)
+ h->flags &= ~HTML_NOSPACE;
+ else
+ print_text(h, n->norm->Es->child->next->string);
+ break;
+ case MDOC_Qo:
+ /* FALLTHROUGH */
+ case MDOC_Qq:
+ /* FALLTHROUGH */
+ case MDOC_Do:
+ /* FALLTHROUGH */
+ case MDOC_Dq:
+ print_text(h, "\\(rq");
+ break;
+ case MDOC_Po:
+ /* FALLTHROUGH */
+ case MDOC_Pq:
+ print_text(h, ")");
+ break;
+ case MDOC_Ql:
+ /* FALLTHROUGH */
+ case MDOC_So:
+ /* FALLTHROUGH */
+ case MDOC_Sq:
+ print_text(h, "\\(cq");
+ break;
+ default:
+ abort();
+ /* NOTREACHED */
+ }
+}
+
+static int
+mdoc_eo_pre(MDOC_ARGS)
+{
+
+ if (n->type != ROFFT_BODY)
+ return(1);
+
+ if (n->end == ENDBODY_NOT &&
+ n->parent->head->child == NULL &&
+ n->child != NULL &&
+ n->child->end != ENDBODY_NOT)
+ print_text(h, "\\&");
+ else if (n->end != ENDBODY_NOT ? n->child != NULL :
+ n->parent->head->child != NULL && (n->child != NULL ||
+ (n->parent->tail != NULL && n->parent->tail->child != NULL)))
+ h->flags |= HTML_NOSPACE;
+ return(1);
+}
+
+static void
+mdoc_eo_post(MDOC_ARGS)
+{
+ int body, tail;
+
+ if (n->type != ROFFT_BODY)
+ return;
+
+ if (n->end != ENDBODY_NOT) {
+ h->flags &= ~HTML_NOSPACE;
+ return;
+ }
+
+ body = n->child != NULL || n->parent->head->child != NULL;
+ tail = n->parent->tail != NULL && n->parent->tail->child != NULL;
+
+ if (body && tail)
+ h->flags |= HTML_NOSPACE;
+ else if ( ! tail)
+ h->flags &= ~HTML_NOSPACE;
+}