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

Annotation of src/usr.bin/mandoc/html.h, Revision 1.49

1.49    ! schwarze    1: /*     $OpenBSD: html.h,v 1.48 2017/06/23 02:31:39 schwarze Exp $ */
1.1       schwarze    2: /*
1.25      schwarze    3:  * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
1.36      schwarze    4:  * Copyright (c) 2017 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:  *
                     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.
                     17:  */
                     18:
                     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.43      schwarze   33:        TAG_COLGROUP,
1.1       schwarze   34:        TAG_COL,
                     35:        TAG_TR,
                     36:        TAG_TD,
                     37:        TAG_LI,
                     38:        TAG_UL,
                     39:        TAG_OL,
1.9       schwarze   40:        TAG_DL,
                     41:        TAG_DT,
                     42:        TAG_DD,
                     43:        TAG_PRE,
1.45      schwarze   44:        TAG_VAR,
1.44      schwarze   45:        TAG_CITE,
1.10      schwarze   46:        TAG_B,
                     47:        TAG_I,
1.11      schwarze   48:        TAG_CODE,
                     49:        TAG_SMALL,
1.25      schwarze   50:        TAG_STYLE,
1.26      schwarze   51:        TAG_MATH,
                     52:        TAG_MROW,
                     53:        TAG_MI,
1.48      schwarze   54:        TAG_MN,
1.26      schwarze   55:        TAG_MO,
                     56:        TAG_MSUP,
                     57:        TAG_MSUB,
                     58:        TAG_MSUBSUP,
                     59:        TAG_MFRAC,
                     60:        TAG_MSQRT,
                     61:        TAG_MFENCED,
                     62:        TAG_MTABLE,
                     63:        TAG_MTR,
                     64:        TAG_MTD,
1.27      schwarze   65:        TAG_MUNDEROVER,
                     66:        TAG_MUNDER,
                     67:        TAG_MOVER,
1.1       schwarze   68:        TAG_MAX
                     69: };
                     70:
1.4       schwarze   71: enum   htmlfont {
                     72:        HTMLFONT_NONE = 0,
                     73:        HTMLFONT_BOLD,
                     74:        HTMLFONT_ITALIC,
1.20      schwarze   75:        HTMLFONT_BI,
1.4       schwarze   76:        HTMLFONT_MAX
                     77: };
                     78:
1.1       schwarze   79: struct tag {
1.2       schwarze   80:        struct tag       *next;
1.1       schwarze   81:        enum htmltag      tag;
                     82: };
                     83:
                     84: struct html {
                     85:        int               flags;
1.15      schwarze   86: #define        HTML_NOSPACE     (1 << 0) /* suppress next space */
1.7       schwarze   87: #define        HTML_IGNDELIM    (1 << 1)
                     88: #define        HTML_KEEP        (1 << 2)
                     89: #define        HTML_PREKEEP     (1 << 3)
1.15      schwarze   90: #define        HTML_NONOSPACE   (1 << 4) /* never add spaces */
                     91: #define        HTML_LITERAL     (1 << 5) /* literal (e.g., <PRE>) context */
1.19      schwarze   92: #define        HTML_SKIPCHAR    (1 << 6) /* skip the next character */
1.24      schwarze   93: #define        HTML_NOSPLIT     (1 << 7) /* do not break line before .An */
                     94: #define        HTML_SPLIT       (1 << 8) /* break line before .An */
1.32      schwarze   95: #define        HTML_NONEWLINE   (1 << 9) /* No line break in nofill mode. */
1.39      schwarze   96: #define        HTML_BUFFER      (1 << 10) /* Collect a word to see if it fits. */
                     97:        size_t            indent; /* current output indentation level */
1.38      schwarze   98:        int               noindent; /* indent disabled by <pre> */
1.39      schwarze   99:        size_t            col; /* current output byte position */
                    100:        size_t            bufcol; /* current buf byte position */
                    101:        char              buf[80]; /* output buffer */
1.42      schwarze  102:        struct tag       *tag; /* last open tag */
1.13      schwarze  103:        struct rofftbl    tbl; /* current table */
1.14      schwarze  104:        struct tag       *tblt; /* current open table scope */
1.13      schwarze  105:        char             *base_man; /* base for manpage href */
                    106:        char             *base_includes; /* base for include href */
                    107:        char             *style; /* style-sheet URI */
1.11      schwarze  108:        struct tag       *metaf; /* current open font scope */
                    109:        enum htmlfont     metal; /* last used font */
                    110:        enum htmlfont     metac; /* current font mode */
1.18      schwarze  111:        int               oflags; /* output options */
                    112: #define        HTML_FRAGMENT    (1 << 0) /* don't emit HTML/HEAD/BODY */
1.1       schwarze  113: };
1.31      schwarze  114:
                    115:
1.46      schwarze  116: struct roff_node;
1.31      schwarze  117: struct tbl_span;
1.49    ! schwarze  118: struct eqn_box;
1.47      schwarze  119:
                    120: void             roff_html_pre(struct html *, const struct roff_node *);
1.1       schwarze  121:
1.5       schwarze  122: void             print_gen_decls(struct html *);
1.1       schwarze  123: void             print_gen_head(struct html *);
1.36      schwarze  124: struct tag      *print_otag(struct html *, enum htmltag, const char *, ...);
1.1       schwarze  125: void             print_tagq(struct html *, const struct tag *);
                    126: void             print_stagq(struct html *, const struct tag *);
                    127: void             print_text(struct html *, const char *);
1.14      schwarze  128: void             print_tblclose(struct html *);
1.12      schwarze  129: void             print_tbl(struct html *, const struct tbl_span *);
1.49    ! schwarze  130: void             print_eqn(struct html *, const struct eqn_box *);
1.25      schwarze  131: void             print_paragraph(struct html *);
1.41      schwarze  132: void             print_endline(struct html *);
1.3       schwarze  133:
1.46      schwarze  134: char            *html_make_id(const struct roff_node *);
1.16      schwarze  135: int              html_strlen(const char *);