#ifndef DTOB_HTML_H
#define DTOB_HTML_H

#include "dtob.h"

/*
 * HTML convention codes — backward compatible across HTML 1.0 through HTML5.
 *
 * Codes are assigned in version order: HTML 1.0 elements first, then 2.0
 * additions, then 3.2, 4.01, and 5.  A decoder for version N understands
 * all codes from versions 1 through N; higher codes are opaque custom types.
 *
 * Codes 16-18:  meta-types (text node, comment, doctype)
 * Codes 20-62:  HTML 1.0   (RFC 1866 draft, 1993)
 * Codes 63-70:  HTML 2.0   (RFC 1866, 1995)
 * Codes 71-90:  HTML 3.2   (W3C REC, 1997)
 * Codes 91-114: HTML 4.01  (W3C REC, 1999)
 * Codes 115+:   HTML5      (WHATWG Living Standard)
 */

/* ---- meta-types ---- */
#define HTML_CODE_STRING       16   /* #text node             */
#define HTML_CODE_COMMENT      17   /* <!-- … -->             */
#define HTML_CODE_DOCTYPE      18   /* <!DOCTYPE …>           */

/* ==== HTML 1.0 (1993) ==== */

/* document structure */
#define HTML_CODE_HTML         20
#define HTML_CODE_HEAD         21
#define HTML_CODE_BODY         22
#define HTML_CODE_TITLE        23

/* head elements */
#define HTML_CODE_BASE         24
#define HTML_CODE_ISINDEX      25   /* obsolete */
#define HTML_CODE_LINK         26
#define HTML_CODE_NEXTID       27   /* obsolete */

/* headings */
#define HTML_CODE_H1           28
#define HTML_CODE_H2           29
#define HTML_CODE_H3           30
#define HTML_CODE_H4           31
#define HTML_CODE_H5           32
#define HTML_CODE_H6           33

/* block elements */
#define HTML_CODE_P            34
#define HTML_CODE_ADDRESS      35
#define HTML_CODE_BLOCKQUOTE   36
#define HTML_CODE_PRE          37

/* lists */
#define HTML_CODE_UL           38
#define HTML_CODE_OL           39
#define HTML_CODE_LI           40
#define HTML_CODE_DL           41
#define HTML_CODE_DT           42
#define HTML_CODE_DD           43
#define HTML_CODE_DIR          44   /* obsolete */
#define HTML_CODE_MENU         45

/* anchor and media */
#define HTML_CODE_A            46
#define HTML_CODE_IMG          47

/* phrase / inline */
#define HTML_CODE_EM           48
#define HTML_CODE_STRONG       49
#define HTML_CODE_CODE         50
#define HTML_CODE_SAMP         51
#define HTML_CODE_KBD          52
#define HTML_CODE_VAR          53
#define HTML_CODE_DFN          54
#define HTML_CODE_CITE         55

/* font style */
#define HTML_CODE_TT           56   /* obsolete in HTML5 */
#define HTML_CODE_B            57
#define HTML_CODE_I            58
#define HTML_CODE_U            59

/* obsolete even in HTML 1.0 */
#define HTML_CODE_PLAINTEXT    60   /* obsolete */
#define HTML_CODE_XMP          61   /* obsolete */
#define HTML_CODE_LISTING      62   /* obsolete */

/* ==== HTML 2.0 (1995) ==== */

#define HTML_CODE_META         63
#define HTML_CODE_BR           64
#define HTML_CODE_HR           65
#define HTML_CODE_FORM         66
#define HTML_CODE_INPUT        67
#define HTML_CODE_SELECT       68
#define HTML_CODE_OPTION       69
#define HTML_CODE_TEXTAREA     70

/* ==== HTML 3.2 (1997) ==== */

/* scripting / style */
#define HTML_CODE_SCRIPT       71
#define HTML_CODE_STYLE        72

/* block */
#define HTML_CODE_DIV          73
#define HTML_CODE_CENTER       74   /* obsolete in HTML5 */

/* tables */
#define HTML_CODE_TABLE        75
#define HTML_CODE_CAPTION      76
#define HTML_CODE_TR           77
#define HTML_CODE_TH           78
#define HTML_CODE_TD           79

/* embedded */
#define HTML_CODE_APPLET       80   /* obsolete in HTML5 */
#define HTML_CODE_PARAM        81
#define HTML_CODE_MAP          82
#define HTML_CODE_AREA         83

/* font / text decoration */
#define HTML_CODE_FONT         84   /* obsolete in HTML5 */
#define HTML_CODE_BASEFONT     85   /* obsolete in HTML5 */
#define HTML_CODE_BIG          86   /* obsolete in HTML5 */
#define HTML_CODE_SMALL        87
#define HTML_CODE_STRIKE       88   /* obsolete in HTML5 */
#define HTML_CODE_SUB          89
#define HTML_CODE_SUP          90

/* ==== HTML 4.01 (1999) ==== */

/* text-level */
#define HTML_CODE_ABBR         91
#define HTML_CODE_ACRONYM      92   /* obsolete in HTML5 */
#define HTML_CODE_BDO          93
#define HTML_CODE_Q            94
#define HTML_CODE_S            95
#define HTML_CODE_SPAN         96

/* forms */
#define HTML_CODE_BUTTON       97
#define HTML_CODE_FIELDSET     98
#define HTML_CODE_LABEL        99
#define HTML_CODE_LEGEND       100
#define HTML_CODE_OPTGROUP     101

/* tables */
#define HTML_CODE_COL          102
#define HTML_CODE_COLGROUP     103
#define HTML_CODE_TBODY        104
#define HTML_CODE_TFOOT        105
#define HTML_CODE_THEAD        106

/* embedded / frames */
#define HTML_CODE_OBJECT       107
#define HTML_CODE_IFRAME       108
#define HTML_CODE_FRAME        109  /* obsolete in HTML5 */
#define HTML_CODE_FRAMESET     110  /* obsolete in HTML5 */
#define HTML_CODE_NOFRAMES     111  /* obsolete in HTML5 */

/* edit markers */
#define HTML_CODE_DEL          112
#define HTML_CODE_INS          113

/* scripting */
#define HTML_CODE_NOSCRIPT     114

/* ==== HTML5 (WHATWG Living Standard) ==== */

/* sections */
#define HTML_CODE_ARTICLE      115
#define HTML_CODE_ASIDE        116
#define HTML_CODE_FOOTER       117
#define HTML_CODE_HEADER       118
#define HTML_CODE_HGROUP       119
#define HTML_CODE_MAIN         120
#define HTML_CODE_NAV          121
#define HTML_CODE_SECTION      122
#define HTML_CODE_SEARCH       123

/* text-level */
#define HTML_CODE_BDI          124
#define HTML_CODE_DATA         125
#define HTML_CODE_MARK         126
#define HTML_CODE_RP           127
#define HTML_CODE_RT           128
#define HTML_CODE_RUBY         129
#define HTML_CODE_TIME         130
#define HTML_CODE_WBR          131

/* media */
#define HTML_CODE_AUDIO        132
#define HTML_CODE_VIDEO        133
#define HTML_CODE_SOURCE       134
#define HTML_CODE_TRACK        135
#define HTML_CODE_EMBED        136
#define HTML_CODE_PICTURE      137

/* interactive */
#define HTML_CODE_DETAILS      138
#define HTML_CODE_DIALOG       139
#define HTML_CODE_SUMMARY      140

/* forms */
#define HTML_CODE_DATALIST     141
#define HTML_CODE_METER        142
#define HTML_CODE_OUTPUT       143
#define HTML_CODE_PROGRESS     144

/* figures */
#define HTML_CODE_FIGCAPTION   145
#define HTML_CODE_FIGURE       146

/* scripting / template */
#define HTML_CODE_CANVAS       147
#define HTML_CODE_SLOT         148
#define HTML_CODE_TEMPLATE     149

#define HTML_CODE_SELECTEDCONTENT 150

#endif
