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

Annotation of mandoc/html.h, Revision 1.74

1.74    ! schwarze    1: /*     $Id: html.h,v 1.73 2016/07/19 13:36:13 schwarze Exp $ */
1.1       kristaps    2: /*
1.66      schwarze    3:  * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
1.74    ! schwarze    4:  * Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
1.1       kristaps    5:  *
                      6:  * Permission to use, copy, modify, and distribute this software for any
1.6       kristaps    7:  * purpose with or without fee is hereby granted, provided that the above
                      8:  * copyright notice and this permission notice appear in all copies.
1.1       kristaps    9:  *
1.6       kristaps   10:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     11:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     12:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     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.
1.1       kristaps   17:  */
                     18:
1.6       kristaps   19: enum   htmltag {
                     20:        TAG_HTML,
                     21:        TAG_HEAD,
                     22:        TAG_BODY,
                     23:        TAG_META,
                     24:        TAG_TITLE,
                     25:        TAG_DIV,
                     26:        TAG_H1,
                     27:        TAG_H2,
                     28:        TAG_SPAN,
                     29:        TAG_LINK,
                     30:        TAG_BR,
                     31:        TAG_A,
                     32:        TAG_TABLE,
1.28      kristaps   33:        TAG_TBODY,
1.6       kristaps   34:        TAG_COL,
                     35:        TAG_TR,
                     36:        TAG_TD,
                     37:        TAG_LI,
                     38:        TAG_UL,
                     39:        TAG_OL,
1.28      kristaps   40:        TAG_DL,
                     41:        TAG_DT,
                     42:        TAG_DD,
1.29      kristaps   43:        TAG_BLOCKQUOTE,
1.31      kristaps   44:        TAG_PRE,
1.32      kristaps   45:        TAG_B,
1.33      kristaps   46:        TAG_I,
1.34      kristaps   47:        TAG_CODE,
1.35      kristaps   48:        TAG_SMALL,
1.56      kristaps   49:        TAG_STYLE,
1.63      kristaps   50:        TAG_MATH,
                     51:        TAG_MROW,
                     52:        TAG_MI,
                     53:        TAG_MO,
                     54:        TAG_MSUP,
                     55:        TAG_MSUB,
                     56:        TAG_MSUBSUP,
                     57:        TAG_MFRAC,
                     58:        TAG_MSQRT,
                     59:        TAG_MFENCED,
                     60:        TAG_MTABLE,
                     61:        TAG_MTR,
                     62:        TAG_MTD,
1.64      kristaps   63:        TAG_MUNDEROVER,
                     64:        TAG_MUNDER,
                     65:        TAG_MOVER,
1.6       kristaps   66:        TAG_MAX
                     67: };
                     68:
1.21      kristaps   69: enum   htmlfont {
                     70:        HTMLFONT_NONE = 0,
                     71:        HTMLFONT_BOLD,
                     72:        HTMLFONT_ITALIC,
1.49      schwarze   73:        HTMLFONT_BI,
1.21      kristaps   74:        HTMLFONT_MAX
                     75: };
                     76:
1.6       kristaps   77: struct tag {
1.14      kristaps   78:        struct tag       *next;
1.6       kristaps   79:        enum htmltag      tag;
                     80: };
                     81:
1.14      kristaps   82: struct tagq {
                     83:        struct tag       *head;
                     84: };
1.6       kristaps   85:
                     86: struct html {
                     87:        int               flags;
1.40      kristaps   88: #define        HTML_NOSPACE     (1 << 0) /* suppress next space */
1.25      kristaps   89: #define        HTML_IGNDELIM    (1 << 1)
                     90: #define        HTML_KEEP        (1 << 2)
                     91: #define        HTML_PREKEEP     (1 << 3)
1.40      kristaps   92: #define        HTML_NONOSPACE   (1 << 4) /* never add spaces */
                     93: #define        HTML_LITERAL     (1 << 5) /* literal (e.g., <PRE>) context */
1.48      schwarze   94: #define        HTML_SKIPCHAR    (1 << 6) /* skip the next character */
1.54      schwarze   95: #define        HTML_NOSPLIT     (1 << 7) /* do not break line before .An */
                     96: #define        HTML_SPLIT       (1 << 8) /* break line before .An */
1.70      schwarze   97: #define        HTML_NONEWLINE   (1 << 9) /* No line break in nofill mode. */
1.38      kristaps   98:        struct tagq       tags; /* stack of open tags */
                     99:        struct rofftbl    tbl; /* current table */
1.39      kristaps  100:        struct tag       *tblt; /* current open table scope */
1.38      kristaps  101:        char             *base_man; /* base for manpage href */
                    102:        char             *base_includes; /* base for include href */
                    103:        char             *style; /* style-sheet URI */
                    104:        char              buf[BUFSIZ]; /* see bufcat and friends */
1.51      schwarze  105:        size_t            buflen;
1.35      kristaps  106:        struct tag       *metaf; /* current open font scope */
                    107:        enum htmlfont     metal; /* last used font */
                    108:        enum htmlfont     metac; /* current font mode */
1.47      kristaps  109:        int               oflags; /* output options */
                    110: #define        HTML_FRAGMENT    (1 << 0) /* don't emit HTML/HEAD/BODY */
1.6       kristaps  111: };
1.69      schwarze  112:
                    113:
                    114: struct tbl_span;
                    115: struct eqn;
1.12      kristaps  116:
1.22      kristaps  117: void             print_gen_decls(struct html *);
1.6       kristaps  118: void             print_gen_head(struct html *);
1.74    ! schwarze  119: struct tag      *print_otag(struct html *, enum htmltag, const char *, ...);
1.6       kristaps  120: void             print_tagq(struct html *, const struct tag *);
                    121: void             print_stagq(struct html *, const struct tag *);
                    122: void             print_text(struct html *, const char *);
1.39      kristaps  123: void             print_tblclose(struct html *);
1.37      kristaps  124: void             print_tbl(struct html *, const struct tbl_span *);
1.45      kristaps  125: void             print_eqn(struct html *, const struct eqn *);
1.61      kristaps  126: void             print_paragraph(struct html *);
1.1       kristaps  127:
1.73      schwarze  128: void             bufcat_fmt(struct html *, const char *, ...)
                    129:                        __attribute__((__format__ (printf, 2, 3)));
1.44      kristaps  130: void             bufcat(struct html *, const char *);
                    131: void             bufcat_id(struct html *, const char *);
1.51      schwarze  132: void             bufcat_style(struct html *,
1.44      kristaps  133:                        const char *, const char *);
1.51      schwarze  134: void             bufcat_su(struct html *, const char *,
1.12      kristaps  135:                        const struct roffsu *);
1.44      kristaps  136: void             bufinit(struct html *);
1.51      schwarze  137: void             buffmt_man(struct html *,
1.12      kristaps  138:                        const char *, const char *);
1.10      kristaps  139: void             buffmt_includes(struct html *, const char *);
                    140:
1.42      kristaps  141: int              html_strlen(const char *);

CVSweb