File: html

package info (click to toggle)
dte 1.10-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,152 kB
  • sloc: ansic: 28,421; sh: 94; awk: 56; makefile: 13; sed: 1
file content (165 lines) | stat: -rw-r--r-- 4,012 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
syntax .html-entity

state entity
    char # hash
    char -b a-zA-Z name
    recolor error 1
    char "\n" END
    eat END error

state hash entity
    char xX x
    char 0-9 dec
    eat END error

state x entity
    char 0-9a-fA-F hex
    eat END error

state hex entity
    char 0-9a-fA-F this
    char ";" END entity
    eat END error

state dec entity
    char 0-9 this
    char ";" END entity
    eat END error

state name entity
    char -b a-zA-Z0-9 this
    inlist entity optional-semicolon
    noeat -b semicolon

state optional-semicolon
    char ";" END entity
    noeat END

state semicolon
    char ";" END entity
    recolor error
    eat END error

# Generated by tools/get-html-entities.sh
list entity \
    aacute Aacute acirc Acirc acute aelig AElig agrave Agrave amp AMP \
    aring Aring atilde Atilde auml Auml brvbar ccedil Ccedil cedil cent \
    copy COPY curren deg divide eacute Eacute ecirc Ecirc egrave Egrave \
    eth ETH euml Euml frac12 frac14 frac34 gt GT iacute Iacute icirc \
    Icirc iexcl igrave Igrave iquest iuml Iuml laquo lt LT macr micro \
    middot nbsp not ntilde Ntilde oacute Oacute ocirc Ocirc ograve \
    Ograve ordf ordm oslash Oslash otilde Otilde ouml Ouml para plusmn \
    pound quot QUOT raquo reg REG sect shy sup1 sup2 sup3 szlig thorn \
    THORN times uacute Uacute ucirc Ucirc ugrave Ugrave uml uuml Uuml \
    yacute Yacute yen yuml

syntax html

# TODO: Allow comments before doctype
# TODO: Don't highlight tags inside RCDATA elements (e.g. style, script, etc.)

state start text
    char " \t\n" this
    str "<!" doctype
    noeat text

state doctype comment
    char > text comment
    char < text error
    eat this

state text
    str "<!--" comment
    char < tag-start
    char > start error
    char "&" .html-entity:this
    eat this

state comment
    str -- --> text comment
    eat this

state tag-start tag
    char / close-tag
    char -b a-zA-Z0-9_ tag-name
    char " \t\n" this
    char > text tag
    eat this error

state close-tag tag
    char -b a-zA-Z0-9_ close-tag-name
    char " \t\n" this
    eat text error

state tag-name tag-unknown
    char -b a-zA-Z0-9_ this
    inlist tag attrs
    inlist tag-deprecated attrs
    noeat attrs

state close-tag-name tag-unknown
    char -b a-zA-Z0-9_ this
    inlist tag close-tag-end
    inlist tag-deprecated close-tag-end
    noeat close-tag-end

state close-tag-end tag
    char " \t\n" this
    char > text tag
    eat text error

state attrs code
    char " \t\n" this
    char -b a-zA-Z attr-name
    char > text tag
    char / short-close
    eat this error

state short-close tag
    char > text tag
    eat text error

state attr-name attr
    char a-zA-Z:_- this
    char = attr-eq
    noeat attrs

state attr-eq attr
    char \" dq
    char \' sq
    noeat attrs

state dq string
    char \" attrs string
    char "\n" attrs
    char "&" .html-entity:this
    eat this

state sq string
    char \' attrs string
    char "\n" attrs
    char "&" .html-entity:this
    eat this

list -i tag \
    a abbr address area b base bdo blockquote body br \
    button caption cite code col colgroup dd del dfn div dl dt em \
    fieldset form h1 h2 h3 h4 h5 h6 head hr html i iframe img input \
    ins kbd label legend li link map meta noscript object ol optgroup \
    option p param pre q samp script select small span strong style \
    sub sup table tbody td textarea tfoot th thead title tr ul var \
\
    article aside audio bdi canvas command data datalist details \
    dialog embed figcaption figure footer header hgroup main mark \
    menu meter nav output picture progress rp rt ruby s section slot \
    source summary template time track u video wbr

list -i tag-deprecated \
    acronym applet basefont bgsound big blink center dir font frame \
    frameset isindex keygen listing marquee menuitem multicol \
    nextid nobr noembed noframes plaintext rb rtc spacer strike tt \
    xmp

default code tag-unknown
default error tag-deprecated
default special entity