[BACK]Return to man_html.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Annotation of mandoc/man_html.c, Revision 1.170

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

CVSweb