[BACK]Return to man_html.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mandoc

Annotation of src/usr.bin/mandoc/man_html.c, Revision 1.120

1.120   ! schwarze    1: /*     $OpenBSD: man_html.c,v 1.119 2019/01/06 04:41:15 schwarze Exp $ */
1.1       schwarze    2: /*
1.56      schwarze    3:  * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
1.116     schwarze    4:  * Copyright (c) 2013-2015, 2017-2019 Ingo Schwarze <schwarze@openbsd.org>
1.1       schwarze    5:  *
                      6:  * Permission to use, copy, modify, and distribute this software for any
                      7:  * purpose with or without fee is hereby granted, provided that the above
                      8:  * copyright notice and this permission notice appear in all copies.
                      9:  *
1.66      schwarze   10:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
1.1       schwarze   11:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1.66      schwarze   12:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
1.1       schwarze   13:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     14:  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                     15:  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                     16:  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
                     17:  */
                     18: #include <sys/types.h>
                     19:
                     20: #include <assert.h>
                     21: #include <ctype.h>
                     22: #include <stdio.h>
                     23: #include <stdlib.h>
                     24: #include <string.h>
                     25:
1.53      schwarze   26: #include "mandoc_aux.h"
1.113     schwarze   27: #include "mandoc.h"
1.66      schwarze   28: #include "roff.h"
1.58      schwarze   29: #include "man.h"
1.1       schwarze   30: #include "out.h"
                     31: #include "html.h"
                     32: #include "main.h"
                     33:
1.68      schwarze   34: #define        MAN_ARGS          const struct roff_meta *man, \
1.67      schwarze   35:                          const struct roff_node *n, \
1.1       schwarze   36:                          struct html *h
                     37:
1.108     schwarze   38: struct man_html_act {
1.1       schwarze   39:        int             (*pre)(MAN_ARGS);
                     40:        int             (*post)(MAN_ARGS);
                     41: };
                     42:
1.100     schwarze   43: static void              print_man_head(const struct roff_meta *,
                     44:                                struct html *);
1.1       schwarze   45: static void              print_man_nodelist(MAN_ARGS);
                     46: static void              print_man_node(MAN_ARGS);
                     47: static int               man_B_pre(MAN_ARGS);
1.46      schwarze   48: static int               man_IP_pre(MAN_ARGS);
1.1       schwarze   49: static int               man_I_pre(MAN_ARGS);
1.46      schwarze   50: static int               man_OP_pre(MAN_ARGS);
1.1       schwarze   51: static int               man_PP_pre(MAN_ARGS);
                     52: static int               man_RS_pre(MAN_ARGS);
                     53: static int               man_SH_pre(MAN_ARGS);
                     54: static int               man_SM_pre(MAN_ARGS);
1.109     schwarze   55: static int               man_SY_pre(MAN_ARGS);
1.49      schwarze   56: static int               man_UR_pre(MAN_ARGS);
1.111     schwarze   57: static int               man_abort_pre(MAN_ARGS);
1.46      schwarze   58: static int               man_alt_pre(MAN_ARGS);
                     59: static int               man_ign_pre(MAN_ARGS);
                     60: static int               man_in_pre(MAN_ARGS);
1.100     schwarze   61: static void              man_root_post(const struct roff_meta *,
                     62:                                struct html *);
                     63: static void              man_root_pre(const struct roff_meta *,
                     64:                                struct html *);
1.1       schwarze   65:
1.108     schwarze   66: static const struct man_html_act man_html_acts[MAN_MAX - MAN_TH] = {
1.1       schwarze   67:        { NULL, NULL }, /* TH */
                     68:        { man_SH_pre, NULL }, /* SH */
1.119     schwarze   69:        { man_SH_pre, NULL }, /* SS */
1.1       schwarze   70:        { man_IP_pre, NULL }, /* TP */
1.107     schwarze   71:        { man_IP_pre, NULL }, /* TQ */
1.111     schwarze   72:        { man_abort_pre, NULL }, /* LP */
1.1       schwarze   73:        { man_PP_pre, NULL }, /* PP */
1.111     schwarze   74:        { man_abort_pre, NULL }, /* P */
1.1       schwarze   75:        { man_IP_pre, NULL }, /* IP */
1.119     schwarze   76:        { man_PP_pre, NULL }, /* HP */
1.1       schwarze   77:        { man_SM_pre, NULL }, /* SM */
1.26      schwarze   78:        { man_SM_pre, NULL }, /* SB */
1.1       schwarze   79:        { man_alt_pre, NULL }, /* BI */
                     80:        { man_alt_pre, NULL }, /* IB */
                     81:        { man_alt_pre, NULL }, /* BR */
                     82:        { man_alt_pre, NULL }, /* RB */
                     83:        { NULL, NULL }, /* R */
                     84:        { man_B_pre, NULL }, /* B */
                     85:        { man_I_pre, NULL }, /* I */
                     86:        { man_alt_pre, NULL }, /* IR */
                     87:        { man_alt_pre, NULL }, /* RI */
                     88:        { NULL, NULL }, /* RE */
                     89:        { man_RS_pre, NULL }, /* RS */
                     90:        { man_ign_pre, NULL }, /* DT */
                     91:        { man_ign_pre, NULL }, /* UC */
1.2       schwarze   92:        { man_ign_pre, NULL }, /* PD */
1.13      schwarze   93:        { man_ign_pre, NULL }, /* AT */
1.18      schwarze   94:        { man_in_pre, NULL }, /* in */
1.109     schwarze   95:        { man_SY_pre, NULL }, /* SY */
                     96:        { NULL, NULL }, /* YS */
1.46      schwarze   97:        { man_OP_pre, NULL }, /* OP */
1.85      schwarze   98:        { NULL, NULL }, /* EX */
                     99:        { NULL, NULL }, /* EE */
1.49      schwarze  100:        { man_UR_pre, NULL }, /* UR */
                    101:        { NULL, NULL }, /* UE */
1.98      bentley   102:        { man_UR_pre, NULL }, /* MT */
                    103:        { NULL, NULL }, /* ME */
1.1       schwarze  104: };
                    105:
1.52      schwarze  106:
1.1       schwarze  107: void
1.114     schwarze  108: html_man(void *arg, const struct roff_meta *man)
1.1       schwarze  109: {
1.100     schwarze  110:        struct html             *h;
                    111:        struct roff_node        *n;
                    112:        struct tag              *t;
1.43      schwarze  113:
1.70      schwarze  114:        h = (struct html *)arg;
1.100     schwarze  115:        n = man->first->child;
1.1       schwarze  116:
1.79      schwarze  117:        if ((h->oflags & HTML_FRAGMENT) == 0) {
1.43      schwarze  118:                print_gen_decls(h);
1.79      schwarze  119:                print_otag(h, TAG_HTML, "");
1.100     schwarze  120:                if (n->type == ROFFT_COMMENT)
                    121:                        print_gen_comment(h, n);
1.79      schwarze  122:                t = print_otag(h, TAG_HEAD, "");
1.114     schwarze  123:                print_man_head(man, h);
1.79      schwarze  124:                print_tagq(h, t);
1.75      schwarze  125:                print_otag(h, TAG_BODY, "");
1.79      schwarze  126:        }
1.25      schwarze  127:
1.114     schwarze  128:        man_root_pre(man, h);
1.80      schwarze  129:        t = print_otag(h, TAG_DIV, "c", "manual-text");
1.114     schwarze  130:        print_man_nodelist(man, n, h);
1.80      schwarze  131:        print_tagq(h, t);
1.114     schwarze  132:        man_root_post(man, h);
1.79      schwarze  133:        print_tagq(h, NULL);
1.1       schwarze  134: }
                    135:
                    136: static void
1.100     schwarze  137: print_man_head(const struct roff_meta *man, struct html *h)
1.1       schwarze  138: {
1.76      schwarze  139:        char    *cp;
1.1       schwarze  140:
                    141:        print_gen_head(h);
1.76      schwarze  142:        mandoc_asprintf(&cp, "%s(%s)", man->title, man->msec);
1.75      schwarze  143:        print_otag(h, TAG_TITLE, "");
1.76      schwarze  144:        print_text(h, cp);
                    145:        free(cp);
1.1       schwarze  146: }
                    147:
                    148: static void
                    149: print_man_nodelist(MAN_ARGS)
                    150: {
1.63      schwarze  151:        while (n != NULL) {
1.85      schwarze  152:                print_man_node(man, n, h);
1.63      schwarze  153:                n = n->next;
                    154:        }
1.1       schwarze  155: }
                    156:
                    157: static void
                    158: print_man_node(MAN_ARGS)
                    159: {
1.85      schwarze  160:        struct tag      *t;
1.1       schwarze  161:        int              child;
                    162:
1.120   ! schwarze  163:        if (n->type == ROFFT_COMMENT || n->flags & NODE_NOPRT)
        !           164:                return;
        !           165:
1.116     schwarze  166:        html_fillmode(h, n->flags & NODE_NOFILL ? ROFF_nf : ROFF_fi);
1.85      schwarze  167:
                    168:        child = 1;
1.120   ! schwarze  169:        t = h->tag;
        !           170:        if (t->tag == TAG_P || t->tag == TAG_PRE)
        !           171:                t = t->next;
        !           172:
1.85      schwarze  173:        switch (n->type) {
                    174:        case ROFFT_TEXT:
1.116     schwarze  175:                if (*n->string == '\0') {
                    176:                        print_endline(h);
                    177:                        return;
                    178:                }
                    179:                if (*n->string == ' ' && n->flags & NODE_LINE &&
                    180:                    (h->flags & HTML_NONEWLINE) == 0)
                    181:                        print_endline(h);
                    182:                else if (n->flags & NODE_DELIMC)
                    183:                        h->flags |= HTML_NOSPACE;
1.1       schwarze  184:                print_text(h, n->string);
1.83      schwarze  185:                break;
1.66      schwarze  186:        case ROFFT_EQN:
1.41      schwarze  187:                print_eqn(h, n->eqn);
1.37      schwarze  188:                break;
1.66      schwarze  189:        case ROFFT_TBL:
1.33      schwarze  190:                /*
                    191:                 * This will take care of initialising all of the table
                    192:                 * state data for the first table, then tearing it down
                    193:                 * for the last one.
                    194:                 */
1.29      schwarze  195:                print_tbl(h, n->span);
1.32      schwarze  196:                return;
1.1       schwarze  197:        default:
1.52      schwarze  198:                /*
1.4       schwarze  199:                 * Close out scope of font prior to opening a macro
1.33      schwarze  200:                 * scope.
1.4       schwarze  201:                 */
1.27      schwarze  202:                if (HTMLFONT_NONE != h->metac) {
                    203:                        h->metal = h->metac;
                    204:                        h->metac = HTMLFONT_NONE;
1.33      schwarze  205:                }
                    206:
                    207:                /*
                    208:                 * Close out the current table, if it's open, and unset
                    209:                 * the "meta" table state.  This will be reopened on the
                    210:                 * next table element.
                    211:                 */
1.120   ! schwarze  212:                if (h->tblt != NULL) {
1.33      schwarze  213:                        print_tblclose(h);
1.120   ! schwarze  214:                        t = h->tag;
        !           215:                }
1.90      schwarze  216:                if (n->tok < ROFF_MAX) {
1.91      schwarze  217:                        roff_html_pre(h, n);
1.120   ! schwarze  218:                        print_stagq(h, t);
1.116     schwarze  219:                        return;
1.90      schwarze  220:                }
                    221:                assert(n->tok >= MAN_TH && n->tok < MAN_MAX);
1.108     schwarze  222:                if (man_html_acts[n->tok - MAN_TH].pre != NULL)
                    223:                        child = (*man_html_acts[n->tok - MAN_TH].pre)(man,
                    224:                            n, h);
1.1       schwarze  225:                break;
                    226:        }
                    227:
1.117     schwarze  228:        if (child && n->child != NULL)
1.85      schwarze  229:                print_man_nodelist(man, n->child, h);
1.1       schwarze  230:
1.4       schwarze  231:        /* This will automatically close out any font scope. */
1.85      schwarze  232:        print_stagq(h, t);
                    233:
1.118     schwarze  234:        if (n->flags & NODE_NOFILL && n->tok != MAN_YS &&
                    235:            (n->next != NULL && n->next->flags & NODE_LINE)) {
1.110     schwarze  236:                /* In .nf = <pre>, print even empty lines. */
                    237:                h->col++;
1.85      schwarze  238:                print_endline(h);
1.110     schwarze  239:        }
1.1       schwarze  240: }
                    241:
1.38      schwarze  242: static void
1.100     schwarze  243: man_root_pre(const struct roff_meta *man, struct html *h)
1.1       schwarze  244: {
                    245:        struct tag      *t, *tt;
1.53      schwarze  246:        char            *title;
1.1       schwarze  247:
1.48      schwarze  248:        assert(man->title);
                    249:        assert(man->msec);
1.53      schwarze  250:        mandoc_asprintf(&title, "%s(%s)", man->title, man->msec);
1.1       schwarze  251:
1.75      schwarze  252:        t = print_otag(h, TAG_TABLE, "c", "head");
                    253:        tt = print_otag(h, TAG_TR, "");
1.1       schwarze  254:
1.75      schwarze  255:        print_otag(h, TAG_TD, "c", "head-ltitle");
1.1       schwarze  256:        print_text(h, title);
                    257:        print_stagq(h, tt);
                    258:
1.75      schwarze  259:        print_otag(h, TAG_TD, "c", "head-vol");
1.117     schwarze  260:        if (man->vol != NULL)
1.54      schwarze  261:                print_text(h, man->vol);
1.1       schwarze  262:        print_stagq(h, tt);
                    263:
1.75      schwarze  264:        print_otag(h, TAG_TD, "c", "head-rtitle");
1.1       schwarze  265:        print_text(h, title);
                    266:        print_tagq(h, t);
1.53      schwarze  267:        free(title);
1.1       schwarze  268: }
                    269:
                    270: static void
1.100     schwarze  271: man_root_post(const struct roff_meta *man, struct html *h)
1.1       schwarze  272: {
                    273:        struct tag      *t, *tt;
                    274:
1.75      schwarze  275:        t = print_otag(h, TAG_TABLE, "c", "foot");
                    276:        tt = print_otag(h, TAG_TR, "");
1.25      schwarze  277:
1.75      schwarze  278:        print_otag(h, TAG_TD, "c", "foot-date");
1.48      schwarze  279:        print_text(h, man->date);
1.1       schwarze  280:        print_stagq(h, tt);
                    281:
1.75      schwarze  282:        print_otag(h, TAG_TD, "c", "foot-os");
1.117     schwarze  283:        if (man->os != NULL)
1.68      schwarze  284:                print_text(h, man->os);
1.1       schwarze  285:        print_tagq(h, t);
                    286: }
                    287:
                    288: static int
                    289: man_SH_pre(MAN_ARGS)
                    290: {
1.87      schwarze  291:        char    *id;
                    292:
1.119     schwarze  293:        switch (n->type) {
                    294:        case ROFFT_BLOCK:
                    295:                html_close_paragraph(h);
                    296:                break;
                    297:        case ROFFT_HEAD:
1.103     schwarze  298:                id = html_make_id(n, 1);
1.119     schwarze  299:                if (n->tok == MAN_SH)
                    300:                        print_otag(h, TAG_H1, "cTi", "Sh", id);
                    301:                else
                    302:                        print_otag(h, TAG_H2, "cTi", "Ss", id);
1.88      schwarze  303:                if (id != NULL)
1.101     schwarze  304:                        print_otag(h, TAG_A, "chR", "permalink", id);
1.119     schwarze  305:                break;
                    306:        case ROFFT_BODY:
                    307:                break;
                    308:        default:
                    309:                abort();
1.87      schwarze  310:        }
1.72      schwarze  311:        return 1;
1.1       schwarze  312: }
                    313:
                    314: static int
                    315: man_alt_pre(MAN_ARGS)
                    316: {
1.67      schwarze  317:        const struct roff_node  *nn;
1.117     schwarze  318:        struct tag      *t;
1.83      schwarze  319:        int              i;
1.27      schwarze  320:        enum htmltag     fp;
1.1       schwarze  321:
1.117     schwarze  322:        for (i = 0, nn = n->child; nn != NULL; nn = nn->next, i++) {
1.1       schwarze  323:                switch (n->tok) {
1.52      schwarze  324:                case MAN_BI:
1.27      schwarze  325:                        fp = i % 2 ? TAG_I : TAG_B;
1.1       schwarze  326:                        break;
1.52      schwarze  327:                case MAN_IB:
1.27      schwarze  328:                        fp = i % 2 ? TAG_B : TAG_I;
1.1       schwarze  329:                        break;
1.52      schwarze  330:                case MAN_RI:
1.27      schwarze  331:                        fp = i % 2 ? TAG_I : TAG_MAX;
1.1       schwarze  332:                        break;
1.52      schwarze  333:                case MAN_IR:
1.27      schwarze  334:                        fp = i % 2 ? TAG_MAX : TAG_I;
1.1       schwarze  335:                        break;
1.52      schwarze  336:                case MAN_BR:
1.27      schwarze  337:                        fp = i % 2 ? TAG_MAX : TAG_B;
1.1       schwarze  338:                        break;
1.52      schwarze  339:                case MAN_RB:
1.27      schwarze  340:                        fp = i % 2 ? TAG_B : TAG_MAX;
1.1       schwarze  341:                        break;
                    342:                default:
                    343:                        abort();
                    344:                }
                    345:
                    346:                if (i)
                    347:                        h->flags |= HTML_NOSPACE;
                    348:
1.83      schwarze  349:                if (fp != TAG_MAX)
1.75      schwarze  350:                        t = print_otag(h, fp, "");
1.27      schwarze  351:
1.83      schwarze  352:                print_text(h, nn->string);
1.27      schwarze  353:
1.83      schwarze  354:                if (fp != TAG_MAX)
1.27      schwarze  355:                        print_tagq(h, t);
1.1       schwarze  356:        }
1.72      schwarze  357:        return 0;
1.1       schwarze  358: }
                    359:
                    360: static int
1.26      schwarze  361: man_SM_pre(MAN_ARGS)
1.1       schwarze  362: {
1.75      schwarze  363:        print_otag(h, TAG_SMALL, "");
1.117     schwarze  364:        if (n->tok == MAN_SB)
1.75      schwarze  365:                print_otag(h, TAG_B, "");
1.72      schwarze  366:        return 1;
1.1       schwarze  367: }
                    368:
                    369: static int
                    370: man_PP_pre(MAN_ARGS)
                    371: {
1.119     schwarze  372:        switch (n->type) {
                    373:        case ROFFT_BLOCK:
                    374:                html_close_paragraph(h);
                    375:                break;
                    376:        case ROFFT_HEAD:
1.72      schwarze  377:                return 0;
1.119     schwarze  378:        case ROFFT_BODY:
                    379:                if (n->child != NULL &&
                    380:                    (n->child->flags & NODE_NOFILL) == 0)
                    381:                        print_otag(h, TAG_P, "c",
                    382:                            n->tok == MAN_PP ? "Pp" : "Pp HP");
                    383:                break;
                    384:        default:
                    385:                abort();
                    386:        }
1.72      schwarze  387:        return 1;
1.1       schwarze  388: }
                    389:
                    390: static int
                    391: man_IP_pre(MAN_ARGS)
                    392: {
1.67      schwarze  393:        const struct roff_node  *nn;
1.1       schwarze  394:
1.119     schwarze  395:        switch (n->type) {
                    396:        case ROFFT_BLOCK:
                    397:                html_close_paragraph(h);
                    398:                print_otag(h, TAG_DL, "c", "Bl-tag");
                    399:                return 1;
                    400:        case ROFFT_HEAD:
                    401:                print_otag(h, TAG_DT, "");
                    402:                break;
                    403:        case ROFFT_BODY:
1.102     schwarze  404:                print_otag(h, TAG_DD, "");
1.72      schwarze  405:                return 1;
1.119     schwarze  406:        default:
                    407:                abort();
1.1       schwarze  408:        }
                    409:
1.107     schwarze  410:        switch(n->tok) {
                    411:        case MAN_IP:  /* Only print the first header element. */
                    412:                if (n->child != NULL)
                    413:                        print_man_node(man, n->child, h);
                    414:                break;
                    415:        case MAN_TP:  /* Only print next-line header elements. */
                    416:        case MAN_TQ:
1.50      schwarze  417:                nn = n->child;
1.107     schwarze  418:                while (nn != NULL && (NODE_LINE & nn->flags) == 0)
1.50      schwarze  419:                        nn = nn->next;
1.107     schwarze  420:                while (nn != NULL) {
1.85      schwarze  421:                        print_man_node(man, nn, h);
1.50      schwarze  422:                        nn = nn->next;
                    423:                }
1.107     schwarze  424:                break;
                    425:        default:
                    426:                abort();
1.50      schwarze  427:        }
1.72      schwarze  428:        return 0;
1.1       schwarze  429: }
                    430:
                    431: static int
1.46      schwarze  432: man_OP_pre(MAN_ARGS)
                    433: {
                    434:        struct tag      *tt;
                    435:
                    436:        print_text(h, "[");
                    437:        h->flags |= HTML_NOSPACE;
1.81      schwarze  438:        tt = print_otag(h, TAG_SPAN, "c", "Op");
1.46      schwarze  439:
1.117     schwarze  440:        if ((n = n->child) != NULL) {
1.75      schwarze  441:                print_otag(h, TAG_B, "");
1.46      schwarze  442:                print_text(h, n->string);
                    443:        }
                    444:
                    445:        print_stagq(h, tt);
                    446:
1.117     schwarze  447:        if (n != NULL && n->next != NULL) {
1.75      schwarze  448:                print_otag(h, TAG_I, "");
1.46      schwarze  449:                print_text(h, n->next->string);
                    450:        }
                    451:
                    452:        print_stagq(h, tt);
                    453:        h->flags |= HTML_NOSPACE;
                    454:        print_text(h, "]");
1.72      schwarze  455:        return 0;
1.46      schwarze  456: }
                    457:
1.1       schwarze  458: static int
                    459: man_B_pre(MAN_ARGS)
                    460: {
1.75      schwarze  461:        print_otag(h, TAG_B, "");
1.72      schwarze  462:        return 1;
1.1       schwarze  463: }
                    464:
                    465: static int
                    466: man_I_pre(MAN_ARGS)
                    467: {
1.75      schwarze  468:        print_otag(h, TAG_I, "");
1.72      schwarze  469:        return 1;
1.18      schwarze  470: }
                    471:
                    472: static int
                    473: man_in_pre(MAN_ARGS)
                    474: {
1.75      schwarze  475:        print_otag(h, TAG_BR, "");
1.72      schwarze  476:        return 0;
1.1       schwarze  477: }
                    478:
                    479: static int
                    480: man_ign_pre(MAN_ARGS)
                    481: {
1.72      schwarze  482:        return 0;
1.1       schwarze  483: }
                    484:
                    485: static int
                    486: man_RS_pre(MAN_ARGS)
                    487: {
1.119     schwarze  488:        switch (n->type) {
                    489:        case ROFFT_BLOCK:
                    490:                html_close_paragraph(h);
                    491:                break;
                    492:        case ROFFT_HEAD:
1.72      schwarze  493:                return 0;
1.119     schwarze  494:        case ROFFT_BODY:
1.105     schwarze  495:                print_otag(h, TAG_DIV, "c", "Bd-indent");
1.119     schwarze  496:                break;
                    497:        default:
                    498:                abort();
                    499:        }
1.109     schwarze  500:        return 1;
                    501: }
                    502:
                    503: static int
                    504: man_SY_pre(MAN_ARGS)
                    505: {
                    506:        switch (n->type) {
                    507:        case ROFFT_BLOCK:
1.119     schwarze  508:                html_close_paragraph(h);
1.109     schwarze  509:                print_otag(h, TAG_TABLE, "c", "Nm");
                    510:                print_otag(h, TAG_TR, "");
                    511:                break;
                    512:        case ROFFT_HEAD:
                    513:                print_otag(h, TAG_TD, "");
                    514:                print_otag(h, TAG_CODE, "cT", "Nm");
                    515:                break;
                    516:        case ROFFT_BODY:
                    517:                print_otag(h, TAG_TD, "");
                    518:                break;
                    519:        default:
                    520:                abort();
                    521:        }
1.72      schwarze  522:        return 1;
1.49      schwarze  523: }
                    524:
                    525: static int
                    526: man_UR_pre(MAN_ARGS)
                    527: {
1.98      bentley   528:        char *cp;
1.117     schwarze  529:
1.49      schwarze  530:        n = n->child;
1.66      schwarze  531:        assert(n->type == ROFFT_HEAD);
1.73      schwarze  532:        if (n->child != NULL) {
1.66      schwarze  533:                assert(n->child->type == ROFFT_TEXT);
1.98      bentley   534:                if (n->tok == MAN_MT) {
                    535:                        mandoc_asprintf(&cp, "mailto:%s", n->child->string);
                    536:                        print_otag(h, TAG_A, "cTh", "Mt", cp);
                    537:                        free(cp);
                    538:                } else
                    539:                        print_otag(h, TAG_A, "cTh", "Lk", n->child->string);
1.49      schwarze  540:        }
                    541:
1.66      schwarze  542:        assert(n->next->type == ROFFT_BODY);
1.73      schwarze  543:        if (n->next->child != NULL)
1.49      schwarze  544:                n = n->next;
                    545:
1.85      schwarze  546:        print_man_nodelist(man, n->child, h);
1.72      schwarze  547:        return 0;
1.111     schwarze  548: }
                    549:
                    550: static int
                    551: man_abort_pre(MAN_ARGS)
                    552: {
                    553:        abort();
1.1       schwarze  554: }