diff options
Diffstat (limited to 'vendor/github.com/tdewolff/minify/v2/html')
| -rw-r--r-- | vendor/github.com/tdewolff/minify/v2/html/buffer.go | 137 | ||||
| -rw-r--r-- | vendor/github.com/tdewolff/minify/v2/html/hash.go | 543 | ||||
| -rw-r--r-- | vendor/github.com/tdewolff/minify/v2/html/html.go | 514 | ||||
| -rw-r--r-- | vendor/github.com/tdewolff/minify/v2/html/table.go | 1346 |
4 files changed, 2540 insertions, 0 deletions
diff --git a/vendor/github.com/tdewolff/minify/v2/html/buffer.go b/vendor/github.com/tdewolff/minify/v2/html/buffer.go new file mode 100644 index 0000000..f58367b --- /dev/null +++ b/vendor/github.com/tdewolff/minify/v2/html/buffer.go | |||
| @@ -0,0 +1,137 @@ | |||
| 1 | package html | ||
| 2 | |||
| 3 | import ( | ||
| 4 | "github.com/tdewolff/parse/v2" | ||
| 5 | "github.com/tdewolff/parse/v2/html" | ||
| 6 | ) | ||
| 7 | |||
| 8 | // Token is a single token unit with an attribute value (if given) and hash of the data. | ||
| 9 | type Token struct { | ||
| 10 | html.TokenType | ||
| 11 | Hash Hash | ||
| 12 | Data []byte | ||
| 13 | Text []byte | ||
| 14 | AttrVal []byte | ||
| 15 | Traits traits | ||
| 16 | Offset int | ||
| 17 | } | ||
| 18 | |||
| 19 | // TokenBuffer is a buffer that allows for token look-ahead. | ||
| 20 | type TokenBuffer struct { | ||
| 21 | r *parse.Input | ||
| 22 | l *html.Lexer | ||
| 23 | |||
| 24 | buf []Token | ||
| 25 | pos int | ||
| 26 | |||
| 27 | attrBuffer []*Token | ||
| 28 | } | ||
| 29 | |||
| 30 | // NewTokenBuffer returns a new TokenBuffer. | ||
| 31 | func NewTokenBuffer(r *parse.Input, l *html.Lexer) *TokenBuffer { | ||
| 32 | return &TokenBuffer{ | ||
| 33 | r: r, | ||
| 34 | l: l, | ||
| 35 | buf: make([]Token, 0, 8), | ||
| 36 | } | ||
| 37 | } | ||
| 38 | |||
| 39 | func (z *TokenBuffer) read(t *Token) { | ||
| 40 | t.Offset = z.r.Offset() | ||
| 41 | t.TokenType, t.Data = z.l.Next() | ||
| 42 | t.Text = z.l.Text() | ||
| 43 | if t.TokenType == html.AttributeToken { | ||
| 44 | t.Offset += 1 + len(t.Text) + 1 | ||
| 45 | t.AttrVal = z.l.AttrVal() | ||
| 46 | if len(t.AttrVal) > 1 && (t.AttrVal[0] == '"' || t.AttrVal[0] == '\'') { | ||
| 47 | t.Offset++ | ||
| 48 | t.AttrVal = t.AttrVal[1 : len(t.AttrVal)-1] // quotes will be readded in attribute loop if necessary | ||
| 49 | } | ||
| 50 | t.Hash = ToHash(t.Text) | ||
| 51 | t.Traits = attrMap[t.Hash] | ||
| 52 | } else if t.TokenType == html.StartTagToken || t.TokenType == html.EndTagToken { | ||
| 53 | t.AttrVal = nil | ||
| 54 | t.Hash = ToHash(t.Text) | ||
| 55 | t.Traits = tagMap[t.Hash] // zero if not exist | ||
| 56 | } else { | ||
| 57 | t.AttrVal = nil | ||
| 58 | t.Hash = 0 | ||
| 59 | t.Traits = 0 | ||
| 60 | } | ||
| 61 | } | ||
| 62 | |||
| 63 | // Peek returns the ith element and possibly does an allocation. | ||
| 64 | // Peeking past an error will panic. | ||
| 65 | func (z *TokenBuffer) Peek(pos int) *Token { | ||
| 66 | pos += z.pos | ||
| 67 | if pos >= len(z.buf) { | ||
| 68 | if len(z.buf) > 0 && z.buf[len(z.buf)-1].TokenType == html.ErrorToken { | ||
| 69 | return &z.buf[len(z.buf)-1] | ||
| 70 | } | ||
| 71 | |||
| 72 | c := cap(z.buf) | ||
| 73 | d := len(z.buf) - z.pos | ||
| 74 | p := pos - z.pos + 1 // required peek length | ||
| 75 | var buf []Token | ||
| 76 | if 2*p > c { | ||
| 77 | buf = make([]Token, 0, 2*c+p) | ||
| 78 | } else { | ||
| 79 | buf = z.buf | ||
| 80 | } | ||
| 81 | copy(buf[:d], z.buf[z.pos:]) | ||
| 82 | |||
| 83 | buf = buf[:p] | ||
| 84 | pos -= z.pos | ||
| 85 | for i := d; i < p; i++ { | ||
| 86 | z.read(&buf[i]) | ||
| 87 | if buf[i].TokenType == html.ErrorToken { | ||
| 88 | buf = buf[:i+1] | ||
| 89 | pos = i | ||
| 90 | break | ||
| 91 | } | ||
| 92 | } | ||
| 93 | z.pos, z.buf = 0, buf | ||
| 94 | } | ||
| 95 | return &z.buf[pos] | ||
| 96 | } | ||
| 97 | |||
| 98 | // Shift returns the first element and advances position. | ||
| 99 | func (z *TokenBuffer) Shift() *Token { | ||
| 100 | if z.pos >= len(z.buf) { | ||
| 101 | t := &z.buf[:1][0] | ||
| 102 | z.read(t) | ||
| 103 | return t | ||
| 104 | } | ||
| 105 | t := &z.buf[z.pos] | ||
| 106 | z.pos++ | ||
| 107 | return t | ||
| 108 | } | ||
| 109 | |||
| 110 | // Attributes extracts the gives attribute hashes from a tag. | ||
| 111 | // It returns in the same order pointers to the requested token data or nil. | ||
| 112 | func (z *TokenBuffer) Attributes(hashes ...Hash) []*Token { | ||
| 113 | n := 0 | ||
| 114 | for { | ||
| 115 | if t := z.Peek(n); t.TokenType != html.AttributeToken { | ||
| 116 | break | ||
| 117 | } | ||
| 118 | n++ | ||
| 119 | } | ||
| 120 | if len(hashes) > cap(z.attrBuffer) { | ||
| 121 | z.attrBuffer = make([]*Token, len(hashes)) | ||
| 122 | } else { | ||
| 123 | z.attrBuffer = z.attrBuffer[:len(hashes)] | ||
| 124 | for i := range z.attrBuffer { | ||
| 125 | z.attrBuffer[i] = nil | ||
| 126 | } | ||
| 127 | } | ||
| 128 | for i := z.pos; i < z.pos+n; i++ { | ||
| 129 | attr := &z.buf[i] | ||
| 130 | for j, hash := range hashes { | ||
| 131 | if hash == attr.Hash { | ||
| 132 | z.attrBuffer[j] = attr | ||
| 133 | } | ||
| 134 | } | ||
| 135 | } | ||
| 136 | return z.attrBuffer | ||
| 137 | } | ||
diff --git a/vendor/github.com/tdewolff/minify/v2/html/hash.go b/vendor/github.com/tdewolff/minify/v2/html/hash.go new file mode 100644 index 0000000..3b91cbb --- /dev/null +++ b/vendor/github.com/tdewolff/minify/v2/html/hash.go | |||
| @@ -0,0 +1,543 @@ | |||
| 1 | package html | ||
| 2 | |||
| 3 | // generated by hasher -type=Hash -file=hash.go; DO NOT EDIT, except for adding more constants to the list and rerun go generate | ||
| 4 | |||
| 5 | // uses github.com/tdewolff/hasher | ||
| 6 | //go:generate hasher -type=Hash -file=hash.go | ||
| 7 | |||
| 8 | // Hash defines perfect hashes for a predefined list of strings | ||
| 9 | type Hash uint32 | ||
| 10 | |||
| 11 | // Unique hash definitions to be used instead of strings | ||
| 12 | const ( | ||
| 13 | A Hash = 0x1 // a | ||
| 14 | Abbr Hash = 0x37a04 // abbr | ||
| 15 | About Hash = 0x5 // about | ||
| 16 | Accept Hash = 0x1106 // accept | ||
| 17 | Accept_Charset Hash = 0x110e // accept-charset | ||
| 18 | Action Hash = 0x23f06 // action | ||
| 19 | Address Hash = 0x5a07 // address | ||
| 20 | Align Hash = 0x32705 // align | ||
| 21 | Alink Hash = 0x7005 // alink | ||
| 22 | Allowfullscreen Hash = 0x2ad0f // allowfullscreen | ||
| 23 | Amp_Boilerplate Hash = 0x610f // amp-boilerplate | ||
| 24 | Area Hash = 0x1e304 // area | ||
| 25 | Article Hash = 0x2707 // article | ||
| 26 | Aside Hash = 0xb405 // aside | ||
| 27 | Async Hash = 0xac05 // async | ||
| 28 | Audio Hash = 0xd105 // audio | ||
| 29 | Autofocus Hash = 0xe409 // autofocus | ||
| 30 | Autoplay Hash = 0x10808 // autoplay | ||
| 31 | Axis Hash = 0x11004 // axis | ||
| 32 | B Hash = 0x101 // b | ||
| 33 | Background Hash = 0x300a // background | ||
| 34 | Base Hash = 0x19604 // base | ||
| 35 | Bb Hash = 0x37b02 // bb | ||
| 36 | Bdi Hash = 0x7503 // bdi | ||
| 37 | Bdo Hash = 0x31f03 // bdo | ||
| 38 | Bgcolor Hash = 0x12607 // bgcolor | ||
| 39 | Blockquote Hash = 0x13e0a // blockquote | ||
| 40 | Body Hash = 0xd04 // body | ||
| 41 | Br Hash = 0x37c02 // br | ||
| 42 | Button Hash = 0x14806 // button | ||
| 43 | Canvas Hash = 0xb006 // canvas | ||
| 44 | Caption Hash = 0x21f07 // caption | ||
| 45 | Charset Hash = 0x1807 // charset | ||
| 46 | Checked Hash = 0x1b307 // checked | ||
| 47 | Cite Hash = 0xfb04 // cite | ||
| 48 | Class Hash = 0x15905 // class | ||
| 49 | Classid Hash = 0x15907 // classid | ||
| 50 | Clear Hash = 0x2b05 // clear | ||
| 51 | Code Hash = 0x19204 // code | ||
| 52 | Codebase Hash = 0x19208 // codebase | ||
| 53 | Codetype Hash = 0x1a408 // codetype | ||
| 54 | Col Hash = 0x12803 // col | ||
| 55 | Colgroup Hash = 0x1bb08 // colgroup | ||
| 56 | Color Hash = 0x12805 // color | ||
| 57 | Cols Hash = 0x1cf04 // cols | ||
| 58 | Colspan Hash = 0x1cf07 // colspan | ||
| 59 | Compact Hash = 0x1ec07 // compact | ||
| 60 | Content Hash = 0x28407 // content | ||
| 61 | Controls Hash = 0x20108 // controls | ||
| 62 | Data Hash = 0x1f04 // data | ||
| 63 | Datalist Hash = 0x1f08 // datalist | ||
| 64 | Datatype Hash = 0x4d08 // datatype | ||
| 65 | Dd Hash = 0x5b02 // dd | ||
| 66 | Declare Hash = 0xb707 // declare | ||
| 67 | Default Hash = 0x7f07 // default | ||
| 68 | DefaultChecked Hash = 0x1730e // defaultChecked | ||
| 69 | DefaultMuted Hash = 0x7f0c // defaultMuted | ||
| 70 | DefaultSelected Hash = 0x8a0f // defaultSelected | ||
| 71 | Defer Hash = 0x9805 // defer | ||
| 72 | Del Hash = 0x10503 // del | ||
| 73 | Details Hash = 0x15f07 // details | ||
| 74 | Dfn Hash = 0x16c03 // dfn | ||
| 75 | Dialog Hash = 0xa606 // dialog | ||
| 76 | Dir Hash = 0x7603 // dir | ||
| 77 | Disabled Hash = 0x18008 // disabled | ||
| 78 | Div Hash = 0x18703 // div | ||
| 79 | Dl Hash = 0x1b902 // dl | ||
| 80 | Dt Hash = 0x23102 // dt | ||
| 81 | Em Hash = 0x4302 // em | ||
| 82 | Embed Hash = 0x4905 // embed | ||
| 83 | Enabled Hash = 0x26c07 // enabled | ||
| 84 | Enctype Hash = 0x1fa07 // enctype | ||
| 85 | Face Hash = 0x5604 // face | ||
| 86 | Fieldset Hash = 0x21408 // fieldset | ||
| 87 | Figcaption Hash = 0x21c0a // figcaption | ||
| 88 | Figure Hash = 0x22606 // figure | ||
| 89 | Footer Hash = 0xdb06 // footer | ||
| 90 | For Hash = 0x23b03 // for | ||
| 91 | Form Hash = 0x23b04 // form | ||
| 92 | Formaction Hash = 0x23b0a // formaction | ||
| 93 | Formnovalidate Hash = 0x2450e // formnovalidate | ||
| 94 | Frame Hash = 0x28c05 // frame | ||
| 95 | Frameborder Hash = 0x28c0b // frameborder | ||
| 96 | H1 Hash = 0x2e002 // h1 | ||
| 97 | H2 Hash = 0x25302 // h2 | ||
| 98 | H3 Hash = 0x25502 // h3 | ||
| 99 | H4 Hash = 0x25702 // h4 | ||
| 100 | H5 Hash = 0x25902 // h5 | ||
| 101 | H6 Hash = 0x25b02 // h6 | ||
| 102 | Head Hash = 0x2d204 // head | ||
| 103 | Header Hash = 0x2d206 // header | ||
| 104 | Hgroup Hash = 0x25d06 // hgroup | ||
| 105 | Hidden Hash = 0x26806 // hidden | ||
| 106 | Hr Hash = 0x32d02 // hr | ||
| 107 | Href Hash = 0x32d04 // href | ||
| 108 | Hreflang Hash = 0x32d08 // hreflang | ||
| 109 | Html Hash = 0x27304 // html | ||
| 110 | Http_Equiv Hash = 0x2770a // http-equiv | ||
| 111 | I Hash = 0x2401 // i | ||
| 112 | Icon Hash = 0x28304 // icon | ||
| 113 | Id Hash = 0xb602 // id | ||
| 114 | Iframe Hash = 0x28b06 // iframe | ||
| 115 | Img Hash = 0x29703 // img | ||
| 116 | Inert Hash = 0xf605 // inert | ||
| 117 | Inlist Hash = 0x29a06 // inlist | ||
| 118 | Input Hash = 0x2a405 // input | ||
| 119 | Ins Hash = 0x2a903 // ins | ||
| 120 | Ismap Hash = 0x11205 // ismap | ||
| 121 | Itemscope Hash = 0xfc09 // itemscope | ||
| 122 | Kbd Hash = 0x7403 // kbd | ||
| 123 | Keygen Hash = 0x1f606 // keygen | ||
| 124 | Label Hash = 0xbe05 // label | ||
| 125 | Lang Hash = 0x33104 // lang | ||
| 126 | Language Hash = 0x33108 // language | ||
| 127 | Legend Hash = 0x2c506 // legend | ||
| 128 | Li Hash = 0x2302 // li | ||
| 129 | Link Hash = 0x7104 // link | ||
| 130 | Longdesc Hash = 0xc208 // longdesc | ||
| 131 | Main Hash = 0xf404 // main | ||
| 132 | Manifest Hash = 0x2bc08 // manifest | ||
| 133 | Map Hash = 0xee03 // map | ||
| 134 | Mark Hash = 0x2cb04 // mark | ||
| 135 | Math Hash = 0x2cf04 // math | ||
| 136 | Max Hash = 0x2d803 // max | ||
| 137 | Maxlength Hash = 0x2d809 // maxlength | ||
| 138 | Media Hash = 0xa405 // media | ||
| 139 | Menu Hash = 0x12204 // menu | ||
| 140 | Meta Hash = 0x2e204 // meta | ||
| 141 | Meter Hash = 0x2f705 // meter | ||
| 142 | Method Hash = 0x2fc06 // method | ||
| 143 | Multiple Hash = 0x30208 // multiple | ||
| 144 | Muted Hash = 0x30a05 // muted | ||
| 145 | Name Hash = 0xa204 // name | ||
| 146 | Nav Hash = 0x32403 // nav | ||
| 147 | Nohref Hash = 0x32b06 // nohref | ||
| 148 | Noresize Hash = 0x13608 // noresize | ||
| 149 | Noscript Hash = 0x14d08 // noscript | ||
| 150 | Noshade Hash = 0x16e07 // noshade | ||
| 151 | Novalidate Hash = 0x2490a // novalidate | ||
| 152 | Nowrap Hash = 0x1d506 // nowrap | ||
| 153 | Object Hash = 0xd506 // object | ||
| 154 | Ol Hash = 0xcb02 // ol | ||
| 155 | Open Hash = 0x32104 // open | ||
| 156 | Optgroup Hash = 0x35608 // optgroup | ||
| 157 | Option Hash = 0x30f06 // option | ||
| 158 | Output Hash = 0x206 // output | ||
| 159 | P Hash = 0x501 // p | ||
| 160 | Param Hash = 0xf005 // param | ||
| 161 | Pauseonexit Hash = 0x1160b // pauseonexit | ||
| 162 | Picture Hash = 0x1c207 // picture | ||
| 163 | Plaintext Hash = 0x1da09 // plaintext | ||
| 164 | Poster Hash = 0x26206 // poster | ||
| 165 | Pre Hash = 0x35d03 // pre | ||
| 166 | Prefix Hash = 0x35d06 // prefix | ||
| 167 | Profile Hash = 0x36407 // profile | ||
| 168 | Progress Hash = 0x34208 // progress | ||
| 169 | Property Hash = 0x31508 // property | ||
| 170 | Q Hash = 0x14301 // q | ||
| 171 | Rb Hash = 0x2f02 // rb | ||
| 172 | Readonly Hash = 0x1e408 // readonly | ||
| 173 | Rel Hash = 0xbc03 // rel | ||
| 174 | Required Hash = 0x22a08 // required | ||
| 175 | Resource Hash = 0x1c708 // resource | ||
| 176 | Rev Hash = 0x7803 // rev | ||
| 177 | Reversed Hash = 0x7808 // reversed | ||
| 178 | Rows Hash = 0x9c04 // rows | ||
| 179 | Rowspan Hash = 0x9c07 // rowspan | ||
| 180 | Rp Hash = 0x6a02 // rp | ||
| 181 | Rt Hash = 0x2802 // rt | ||
| 182 | Rtc Hash = 0xf903 // rtc | ||
| 183 | Ruby Hash = 0xe004 // ruby | ||
| 184 | Rules Hash = 0x12c05 // rules | ||
| 185 | S Hash = 0x1c01 // s | ||
| 186 | Samp Hash = 0x6004 // samp | ||
| 187 | Scope Hash = 0x10005 // scope | ||
| 188 | Scoped Hash = 0x10006 // scoped | ||
| 189 | Script Hash = 0x14f06 // script | ||
| 190 | Scrolling Hash = 0xc809 // scrolling | ||
| 191 | Seamless Hash = 0x19808 // seamless | ||
| 192 | Section Hash = 0x13007 // section | ||
| 193 | Select Hash = 0x16506 // select | ||
| 194 | Selected Hash = 0x16508 // selected | ||
| 195 | Shape Hash = 0x19f05 // shape | ||
| 196 | Size Hash = 0x13a04 // size | ||
| 197 | Slot Hash = 0x20804 // slot | ||
| 198 | Small Hash = 0x2ab05 // small | ||
| 199 | Sortable Hash = 0x2ef08 // sortable | ||
| 200 | Source Hash = 0x1c906 // source | ||
| 201 | Span Hash = 0x9f04 // span | ||
| 202 | Src Hash = 0x34903 // src | ||
| 203 | Srcset Hash = 0x34906 // srcset | ||
| 204 | Start Hash = 0x2505 // start | ||
| 205 | Strong Hash = 0x29e06 // strong | ||
| 206 | Style Hash = 0x2c205 // style | ||
| 207 | Sub Hash = 0x31d03 // sub | ||
| 208 | Summary Hash = 0x33907 // summary | ||
| 209 | Sup Hash = 0x34003 // sup | ||
| 210 | Svg Hash = 0x34f03 // svg | ||
| 211 | Tabindex Hash = 0x2e408 // tabindex | ||
| 212 | Table Hash = 0x2f205 // table | ||
| 213 | Target Hash = 0x706 // target | ||
| 214 | Tbody Hash = 0xc05 // tbody | ||
| 215 | Td Hash = 0x1e02 // td | ||
| 216 | Template Hash = 0x4208 // template | ||
| 217 | Text Hash = 0x1df04 // text | ||
| 218 | Textarea Hash = 0x1df08 // textarea | ||
| 219 | Tfoot Hash = 0xda05 // tfoot | ||
| 220 | Th Hash = 0x2d102 // th | ||
| 221 | Thead Hash = 0x2d105 // thead | ||
| 222 | Time Hash = 0x12004 // time | ||
| 223 | Title Hash = 0x15405 // title | ||
| 224 | Tr Hash = 0x1f202 // tr | ||
| 225 | Track Hash = 0x1f205 // track | ||
| 226 | Translate Hash = 0x20b09 // translate | ||
| 227 | Truespeed Hash = 0x23209 // truespeed | ||
| 228 | Type Hash = 0x5104 // type | ||
| 229 | Typemustmatch Hash = 0x1a80d // typemustmatch | ||
| 230 | Typeof Hash = 0x5106 // typeof | ||
| 231 | U Hash = 0x301 // u | ||
| 232 | Ul Hash = 0x8302 // ul | ||
| 233 | Undeterminate Hash = 0x370d // undeterminate | ||
| 234 | Usemap Hash = 0xeb06 // usemap | ||
| 235 | Valign Hash = 0x32606 // valign | ||
| 236 | Value Hash = 0x18905 // value | ||
| 237 | Valuetype Hash = 0x18909 // valuetype | ||
| 238 | Var Hash = 0x28003 // var | ||
| 239 | Video Hash = 0x35205 // video | ||
| 240 | Visible Hash = 0x36b07 // visible | ||
| 241 | Vlink Hash = 0x37205 // vlink | ||
| 242 | Vocab Hash = 0x37705 // vocab | ||
| 243 | Wbr Hash = 0x37e03 // wbr | ||
| 244 | Xmlns Hash = 0x2eb05 // xmlns | ||
| 245 | Xmp Hash = 0x36203 // xmp | ||
| 246 | ) | ||
| 247 | |||
| 248 | // String returns the hash' name. | ||
| 249 | func (i Hash) String() string { | ||
| 250 | start := uint32(i >> 8) | ||
| 251 | n := uint32(i & 0xff) | ||
| 252 | if start+n > uint32(len(_Hash_text)) { | ||
| 253 | return "" | ||
| 254 | } | ||
| 255 | return _Hash_text[start : start+n] | ||
| 256 | } | ||
| 257 | |||
| 258 | // ToHash returns the hash whose name is s. It returns zero if there is no | ||
| 259 | // such hash. It is case sensitive. | ||
| 260 | func ToHash(s []byte) Hash { | ||
| 261 | if len(s) == 0 || len(s) > _Hash_maxLen { | ||
| 262 | return 0 | ||
| 263 | } | ||
| 264 | h := uint32(_Hash_hash0) | ||
| 265 | for i := 0; i < len(s); i++ { | ||
| 266 | h ^= uint32(s[i]) | ||
| 267 | h *= 16777619 | ||
| 268 | } | ||
| 269 | if i := _Hash_table[h&uint32(len(_Hash_table)-1)]; int(i&0xff) == len(s) { | ||
| 270 | t := _Hash_text[i>>8 : i>>8+i&0xff] | ||
| 271 | for i := 0; i < len(s); i++ { | ||
| 272 | if t[i] != s[i] { | ||
| 273 | goto NEXT | ||
| 274 | } | ||
| 275 | } | ||
| 276 | return i | ||
| 277 | } | ||
| 278 | NEXT: | ||
| 279 | if i := _Hash_table[(h>>16)&uint32(len(_Hash_table)-1)]; int(i&0xff) == len(s) { | ||
| 280 | t := _Hash_text[i>>8 : i>>8+i&0xff] | ||
| 281 | for i := 0; i < len(s); i++ { | ||
| 282 | if t[i] != s[i] { | ||
| 283 | return 0 | ||
| 284 | } | ||
| 285 | } | ||
| 286 | return i | ||
| 287 | } | ||
| 288 | return 0 | ||
| 289 | } | ||
| 290 | |||
| 291 | const _Hash_hash0 = 0x9acb0442 | ||
| 292 | const _Hash_maxLen = 15 | ||
| 293 | const _Hash_text = "aboutputargetbodyaccept-charsetdatalistarticlearbackgroundet" + | ||
| 294 | "erminatemplatembedatatypeofaceaddressamp-boilerplatealinkbdi" + | ||
| 295 | "reversedefaultMutedefaultSelectedeferowspanamedialogasyncanv" + | ||
| 296 | "asideclarelabelongdescrollingaudiobjectfooterubyautofocusema" + | ||
| 297 | "paramainertcitemscopedelautoplayaxismapauseonexitimenubgcolo" + | ||
| 298 | "rulesectionoresizeblockquotebuttonoscriptitleclassidetailsel" + | ||
| 299 | "ectedfnoshadefaultCheckedisabledivaluetypecodebaseamlesshape" + | ||
| 300 | "codetypemustmatcheckedlcolgroupicturesourcecolspanowraplaint" + | ||
| 301 | "extareadonlycompactrackeygenctypecontrolslotranslatefieldset" + | ||
| 302 | "figcaptionfigurequiredtruespeedformactionformnovalidateh2h3h" + | ||
| 303 | "4h5h6hgrouposterhiddenabledhtmlhttp-equivaricontentiframebor" + | ||
| 304 | "derimginlistronginputinsmallowfullscreenmanifestylegendmarkm" + | ||
| 305 | "atheadermaxlength1metabindexmlnsortablemetermethodmultiplemu" + | ||
| 306 | "tedoptionpropertysubdopenavalignohreflanguagesummarysuprogre" + | ||
| 307 | "ssrcsetsvgvideoptgrouprefixmprofilevisiblevlinkvocabbrwbr" | ||
| 308 | |||
| 309 | var _Hash_table = [1 << 9]Hash{ | ||
| 310 | 0x0: 0x1df08, // textarea | ||
| 311 | 0x4: 0x32d02, // hr | ||
| 312 | 0x8: 0x1c207, // picture | ||
| 313 | 0xb: 0x18905, // value | ||
| 314 | 0xf: 0x2e408, // tabindex | ||
| 315 | 0x12: 0x15905, // class | ||
| 316 | 0x15: 0x37e03, // wbr | ||
| 317 | 0x18: 0x1a80d, // typemustmatch | ||
| 318 | 0x1a: 0x1b902, // dl | ||
| 319 | 0x1d: 0xf903, // rtc | ||
| 320 | 0x1e: 0x25702, // h4 | ||
| 321 | 0x22: 0x2ef08, // sortable | ||
| 322 | 0x24: 0x4208, // template | ||
| 323 | 0x25: 0x28c0b, // frameborder | ||
| 324 | 0x28: 0x37a04, // abbr | ||
| 325 | 0x29: 0x28b06, // iframe | ||
| 326 | 0x2a: 0x610f, // amp-boilerplate | ||
| 327 | 0x2c: 0x1e408, // readonly | ||
| 328 | 0x30: 0x23f06, // action | ||
| 329 | 0x33: 0x28c05, // frame | ||
| 330 | 0x35: 0x12c05, // rules | ||
| 331 | 0x36: 0x30208, // multiple | ||
| 332 | 0x38: 0x31f03, // bdo | ||
| 333 | 0x39: 0x1d506, // nowrap | ||
| 334 | 0x3e: 0x21408, // fieldset | ||
| 335 | 0x3f: 0x7503, // bdi | ||
| 336 | 0x46: 0x7f0c, // defaultMuted | ||
| 337 | 0x49: 0x35205, // video | ||
| 338 | 0x4c: 0x19808, // seamless | ||
| 339 | 0x4d: 0x13608, // noresize | ||
| 340 | 0x4f: 0xb602, // id | ||
| 341 | 0x51: 0x25d06, // hgroup | ||
| 342 | 0x52: 0x23102, // dt | ||
| 343 | 0x55: 0x12805, // color | ||
| 344 | 0x56: 0x34003, // sup | ||
| 345 | 0x59: 0x370d, // undeterminate | ||
| 346 | 0x5a: 0x35608, // optgroup | ||
| 347 | 0x5b: 0x2d206, // header | ||
| 348 | 0x5c: 0xb405, // aside | ||
| 349 | 0x5f: 0x10005, // scope | ||
| 350 | 0x60: 0x101, // b | ||
| 351 | 0x61: 0xcb02, // ol | ||
| 352 | 0x64: 0x32b06, // nohref | ||
| 353 | 0x65: 0x1da09, // plaintext | ||
| 354 | 0x66: 0x20804, // slot | ||
| 355 | 0x67: 0x11004, // axis | ||
| 356 | 0x68: 0x12803, // col | ||
| 357 | 0x69: 0x32606, // valign | ||
| 358 | 0x6c: 0x2d105, // thead | ||
| 359 | 0x70: 0x34906, // srcset | ||
| 360 | 0x71: 0x26806, // hidden | ||
| 361 | 0x76: 0x1bb08, // colgroup | ||
| 362 | 0x78: 0x34f03, // svg | ||
| 363 | 0x7b: 0x2cb04, // mark | ||
| 364 | 0x7e: 0x33104, // lang | ||
| 365 | 0x81: 0x1cf04, // cols | ||
| 366 | 0x86: 0x5a07, // address | ||
| 367 | 0x8b: 0xf404, // main | ||
| 368 | 0x8c: 0x4302, // em | ||
| 369 | 0x8f: 0x32d08, // hreflang | ||
| 370 | 0x93: 0x1b307, // checked | ||
| 371 | 0x94: 0x25902, // h5 | ||
| 372 | 0x95: 0x301, // u | ||
| 373 | 0x96: 0x32705, // align | ||
| 374 | 0x97: 0x14301, // q | ||
| 375 | 0x99: 0xd506, // object | ||
| 376 | 0x9b: 0x28407, // content | ||
| 377 | 0x9d: 0xc809, // scrolling | ||
| 378 | 0x9f: 0x36407, // profile | ||
| 379 | 0xa0: 0x34903, // src | ||
| 380 | 0xa1: 0xda05, // tfoot | ||
| 381 | 0xa3: 0x2f705, // meter | ||
| 382 | 0xa4: 0x37705, // vocab | ||
| 383 | 0xa6: 0xd04, // body | ||
| 384 | 0xa8: 0x19204, // code | ||
| 385 | 0xac: 0x20108, // controls | ||
| 386 | 0xb0: 0x2ab05, // small | ||
| 387 | 0xb1: 0x18008, // disabled | ||
| 388 | 0xb5: 0x5604, // face | ||
| 389 | 0xb6: 0x501, // p | ||
| 390 | 0xb9: 0x2302, // li | ||
| 391 | 0xbb: 0xe409, // autofocus | ||
| 392 | 0xbf: 0x27304, // html | ||
| 393 | 0xc2: 0x4d08, // datatype | ||
| 394 | 0xc6: 0x35d06, // prefix | ||
| 395 | 0xcb: 0x35d03, // pre | ||
| 396 | 0xcc: 0x1106, // accept | ||
| 397 | 0xd1: 0x23b03, // for | ||
| 398 | 0xd5: 0x29e06, // strong | ||
| 399 | 0xd6: 0x9c07, // rowspan | ||
| 400 | 0xd7: 0x25502, // h3 | ||
| 401 | 0xd8: 0x2cf04, // math | ||
| 402 | 0xde: 0x16e07, // noshade | ||
| 403 | 0xdf: 0x19f05, // shape | ||
| 404 | 0xe1: 0x10006, // scoped | ||
| 405 | 0xe3: 0x706, // target | ||
| 406 | 0xe6: 0x21c0a, // figcaption | ||
| 407 | 0xe9: 0x1df04, // text | ||
| 408 | 0xea: 0x1c708, // resource | ||
| 409 | 0xec: 0xee03, // map | ||
| 410 | 0xf0: 0x29a06, // inlist | ||
| 411 | 0xf1: 0x16506, // select | ||
| 412 | 0xf2: 0x1f606, // keygen | ||
| 413 | 0xf3: 0x5106, // typeof | ||
| 414 | 0xf6: 0xb006, // canvas | ||
| 415 | 0xf7: 0x30f06, // option | ||
| 416 | 0xf8: 0xbe05, // label | ||
| 417 | 0xf9: 0xbc03, // rel | ||
| 418 | 0xfb: 0x1f04, // data | ||
| 419 | 0xfd: 0x6004, // samp | ||
| 420 | 0x100: 0x110e, // accept-charset | ||
| 421 | 0x101: 0xeb06, // usemap | ||
| 422 | 0x103: 0x2bc08, // manifest | ||
| 423 | 0x109: 0xa204, // name | ||
| 424 | 0x10a: 0x14806, // button | ||
| 425 | 0x10b: 0x2b05, // clear | ||
| 426 | 0x10e: 0x33907, // summary | ||
| 427 | 0x10f: 0x2e204, // meta | ||
| 428 | 0x110: 0x33108, // language | ||
| 429 | 0x112: 0x300a, // background | ||
| 430 | 0x113: 0x2707, // article | ||
| 431 | 0x116: 0x23b0a, // formaction | ||
| 432 | 0x119: 0x1, // a | ||
| 433 | 0x11b: 0x5, // about | ||
| 434 | 0x11c: 0xfc09, // itemscope | ||
| 435 | 0x11e: 0x14d08, // noscript | ||
| 436 | 0x11f: 0x15907, // classid | ||
| 437 | 0x120: 0x36203, // xmp | ||
| 438 | 0x121: 0x19604, // base | ||
| 439 | 0x123: 0x1c01, // s | ||
| 440 | 0x124: 0x36b07, // visible | ||
| 441 | 0x126: 0x37b02, // bb | ||
| 442 | 0x127: 0x9c04, // rows | ||
| 443 | 0x12d: 0x2450e, // formnovalidate | ||
| 444 | 0x131: 0x1f205, // track | ||
| 445 | 0x135: 0x18703, // div | ||
| 446 | 0x136: 0xac05, // async | ||
| 447 | 0x137: 0x31508, // property | ||
| 448 | 0x13a: 0x16c03, // dfn | ||
| 449 | 0x13e: 0xf605, // inert | ||
| 450 | 0x142: 0x10503, // del | ||
| 451 | 0x144: 0x25302, // h2 | ||
| 452 | 0x147: 0x2c205, // style | ||
| 453 | 0x149: 0x29703, // img | ||
| 454 | 0x14a: 0xc05, // tbody | ||
| 455 | 0x14b: 0x7603, // dir | ||
| 456 | 0x14c: 0x2eb05, // xmlns | ||
| 457 | 0x14e: 0x1f08, // datalist | ||
| 458 | 0x14f: 0x32d04, // href | ||
| 459 | 0x150: 0x1f202, // tr | ||
| 460 | 0x151: 0x13e0a, // blockquote | ||
| 461 | 0x152: 0x18909, // valuetype | ||
| 462 | 0x155: 0xdb06, // footer | ||
| 463 | 0x157: 0x14f06, // script | ||
| 464 | 0x158: 0x1cf07, // colspan | ||
| 465 | 0x15d: 0x1730e, // defaultChecked | ||
| 466 | 0x15f: 0x2490a, // novalidate | ||
| 467 | 0x164: 0x1a408, // codetype | ||
| 468 | 0x165: 0x2c506, // legend | ||
| 469 | 0x16b: 0x1160b, // pauseonexit | ||
| 470 | 0x16c: 0x21f07, // caption | ||
| 471 | 0x16f: 0x26c07, // enabled | ||
| 472 | 0x173: 0x26206, // poster | ||
| 473 | 0x175: 0x30a05, // muted | ||
| 474 | 0x176: 0x11205, // ismap | ||
| 475 | 0x178: 0x2a903, // ins | ||
| 476 | 0x17a: 0xe004, // ruby | ||
| 477 | 0x17b: 0x37c02, // br | ||
| 478 | 0x17c: 0x8a0f, // defaultSelected | ||
| 479 | 0x17d: 0x7403, // kbd | ||
| 480 | 0x17f: 0x1c906, // source | ||
| 481 | 0x182: 0x9f04, // span | ||
| 482 | 0x184: 0x2d803, // max | ||
| 483 | 0x18a: 0x5b02, // dd | ||
| 484 | 0x18b: 0x13a04, // size | ||
| 485 | 0x18c: 0xa405, // media | ||
| 486 | 0x18d: 0x19208, // codebase | ||
| 487 | 0x18f: 0x4905, // embed | ||
| 488 | 0x192: 0x5104, // type | ||
| 489 | 0x193: 0xf005, // param | ||
| 490 | 0x194: 0x25b02, // h6 | ||
| 491 | 0x197: 0x28304, // icon | ||
| 492 | 0x198: 0x12607, // bgcolor | ||
| 493 | 0x199: 0x2ad0f, // allowfullscreen | ||
| 494 | 0x19a: 0x12004, // time | ||
| 495 | 0x19b: 0x7803, // rev | ||
| 496 | 0x19d: 0x34208, // progress | ||
| 497 | 0x19e: 0x22606, // figure | ||
| 498 | 0x1a0: 0x6a02, // rp | ||
| 499 | 0x1a2: 0xa606, // dialog | ||
| 500 | 0x1a4: 0x2802, // rt | ||
| 501 | 0x1a7: 0x1e304, // area | ||
| 502 | 0x1a8: 0x7808, // reversed | ||
| 503 | 0x1aa: 0x32104, // open | ||
| 504 | 0x1ac: 0x2d204, // head | ||
| 505 | 0x1ad: 0x7005, // alink | ||
| 506 | 0x1af: 0x28003, // var | ||
| 507 | 0x1b0: 0x15f07, // details | ||
| 508 | 0x1b1: 0x2401, // i | ||
| 509 | 0x1b3: 0x1e02, // td | ||
| 510 | 0x1b4: 0xb707, // declare | ||
| 511 | 0x1b5: 0x8302, // ul | ||
| 512 | 0x1ba: 0x2fc06, // method | ||
| 513 | 0x1bd: 0x13007, // section | ||
| 514 | 0x1be: 0x22a08, // required | ||
| 515 | 0x1c2: 0x9805, // defer | ||
| 516 | 0x1c3: 0x37205, // vlink | ||
| 517 | 0x1c4: 0x15405, // title | ||
| 518 | 0x1c5: 0x2770a, // http-equiv | ||
| 519 | 0x1c6: 0x1fa07, // enctype | ||
| 520 | 0x1c7: 0x1ec07, // compact | ||
| 521 | 0x1c8: 0x2d809, // maxlength | ||
| 522 | 0x1c9: 0x16508, // selected | ||
| 523 | 0x1cc: 0xd105, // audio | ||
| 524 | 0x1cd: 0xc208, // longdesc | ||
| 525 | 0x1d1: 0xfb04, // cite | ||
| 526 | 0x1da: 0x2505, // start | ||
| 527 | 0x1de: 0x2d102, // th | ||
| 528 | 0x1df: 0x10808, // autoplay | ||
| 529 | 0x1e2: 0x7104, // link | ||
| 530 | 0x1e3: 0x206, // output | ||
| 531 | 0x1e5: 0x12204, // menu | ||
| 532 | 0x1e6: 0x2a405, // input | ||
| 533 | 0x1eb: 0x32403, // nav | ||
| 534 | 0x1ec: 0x31d03, // sub | ||
| 535 | 0x1ee: 0x1807, // charset | ||
| 536 | 0x1ef: 0x7f07, // default | ||
| 537 | 0x1f3: 0x2f205, // table | ||
| 538 | 0x1f4: 0x23b04, // form | ||
| 539 | 0x1f5: 0x23209, // truespeed | ||
| 540 | 0x1f6: 0x2f02, // rb | ||
| 541 | 0x1fb: 0x20b09, // translate | ||
| 542 | 0x1fd: 0x2e002, // h1 | ||
| 543 | } | ||
diff --git a/vendor/github.com/tdewolff/minify/v2/html/html.go b/vendor/github.com/tdewolff/minify/v2/html/html.go new file mode 100644 index 0000000..616a9ba --- /dev/null +++ b/vendor/github.com/tdewolff/minify/v2/html/html.go | |||
| @@ -0,0 +1,514 @@ | |||
| 1 | // Package html minifies HTML5 following the specifications at http://www.w3.org/TR/html5/syntax.html. | ||
| 2 | package html | ||
| 3 | |||
| 4 | import ( | ||
| 5 | "bytes" | ||
| 6 | "io" | ||
| 7 | |||
| 8 | "github.com/tdewolff/minify/v2" | ||
| 9 | "github.com/tdewolff/parse/v2" | ||
| 10 | "github.com/tdewolff/parse/v2/buffer" | ||
| 11 | "github.com/tdewolff/parse/v2/html" | ||
| 12 | ) | ||
| 13 | |||
| 14 | var ( | ||
| 15 | gtBytes = []byte(">") | ||
| 16 | isBytes = []byte("=") | ||
| 17 | spaceBytes = []byte(" ") | ||
| 18 | doctypeBytes = []byte("<!doctype html>") | ||
| 19 | jsMimeBytes = []byte("application/javascript") | ||
| 20 | cssMimeBytes = []byte("text/css") | ||
| 21 | htmlMimeBytes = []byte("text/html") | ||
| 22 | svgMimeBytes = []byte("image/svg+xml") | ||
| 23 | formMimeBytes = []byte("application/x-www-form-urlencoded") | ||
| 24 | mathMimeBytes = []byte("application/mathml+xml") | ||
| 25 | dataSchemeBytes = []byte("data:") | ||
| 26 | jsSchemeBytes = []byte("javascript:") | ||
| 27 | httpBytes = []byte("http") | ||
| 28 | radioBytes = []byte("radio") | ||
| 29 | onBytes = []byte("on") | ||
| 30 | textBytes = []byte("text") | ||
| 31 | noneBytes = []byte("none") | ||
| 32 | submitBytes = []byte("submit") | ||
| 33 | allBytes = []byte("all") | ||
| 34 | rectBytes = []byte("rect") | ||
| 35 | dataBytes = []byte("data") | ||
| 36 | getBytes = []byte("get") | ||
| 37 | autoBytes = []byte("auto") | ||
| 38 | oneBytes = []byte("one") | ||
| 39 | inlineParams = map[string]string{"inline": "1"} | ||
| 40 | ) | ||
| 41 | |||
| 42 | //////////////////////////////////////////////////////////////// | ||
| 43 | |||
| 44 | // Minifier is an HTML minifier. | ||
| 45 | type Minifier struct { | ||
| 46 | KeepComments bool | ||
| 47 | KeepConditionalComments bool | ||
| 48 | KeepDefaultAttrVals bool | ||
| 49 | KeepDocumentTags bool | ||
| 50 | KeepEndTags bool | ||
| 51 | KeepQuotes bool | ||
| 52 | KeepWhitespace bool | ||
| 53 | } | ||
| 54 | |||
| 55 | // Minify minifies HTML data, it reads from r and writes to w. | ||
| 56 | func Minify(m *minify.M, w io.Writer, r io.Reader, params map[string]string) error { | ||
| 57 | return (&Minifier{}).Minify(m, w, r, params) | ||
| 58 | } | ||
| 59 | |||
| 60 | // Minify minifies HTML data, it reads from r and writes to w. | ||
| 61 | func (o *Minifier) Minify(m *minify.M, w io.Writer, r io.Reader, _ map[string]string) error { | ||
| 62 | var rawTagHash Hash | ||
| 63 | var rawTagMediatype []byte | ||
| 64 | |||
| 65 | omitSpace := true // if true the next leading space is omitted | ||
| 66 | inPre := false | ||
| 67 | |||
| 68 | attrMinifyBuffer := buffer.NewWriter(make([]byte, 0, 64)) | ||
| 69 | attrByteBuffer := make([]byte, 0, 64) | ||
| 70 | |||
| 71 | z := parse.NewInput(r) | ||
| 72 | defer z.Restore() | ||
| 73 | |||
| 74 | l := html.NewLexer(z) | ||
| 75 | tb := NewTokenBuffer(z, l) | ||
| 76 | for { | ||
| 77 | t := *tb.Shift() | ||
| 78 | switch t.TokenType { | ||
| 79 | case html.ErrorToken: | ||
| 80 | if _, err := w.Write(nil); err != nil { | ||
| 81 | return err | ||
| 82 | } | ||
| 83 | if l.Err() == io.EOF { | ||
| 84 | return nil | ||
| 85 | } | ||
| 86 | return l.Err() | ||
| 87 | case html.DoctypeToken: | ||
| 88 | w.Write(doctypeBytes) | ||
| 89 | case html.CommentToken: | ||
| 90 | if o.KeepComments { | ||
| 91 | w.Write(t.Data) | ||
| 92 | } else if o.KeepConditionalComments && 6 < len(t.Text) && (bytes.HasPrefix(t.Text, []byte("[if ")) || bytes.HasSuffix(t.Text, []byte("[endif]")) || bytes.HasSuffix(t.Text, []byte("[endif]--"))) { | ||
| 93 | // [if ...] is always 7 or more characters, [endif] is only encountered for downlevel-revealed | ||
| 94 | // see https://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx#syntax | ||
| 95 | if bytes.HasPrefix(t.Data, []byte("<!--[if ")) && bytes.HasSuffix(t.Data, []byte("<![endif]-->")) { // downlevel-hidden | ||
| 96 | begin := bytes.IndexByte(t.Data, '>') + 1 | ||
| 97 | end := len(t.Data) - len("<![endif]-->") | ||
| 98 | w.Write(t.Data[:begin]) | ||
| 99 | if err := o.Minify(m, w, buffer.NewReader(t.Data[begin:end]), nil); err != nil { | ||
| 100 | return minify.UpdateErrorPosition(err, z, t.Offset) | ||
| 101 | } | ||
| 102 | w.Write(t.Data[end:]) | ||
| 103 | } else { | ||
| 104 | w.Write(t.Data) // downlevel-revealed or short downlevel-hidden | ||
| 105 | } | ||
| 106 | } else if 1 < len(t.Text) && t.Text[0] == '#' { | ||
| 107 | // SSI tags | ||
| 108 | w.Write(t.Data) | ||
| 109 | } | ||
| 110 | case html.SvgToken: | ||
| 111 | if err := m.MinifyMimetype(svgMimeBytes, w, buffer.NewReader(t.Data), nil); err != nil { | ||
| 112 | if err != minify.ErrNotExist { | ||
| 113 | return minify.UpdateErrorPosition(err, z, t.Offset) | ||
| 114 | } | ||
| 115 | w.Write(t.Data) | ||
| 116 | } | ||
| 117 | case html.MathToken: | ||
| 118 | if err := m.MinifyMimetype(mathMimeBytes, w, buffer.NewReader(t.Data), nil); err != nil { | ||
| 119 | if err != minify.ErrNotExist { | ||
| 120 | return minify.UpdateErrorPosition(err, z, t.Offset) | ||
| 121 | } | ||
| 122 | w.Write(t.Data) | ||
| 123 | } | ||
| 124 | case html.TextToken: | ||
| 125 | // CSS and JS minifiers for inline code | ||
| 126 | if rawTagHash != 0 { | ||
| 127 | if rawTagHash == Style || rawTagHash == Script || rawTagHash == Iframe { | ||
| 128 | var mimetype []byte | ||
| 129 | var params map[string]string | ||
| 130 | if rawTagHash == Iframe { | ||
| 131 | mimetype = htmlMimeBytes | ||
| 132 | } else if len(rawTagMediatype) > 0 { | ||
| 133 | mimetype, params = parse.Mediatype(rawTagMediatype) | ||
| 134 | } else if rawTagHash == Script { | ||
| 135 | mimetype = jsMimeBytes | ||
| 136 | } else if rawTagHash == Style { | ||
| 137 | mimetype = cssMimeBytes | ||
| 138 | } | ||
| 139 | if err := m.MinifyMimetype(mimetype, w, buffer.NewReader(t.Data), params); err != nil { | ||
| 140 | if err != minify.ErrNotExist { | ||
| 141 | return minify.UpdateErrorPosition(err, z, t.Offset) | ||
| 142 | } | ||
| 143 | w.Write(t.Data) | ||
| 144 | } | ||
| 145 | } else { | ||
| 146 | w.Write(t.Data) | ||
| 147 | } | ||
| 148 | } else if inPre { | ||
| 149 | w.Write(t.Data) | ||
| 150 | } else { | ||
| 151 | t.Data = parse.ReplaceMultipleWhitespaceAndEntities(t.Data, EntitiesMap, TextRevEntitiesMap) | ||
| 152 | |||
| 153 | // whitespace removal; trim left | ||
| 154 | if omitSpace && parse.IsWhitespace(t.Data[0]) { | ||
| 155 | t.Data = t.Data[1:] | ||
| 156 | } | ||
| 157 | |||
| 158 | // whitespace removal; trim right | ||
| 159 | omitSpace = false | ||
| 160 | if len(t.Data) == 0 { | ||
| 161 | omitSpace = true | ||
| 162 | } else if parse.IsWhitespace(t.Data[len(t.Data)-1]) { | ||
| 163 | omitSpace = true | ||
| 164 | i := 0 | ||
| 165 | for { | ||
| 166 | next := tb.Peek(i) | ||
| 167 | // trim if EOF, text token with leading whitespace or block token | ||
| 168 | if next.TokenType == html.ErrorToken { | ||
| 169 | t.Data = t.Data[:len(t.Data)-1] | ||
| 170 | omitSpace = false | ||
| 171 | break | ||
| 172 | } else if next.TokenType == html.TextToken { | ||
| 173 | // this only happens when a comment, doctype or phrasing end tag (only for !o.KeepWhitespace) was in between | ||
| 174 | // remove if the text token starts with a whitespace | ||
| 175 | if len(next.Data) > 0 && parse.IsWhitespace(next.Data[0]) { | ||
| 176 | t.Data = t.Data[:len(t.Data)-1] | ||
| 177 | omitSpace = false | ||
| 178 | } | ||
| 179 | break | ||
| 180 | } else if next.TokenType == html.StartTagToken || next.TokenType == html.EndTagToken { | ||
| 181 | if o.KeepWhitespace { | ||
| 182 | break | ||
| 183 | } | ||
| 184 | // remove when followed up by a block tag | ||
| 185 | if next.Traits&nonPhrasingTag != 0 { | ||
| 186 | t.Data = t.Data[:len(t.Data)-1] | ||
| 187 | omitSpace = false | ||
| 188 | break | ||
| 189 | } else if next.TokenType == html.StartTagToken { | ||
| 190 | break | ||
| 191 | } | ||
| 192 | } | ||
| 193 | i++ | ||
| 194 | } | ||
| 195 | } | ||
| 196 | |||
| 197 | w.Write(t.Data) | ||
| 198 | } | ||
| 199 | case html.StartTagToken, html.EndTagToken: | ||
| 200 | rawTagHash = 0 | ||
| 201 | hasAttributes := false | ||
| 202 | if t.TokenType == html.StartTagToken { | ||
| 203 | if next := tb.Peek(0); next.TokenType == html.AttributeToken { | ||
| 204 | hasAttributes = true | ||
| 205 | } | ||
| 206 | if t.Traits&rawTag != 0 { | ||
| 207 | // ignore empty script and style tags | ||
| 208 | if !hasAttributes && (t.Hash == Script || t.Hash == Style) { | ||
| 209 | if next := tb.Peek(1); next.TokenType == html.EndTagToken { | ||
| 210 | tb.Shift() | ||
| 211 | tb.Shift() | ||
| 212 | break | ||
| 213 | } | ||
| 214 | } | ||
| 215 | rawTagHash = t.Hash | ||
| 216 | rawTagMediatype = nil | ||
| 217 | |||
| 218 | // do not minify content of <style amp-boilerplate> | ||
| 219 | if hasAttributes && t.Hash == Style { | ||
| 220 | if attrs := tb.Attributes(Amp_Boilerplate); attrs[0] != nil { | ||
| 221 | rawTagHash = 0 | ||
| 222 | } | ||
| 223 | } | ||
| 224 | } | ||
| 225 | } else if t.Hash == Template { | ||
| 226 | omitSpace = true // EndTagToken | ||
| 227 | } | ||
| 228 | |||
| 229 | if t.Hash == Pre { | ||
| 230 | inPre = t.TokenType == html.StartTagToken | ||
| 231 | } | ||
| 232 | |||
| 233 | // remove superfluous tags, except for html, head and body tags when KeepDocumentTags is set | ||
| 234 | if !hasAttributes && (!o.KeepDocumentTags && (t.Hash == Html || t.Hash == Head || t.Hash == Body) || t.Hash == Colgroup) { | ||
| 235 | break | ||
| 236 | } else if t.TokenType == html.EndTagToken { | ||
| 237 | omitEndTag := false | ||
| 238 | if !o.KeepEndTags { | ||
| 239 | if t.Hash == Thead || t.Hash == Tbody || t.Hash == Tfoot || t.Hash == Tr || t.Hash == Th || | ||
| 240 | t.Hash == Td || t.Hash == Option || t.Hash == Dd || t.Hash == Dt || t.Hash == Li || | ||
| 241 | t.Hash == Rb || t.Hash == Rt || t.Hash == Rtc || t.Hash == Rp { | ||
| 242 | omitEndTag = true // omit end tags | ||
| 243 | } else if t.Hash == P { | ||
| 244 | i := 0 | ||
| 245 | for { | ||
| 246 | next := tb.Peek(i) | ||
| 247 | i++ | ||
| 248 | // continue if text token is empty or whitespace | ||
| 249 | if next.TokenType == html.TextToken && parse.IsAllWhitespace(next.Data) { | ||
| 250 | continue | ||
| 251 | } | ||
| 252 | if next.TokenType == html.ErrorToken || next.TokenType == html.EndTagToken && next.Traits&keepPTag == 0 || next.TokenType == html.StartTagToken && next.Traits&omitPTag != 0 { | ||
| 253 | omitEndTag = true // omit p end tag | ||
| 254 | } | ||
| 255 | break | ||
| 256 | } | ||
| 257 | } else if t.Hash == Optgroup { | ||
| 258 | i := 0 | ||
| 259 | for { | ||
| 260 | next := tb.Peek(i) | ||
| 261 | i++ | ||
| 262 | // continue if text token | ||
| 263 | if next.TokenType == html.TextToken { | ||
| 264 | continue | ||
| 265 | } | ||
| 266 | if next.TokenType == html.ErrorToken || next.Hash != Option { | ||
| 267 | omitEndTag = true // omit optgroup end tag | ||
| 268 | } | ||
| 269 | break | ||
| 270 | } | ||
| 271 | } | ||
| 272 | } | ||
| 273 | |||
| 274 | if t.Traits&nonPhrasingTag != 0 { | ||
| 275 | omitSpace = true // omit spaces after block elements | ||
| 276 | } else if o.KeepWhitespace || t.Traits&objectTag != 0 { | ||
| 277 | omitSpace = false | ||
| 278 | } | ||
| 279 | |||
| 280 | if !omitEndTag { | ||
| 281 | if len(t.Data) > 3+len(t.Text) { | ||
| 282 | t.Data[2+len(t.Text)] = '>' | ||
| 283 | t.Data = t.Data[:3+len(t.Text)] | ||
| 284 | } | ||
| 285 | w.Write(t.Data) | ||
| 286 | } | ||
| 287 | |||
| 288 | // skip text in select and optgroup tags | ||
| 289 | if t.Hash == Option || t.Hash == Optgroup { | ||
| 290 | if next := tb.Peek(0); next.TokenType == html.TextToken { | ||
| 291 | tb.Shift() | ||
| 292 | } | ||
| 293 | } | ||
| 294 | break | ||
| 295 | } | ||
| 296 | |||
| 297 | if o.KeepWhitespace || t.Traits&objectTag != 0 { | ||
| 298 | omitSpace = false | ||
| 299 | } else if t.Traits&nonPhrasingTag != 0 { | ||
| 300 | omitSpace = true // omit spaces after block elements | ||
| 301 | } | ||
| 302 | |||
| 303 | w.Write(t.Data) | ||
| 304 | |||
| 305 | if hasAttributes { | ||
| 306 | if t.Hash == Meta { | ||
| 307 | attrs := tb.Attributes(Content, Http_Equiv, Charset, Name) | ||
| 308 | if content := attrs[0]; content != nil { | ||
| 309 | if httpEquiv := attrs[1]; httpEquiv != nil { | ||
| 310 | httpEquiv.AttrVal = parse.TrimWhitespace(httpEquiv.AttrVal) | ||
| 311 | if charset := attrs[2]; charset == nil && parse.EqualFold(httpEquiv.AttrVal, []byte("content-type")) { | ||
| 312 | content.AttrVal = minify.Mediatype(content.AttrVal) | ||
| 313 | if bytes.Equal(content.AttrVal, []byte("text/html;charset=utf-8")) { | ||
| 314 | httpEquiv.Text = nil | ||
| 315 | content.Text = []byte("charset") | ||
| 316 | content.Hash = Charset | ||
| 317 | content.AttrVal = []byte("utf-8") | ||
| 318 | } | ||
| 319 | } | ||
| 320 | } | ||
| 321 | if name := attrs[3]; name != nil { | ||
| 322 | name.AttrVal = parse.TrimWhitespace(name.AttrVal) | ||
| 323 | if parse.EqualFold(name.AttrVal, []byte("keywords")) { | ||
| 324 | content.AttrVal = bytes.ReplaceAll(content.AttrVal, []byte(", "), []byte(",")) | ||
| 325 | } else if parse.EqualFold(name.AttrVal, []byte("viewport")) { | ||
| 326 | content.AttrVal = bytes.ReplaceAll(content.AttrVal, []byte(" "), []byte("")) | ||
| 327 | for i := 0; i < len(content.AttrVal); i++ { | ||
| 328 | if content.AttrVal[i] == '=' && i+2 < len(content.AttrVal) { | ||
| 329 | i++ | ||
| 330 | if n := parse.Number(content.AttrVal[i:]); n > 0 { | ||
| 331 | minNum := minify.Number(content.AttrVal[i:i+n], -1) | ||
| 332 | if len(minNum) < n { | ||
| 333 | copy(content.AttrVal[i:i+len(minNum)], minNum) | ||
| 334 | copy(content.AttrVal[i+len(minNum):], content.AttrVal[i+n:]) | ||
| 335 | content.AttrVal = content.AttrVal[:len(content.AttrVal)+len(minNum)-n] | ||
| 336 | } | ||
| 337 | i += len(minNum) | ||
| 338 | } | ||
| 339 | i-- // mitigate for-loop increase | ||
| 340 | } | ||
| 341 | } | ||
| 342 | } | ||
| 343 | } | ||
| 344 | } | ||
| 345 | } else if t.Hash == Script { | ||
| 346 | attrs := tb.Attributes(Src, Charset) | ||
| 347 | if attrs[0] != nil && attrs[1] != nil { | ||
| 348 | attrs[1].Text = nil | ||
| 349 | } | ||
| 350 | } else if t.Hash == Input { | ||
| 351 | attrs := tb.Attributes(Type, Value) | ||
| 352 | if t, value := attrs[0], attrs[1]; t != nil && value != nil { | ||
| 353 | isRadio := parse.EqualFold(t.AttrVal, radioBytes) | ||
| 354 | if !isRadio && len(value.AttrVal) == 0 { | ||
| 355 | value.Text = nil | ||
| 356 | } else if isRadio && parse.EqualFold(value.AttrVal, onBytes) { | ||
| 357 | value.Text = nil | ||
| 358 | } | ||
| 359 | } | ||
| 360 | } else if t.Hash == A { | ||
| 361 | attrs := tb.Attributes(Id, Name) | ||
| 362 | if id, name := attrs[0], attrs[1]; id != nil && name != nil { | ||
| 363 | if bytes.Equal(id.AttrVal, name.AttrVal) { | ||
| 364 | name.Text = nil | ||
| 365 | } | ||
| 366 | } | ||
| 367 | } | ||
| 368 | |||
| 369 | // write attributes | ||
| 370 | for { | ||
| 371 | attr := *tb.Shift() | ||
| 372 | if attr.TokenType != html.AttributeToken { | ||
| 373 | break | ||
| 374 | } else if attr.Text == nil { | ||
| 375 | continue // removed attribute | ||
| 376 | } | ||
| 377 | |||
| 378 | val := attr.AttrVal | ||
| 379 | if attr.Traits&trimAttr != 0 { | ||
| 380 | val = parse.ReplaceMultipleWhitespaceAndEntities(val, EntitiesMap, nil) | ||
| 381 | val = parse.TrimWhitespace(val) | ||
| 382 | } else { | ||
| 383 | val = parse.ReplaceEntities(val, EntitiesMap, nil) | ||
| 384 | } | ||
| 385 | if t.Traits != 0 { | ||
| 386 | if len(val) == 0 && (attr.Hash == Class || | ||
| 387 | attr.Hash == Dir || | ||
| 388 | attr.Hash == Id || | ||
| 389 | attr.Hash == Name || | ||
| 390 | attr.Hash == Action && t.Hash == Form) { | ||
| 391 | continue // omit empty attribute values | ||
| 392 | } | ||
| 393 | if attr.Traits&caselessAttr != 0 { | ||
| 394 | val = parse.ToLower(val) | ||
| 395 | } | ||
| 396 | if rawTagHash != 0 && attr.Hash == Type { | ||
| 397 | rawTagMediatype = parse.Copy(val) | ||
| 398 | } | ||
| 399 | |||
| 400 | if attr.Hash == Enctype || attr.Hash == Codetype || attr.Hash == Accept || attr.Hash == Type && (t.Hash == A || t.Hash == Link || t.Hash == Embed || t.Hash == Object || t.Hash == Source || t.Hash == Script || t.Hash == Style) { | ||
| 401 | val = minify.Mediatype(val) | ||
| 402 | } | ||
| 403 | |||
| 404 | // default attribute values can be omitted | ||
| 405 | if !o.KeepDefaultAttrVals && (attr.Hash == Type && (t.Hash == Script && jsMimetypes[string(val)] || | ||
| 406 | t.Hash == Style && bytes.Equal(val, cssMimeBytes) || | ||
| 407 | t.Hash == Link && bytes.Equal(val, cssMimeBytes) || | ||
| 408 | t.Hash == Input && bytes.Equal(val, textBytes) || | ||
| 409 | t.Hash == Button && bytes.Equal(val, submitBytes)) || | ||
| 410 | attr.Hash == Language && t.Hash == Script || | ||
| 411 | attr.Hash == Method && bytes.Equal(val, getBytes) || | ||
| 412 | attr.Hash == Enctype && bytes.Equal(val, formMimeBytes) || | ||
| 413 | attr.Hash == Colspan && bytes.Equal(val, oneBytes) || | ||
| 414 | attr.Hash == Rowspan && bytes.Equal(val, oneBytes) || | ||
| 415 | attr.Hash == Shape && bytes.Equal(val, rectBytes) || | ||
| 416 | attr.Hash == Span && bytes.Equal(val, oneBytes) || | ||
| 417 | attr.Hash == Clear && bytes.Equal(val, noneBytes) || | ||
| 418 | attr.Hash == Frameborder && bytes.Equal(val, oneBytes) || | ||
| 419 | attr.Hash == Scrolling && bytes.Equal(val, autoBytes) || | ||
| 420 | attr.Hash == Valuetype && bytes.Equal(val, dataBytes) || | ||
| 421 | attr.Hash == Media && t.Hash == Style && bytes.Equal(val, allBytes)) { | ||
| 422 | continue | ||
| 423 | } | ||
| 424 | |||
| 425 | if attr.Hash == Style { | ||
| 426 | // CSS minifier for attribute inline code | ||
| 427 | val = parse.TrimWhitespace(val) | ||
| 428 | attrMinifyBuffer.Reset() | ||
| 429 | if err := m.MinifyMimetype(cssMimeBytes, attrMinifyBuffer, buffer.NewReader(val), inlineParams); err == nil { | ||
| 430 | val = attrMinifyBuffer.Bytes() | ||
| 431 | } else if err != minify.ErrNotExist { | ||
| 432 | return minify.UpdateErrorPosition(err, z, attr.Offset) | ||
| 433 | } | ||
| 434 | if len(val) == 0 { | ||
| 435 | continue | ||
| 436 | } | ||
| 437 | } else if len(attr.Text) > 2 && attr.Text[0] == 'o' && attr.Text[1] == 'n' { | ||
| 438 | // JS minifier for attribute inline code | ||
| 439 | val = parse.TrimWhitespace(val) | ||
| 440 | if len(val) >= 11 && parse.EqualFold(val[:11], jsSchemeBytes) { | ||
| 441 | val = val[11:] | ||
| 442 | } | ||
| 443 | attrMinifyBuffer.Reset() | ||
| 444 | if err := m.MinifyMimetype(jsMimeBytes, attrMinifyBuffer, buffer.NewReader(val), nil); err == nil { | ||
| 445 | val = attrMinifyBuffer.Bytes() | ||
| 446 | } else if err != minify.ErrNotExist { | ||
| 447 | return minify.UpdateErrorPosition(err, z, attr.Offset) | ||
| 448 | } | ||
| 449 | if len(val) == 0 { | ||
| 450 | continue | ||
| 451 | } | ||
| 452 | } else if attr.Traits&urlAttr != 0 { // anchors are already handled | ||
| 453 | val = parse.TrimWhitespace(val) | ||
| 454 | if 5 < len(val) { | ||
| 455 | if parse.EqualFold(val[:4], httpBytes) { | ||
| 456 | if val[4] == ':' { | ||
| 457 | if m.URL != nil && m.URL.Scheme == "http" { | ||
| 458 | val = val[5:] | ||
| 459 | } else { | ||
| 460 | parse.ToLower(val[:4]) | ||
| 461 | } | ||
| 462 | } else if (val[4] == 's' || val[4] == 'S') && val[5] == ':' { | ||
| 463 | if m.URL != nil && m.URL.Scheme == "https" { | ||
| 464 | val = val[6:] | ||
| 465 | } else { | ||
| 466 | parse.ToLower(val[:5]) | ||
| 467 | } | ||
| 468 | } | ||
| 469 | } else if parse.EqualFold(val[:5], dataSchemeBytes) { | ||
| 470 | val = minify.DataURI(m, val) | ||
| 471 | } | ||
| 472 | } | ||
| 473 | } | ||
| 474 | } | ||
| 475 | |||
| 476 | w.Write(spaceBytes) | ||
| 477 | w.Write(attr.Text) | ||
| 478 | if len(val) > 0 && attr.Traits&booleanAttr == 0 { | ||
| 479 | w.Write(isBytes) | ||
| 480 | |||
| 481 | // use double quotes for RDFa attributes | ||
| 482 | isXML := attr.Hash == Vocab || attr.Hash == Typeof || attr.Hash == Property || attr.Hash == Resource || attr.Hash == Prefix || attr.Hash == Content || attr.Hash == About || attr.Hash == Rev || attr.Hash == Datatype || attr.Hash == Inlist | ||
| 483 | |||
| 484 | // no quotes if possible, else prefer single or double depending on which occurs more often in value | ||
| 485 | var quote byte | ||
| 486 | |||
| 487 | if 0 < len(attr.Data) && (attr.Data[len(attr.Data)-1] == '\'' || attr.Data[len(attr.Data)-1] == '"') { | ||
| 488 | quote = attr.Data[len(attr.Data)-1] | ||
| 489 | } | ||
| 490 | val = html.EscapeAttrVal(&attrByteBuffer, val, quote, o.KeepQuotes, isXML) | ||
| 491 | w.Write(val) | ||
| 492 | } | ||
| 493 | } | ||
| 494 | } else { | ||
| 495 | _ = tb.Shift() // StartTagClose | ||
| 496 | } | ||
| 497 | w.Write(gtBytes) | ||
| 498 | |||
| 499 | // skip text in select and optgroup tags | ||
| 500 | if t.Hash == Select || t.Hash == Optgroup { | ||
| 501 | if next := tb.Peek(0); next.TokenType == html.TextToken { | ||
| 502 | tb.Shift() | ||
| 503 | } | ||
| 504 | } | ||
| 505 | |||
| 506 | // keep space after phrasing tags (<i>, <span>, ...) FontAwesome etc. | ||
| 507 | if t.TokenType == html.StartTagToken && t.Traits&nonPhrasingTag == 0 { | ||
| 508 | if next := tb.Peek(0); next.Hash == t.Hash && next.TokenType == html.EndTagToken { | ||
| 509 | omitSpace = false | ||
| 510 | } | ||
| 511 | } | ||
| 512 | } | ||
| 513 | } | ||
| 514 | } | ||
diff --git a/vendor/github.com/tdewolff/minify/v2/html/table.go b/vendor/github.com/tdewolff/minify/v2/html/table.go new file mode 100644 index 0000000..22239fc --- /dev/null +++ b/vendor/github.com/tdewolff/minify/v2/html/table.go | |||
| @@ -0,0 +1,1346 @@ | |||
| 1 | package html | ||
| 2 | |||
| 3 | type traits uint16 | ||
| 4 | |||
| 5 | const ( | ||
| 6 | normalTag traits = 1 << iota | ||
| 7 | rawTag // raw tags need special processing for their content | ||
| 8 | nonPhrasingTag // non-phrasing elements are unaffected by whitespace, remove spaces around these tags | ||
| 9 | objectTag // content tags with a few exclusions, keep spaces after these open/close tags | ||
| 10 | omitPTag // omit p end tag if it is followed by this start tag | ||
| 11 | keepPTag // keep p end tag if it is followed by this end tag | ||
| 12 | ) | ||
| 13 | |||
| 14 | const ( | ||
| 15 | booleanAttr traits = 1 << iota | ||
| 16 | caselessAttr | ||
| 17 | urlAttr | ||
| 18 | trimAttr | ||
| 19 | ) | ||
| 20 | |||
| 21 | var tagMap = map[Hash]traits{ | ||
| 22 | A: keepPTag, | ||
| 23 | Abbr: normalTag, | ||
| 24 | Address: nonPhrasingTag | omitPTag, | ||
| 25 | Area: normalTag, | ||
| 26 | Article: nonPhrasingTag | omitPTag, | ||
| 27 | Aside: nonPhrasingTag | omitPTag, | ||
| 28 | Audio: keepPTag, | ||
| 29 | B: normalTag, | ||
| 30 | Base: normalTag, | ||
| 31 | Bb: normalTag, | ||
| 32 | Bdi: normalTag, | ||
| 33 | Bdo: normalTag, | ||
| 34 | Blockquote: nonPhrasingTag | omitPTag, | ||
| 35 | Body: nonPhrasingTag, | ||
| 36 | Br: nonPhrasingTag, | ||
| 37 | Button: objectTag, | ||
| 38 | Canvas: objectTag | keepPTag, | ||
| 39 | Caption: nonPhrasingTag, | ||
| 40 | Cite: normalTag, | ||
| 41 | Code: normalTag, | ||
| 42 | Col: nonPhrasingTag, | ||
| 43 | Colgroup: nonPhrasingTag, | ||
| 44 | Data: normalTag, | ||
| 45 | Datalist: normalTag, | ||
| 46 | Dd: nonPhrasingTag, | ||
| 47 | Del: keepPTag, | ||
| 48 | Details: omitPTag, | ||
| 49 | Dfn: normalTag, | ||
| 50 | Dialog: normalTag, | ||
| 51 | Div: nonPhrasingTag | omitPTag, | ||
| 52 | Dl: nonPhrasingTag | omitPTag, | ||
| 53 | Dt: nonPhrasingTag, | ||
| 54 | Em: normalTag, | ||
| 55 | Embed: nonPhrasingTag, | ||
| 56 | Fieldset: nonPhrasingTag | omitPTag, | ||
| 57 | Figcaption: nonPhrasingTag | omitPTag, | ||
| 58 | Figure: nonPhrasingTag | omitPTag, | ||
| 59 | Footer: nonPhrasingTag | omitPTag, | ||
| 60 | Form: nonPhrasingTag | omitPTag, | ||
| 61 | H1: nonPhrasingTag | omitPTag, | ||
| 62 | H2: nonPhrasingTag | omitPTag, | ||
| 63 | H3: nonPhrasingTag | omitPTag, | ||
| 64 | H4: nonPhrasingTag | omitPTag, | ||
| 65 | H5: nonPhrasingTag | omitPTag, | ||
| 66 | H6: nonPhrasingTag | omitPTag, | ||
| 67 | Head: nonPhrasingTag, | ||
| 68 | Header: nonPhrasingTag | omitPTag, | ||
| 69 | Hgroup: nonPhrasingTag, | ||
| 70 | Hr: nonPhrasingTag | omitPTag, | ||
| 71 | Html: nonPhrasingTag, | ||
| 72 | I: normalTag, | ||
| 73 | Iframe: rawTag | objectTag, | ||
| 74 | Img: objectTag, | ||
| 75 | Input: objectTag, | ||
| 76 | Ins: keepPTag, | ||
| 77 | Kbd: normalTag, | ||
| 78 | Label: normalTag, | ||
| 79 | Legend: normalTag, | ||
| 80 | Li: nonPhrasingTag, | ||
| 81 | Link: normalTag, | ||
| 82 | Main: nonPhrasingTag | omitPTag, | ||
| 83 | Map: keepPTag, | ||
| 84 | Mark: normalTag, | ||
| 85 | Math: rawTag, | ||
| 86 | Menu: omitPTag, | ||
| 87 | Meta: nonPhrasingTag, | ||
| 88 | Meter: objectTag, | ||
| 89 | Nav: nonPhrasingTag | omitPTag, | ||
| 90 | Noscript: nonPhrasingTag | keepPTag, | ||
| 91 | Object: objectTag, | ||
| 92 | Ol: nonPhrasingTag | omitPTag, | ||
| 93 | Optgroup: normalTag, | ||
| 94 | Option: normalTag, | ||
| 95 | Output: nonPhrasingTag, | ||
| 96 | P: nonPhrasingTag | omitPTag, | ||
| 97 | Param: normalTag, | ||
| 98 | Picture: normalTag, | ||
| 99 | Pre: nonPhrasingTag | omitPTag, | ||
| 100 | Progress: objectTag, | ||
| 101 | Q: objectTag, | ||
| 102 | Rp: normalTag, | ||
| 103 | Rt: normalTag, | ||
| 104 | Ruby: normalTag, | ||
| 105 | S: normalTag, | ||
| 106 | Samp: normalTag, | ||
| 107 | Script: rawTag, | ||
| 108 | Section: nonPhrasingTag | omitPTag, | ||
| 109 | Select: objectTag, | ||
| 110 | Slot: normalTag, | ||
| 111 | Small: normalTag, | ||
| 112 | Source: normalTag, | ||
| 113 | Span: normalTag, | ||
| 114 | Strong: normalTag, | ||
| 115 | Style: rawTag | nonPhrasingTag, | ||
| 116 | Sub: normalTag, | ||
| 117 | Summary: normalTag, | ||
| 118 | Sup: normalTag, | ||
| 119 | Svg: rawTag | objectTag, | ||
| 120 | Table: nonPhrasingTag | omitPTag, | ||
| 121 | Tbody: nonPhrasingTag, | ||
| 122 | Td: nonPhrasingTag, | ||
| 123 | Template: normalTag, | ||
| 124 | Textarea: rawTag | objectTag, | ||
| 125 | Tfoot: nonPhrasingTag, | ||
| 126 | Th: nonPhrasingTag, | ||
| 127 | Thead: nonPhrasingTag, | ||
| 128 | Time: normalTag, | ||
| 129 | Title: nonPhrasingTag, | ||
| 130 | Tr: nonPhrasingTag, | ||
| 131 | Track: normalTag, | ||
| 132 | U: normalTag, | ||
| 133 | Ul: nonPhrasingTag | omitPTag, | ||
| 134 | Var: normalTag, | ||
| 135 | Video: objectTag | keepPTag, | ||
| 136 | Wbr: normalTag, | ||
| 137 | } | ||
| 138 | |||
| 139 | var attrMap = map[Hash]traits{ | ||
| 140 | Accept: trimAttr, | ||
| 141 | Accept_Charset: caselessAttr, | ||
| 142 | Action: urlAttr, | ||
| 143 | Align: caselessAttr, | ||
| 144 | Alink: caselessAttr, | ||
| 145 | Allowfullscreen: booleanAttr, | ||
| 146 | Async: booleanAttr, | ||
| 147 | Autofocus: booleanAttr, | ||
| 148 | Autoplay: booleanAttr, | ||
| 149 | Axis: caselessAttr, | ||
| 150 | Background: urlAttr, | ||
| 151 | Bgcolor: caselessAttr, | ||
| 152 | Charset: caselessAttr, | ||
| 153 | Checked: booleanAttr, | ||
| 154 | Cite: urlAttr, | ||
| 155 | Class: trimAttr, | ||
| 156 | Classid: urlAttr, | ||
| 157 | Clear: caselessAttr, | ||
| 158 | Codebase: urlAttr, | ||
| 159 | Codetype: trimAttr, | ||
| 160 | Color: caselessAttr, | ||
| 161 | Cols: trimAttr, | ||
| 162 | Colspan: trimAttr, | ||
| 163 | Compact: booleanAttr, | ||
| 164 | Controls: booleanAttr, | ||
| 165 | Data: urlAttr, | ||
| 166 | Declare: booleanAttr, | ||
| 167 | Default: booleanAttr, | ||
| 168 | DefaultChecked: booleanAttr, | ||
| 169 | DefaultMuted: booleanAttr, | ||
| 170 | DefaultSelected: booleanAttr, | ||
| 171 | Defer: booleanAttr, | ||
| 172 | Dir: caselessAttr, | ||
| 173 | Disabled: booleanAttr, | ||
| 174 | Enabled: booleanAttr, | ||
| 175 | Enctype: trimAttr, | ||
| 176 | Face: caselessAttr, | ||
| 177 | Formaction: urlAttr, | ||
| 178 | Formnovalidate: booleanAttr, | ||
| 179 | Frame: caselessAttr, | ||
| 180 | Hidden: booleanAttr, | ||
| 181 | Href: urlAttr, | ||
| 182 | Hreflang: caselessAttr, | ||
| 183 | Http_Equiv: caselessAttr, | ||
| 184 | Icon: urlAttr, | ||
| 185 | Inert: booleanAttr, | ||
| 186 | Ismap: booleanAttr, | ||
| 187 | Itemscope: booleanAttr, | ||
| 188 | Lang: trimAttr, | ||
| 189 | Language: caselessAttr, | ||
| 190 | Link: caselessAttr, | ||
| 191 | Longdesc: urlAttr, | ||
| 192 | Manifest: urlAttr, | ||
| 193 | Maxlength: trimAttr, | ||
| 194 | Media: caselessAttr | trimAttr, | ||
| 195 | Method: caselessAttr, | ||
| 196 | Multiple: booleanAttr, | ||
| 197 | Muted: booleanAttr, | ||
| 198 | Nohref: booleanAttr, | ||
| 199 | Noresize: booleanAttr, | ||
| 200 | Noshade: booleanAttr, | ||
| 201 | Novalidate: booleanAttr, | ||
| 202 | Nowrap: booleanAttr, | ||
| 203 | Open: booleanAttr, | ||
| 204 | Pauseonexit: booleanAttr, | ||
| 205 | Poster: urlAttr, | ||
| 206 | Profile: urlAttr, | ||
| 207 | Readonly: booleanAttr, | ||
| 208 | Rel: caselessAttr | trimAttr, | ||
| 209 | Required: booleanAttr, | ||
| 210 | Rev: caselessAttr, | ||
| 211 | Reversed: booleanAttr, | ||
| 212 | Rows: trimAttr, | ||
| 213 | Rowspan: trimAttr, | ||
| 214 | Rules: caselessAttr, | ||
| 215 | Scope: caselessAttr, | ||
| 216 | Scoped: booleanAttr, | ||
| 217 | Scrolling: caselessAttr, | ||
| 218 | Seamless: booleanAttr, | ||
| 219 | Selected: booleanAttr, | ||
| 220 | Shape: caselessAttr, | ||
| 221 | Size: trimAttr, | ||
| 222 | Sortable: booleanAttr, | ||
| 223 | Span: trimAttr, | ||
| 224 | Src: urlAttr, | ||
| 225 | Srcset: trimAttr, | ||
| 226 | Tabindex: trimAttr, | ||
| 227 | Target: caselessAttr, | ||
| 228 | Text: caselessAttr, | ||
| 229 | Translate: caselessAttr, | ||
| 230 | Truespeed: booleanAttr, | ||
| 231 | Type: trimAttr, | ||
| 232 | Typemustmatch: booleanAttr, | ||
| 233 | Undeterminate: booleanAttr, | ||
| 234 | Usemap: urlAttr, | ||
| 235 | Valign: caselessAttr, | ||
| 236 | Valuetype: caselessAttr, | ||
| 237 | Vlink: caselessAttr, | ||
| 238 | Visible: booleanAttr, | ||
| 239 | Xmlns: urlAttr, | ||
| 240 | } | ||
| 241 | |||
| 242 | var jsMimetypes = map[string]bool{ | ||
| 243 | "text/javascript": true, | ||
| 244 | "application/javascript": true, | ||
| 245 | } | ||
| 246 | |||
| 247 | // EntitiesMap are all named character entities. | ||
| 248 | var EntitiesMap = map[string][]byte{ | ||
| 249 | "AElig": []byte("Æ"), | ||
| 250 | "AMP": []byte("&"), | ||
| 251 | "Aacute": []byte("Á"), | ||
| 252 | "Abreve": []byte("Ă"), | ||
| 253 | "Acirc": []byte("Â"), | ||
| 254 | "Agrave": []byte("À"), | ||
| 255 | "Alpha": []byte("Α"), | ||
| 256 | "Amacr": []byte("Ā"), | ||
| 257 | "Aogon": []byte("Ą"), | ||
| 258 | "ApplyFunction": []byte("⁡"), | ||
| 259 | "Aring": []byte("Å"), | ||
| 260 | "Assign": []byte("≔"), | ||
| 261 | "Atilde": []byte("Ã"), | ||
| 262 | "Backslash": []byte("∖"), | ||
| 263 | "Barwed": []byte("⌆"), | ||
| 264 | "Because": []byte("∵"), | ||
| 265 | "Bernoullis": []byte("ℬ"), | ||
| 266 | "Breve": []byte("˘"), | ||
| 267 | "Bumpeq": []byte("≎"), | ||
| 268 | "Cacute": []byte("Ć"), | ||
| 269 | "CapitalDifferentialD": []byte("ⅅ"), | ||
| 270 | "Cayleys": []byte("ℭ"), | ||
| 271 | "Ccaron": []byte("Č"), | ||
| 272 | "Ccedil": []byte("Ç"), | ||
| 273 | "Ccirc": []byte("Ĉ"), | ||
| 274 | "Cconint": []byte("∰"), | ||
| 275 | "Cedilla": []byte("¸"), | ||
| 276 | "CenterDot": []byte("·"), | ||
| 277 | "CircleDot": []byte("⊙"), | ||
| 278 | "CircleMinus": []byte("⊖"), | ||
| 279 | "CirclePlus": []byte("⊕"), | ||
| 280 | "CircleTimes": []byte("⊗"), | ||
| 281 | "ClockwiseContourIntegral": []byte("∲"), | ||
| 282 | "CloseCurlyDoubleQuote": []byte("”"), | ||
| 283 | "CloseCurlyQuote": []byte("’"), | ||
| 284 | "Congruent": []byte("≡"), | ||
| 285 | "Conint": []byte("∯"), | ||
| 286 | "ContourIntegral": []byte("∮"), | ||
| 287 | "Coproduct": []byte("∐"), | ||
| 288 | "CounterClockwiseContourIntegral": []byte("∳"), | ||
| 289 | "CupCap": []byte("≍"), | ||
| 290 | "DDotrahd": []byte("⤑"), | ||
| 291 | "Dagger": []byte("‡"), | ||
| 292 | "Dcaron": []byte("Ď"), | ||
| 293 | "Delta": []byte("Δ"), | ||
| 294 | "DiacriticalAcute": []byte("´"), | ||
| 295 | "DiacriticalDot": []byte("˙"), | ||
| 296 | "DiacriticalDoubleAcute": []byte("˝"), | ||
| 297 | "DiacriticalGrave": []byte("`"), | ||
| 298 | "DiacriticalTilde": []byte("˜"), | ||
| 299 | "Diamond": []byte("⋄"), | ||
| 300 | "DifferentialD": []byte("ⅆ"), | ||
| 301 | "DotDot": []byte("⃜"), | ||
| 302 | "DotEqual": []byte("≐"), | ||
| 303 | "DoubleContourIntegral": []byte("∯"), | ||
| 304 | "DoubleDot": []byte("¨"), | ||
| 305 | "DoubleDownArrow": []byte("⇓"), | ||
| 306 | "DoubleLeftArrow": []byte("⇐"), | ||
| 307 | "DoubleLeftRightArrow": []byte("⇔"), | ||
| 308 | "DoubleLeftTee": []byte("⫤"), | ||
| 309 | "DoubleLongLeftArrow": []byte("⟸"), | ||
| 310 | "DoubleLongLeftRightArrow": []byte("⟺"), | ||
| 311 | "DoubleLongRightArrow": []byte("⟹"), | ||
| 312 | "DoubleRightArrow": []byte("⇒"), | ||
| 313 | "DoubleRightTee": []byte("⊨"), | ||
| 314 | "DoubleUpArrow": []byte("⇑"), | ||
| 315 | "DoubleUpDownArrow": []byte("⇕"), | ||
| 316 | "DoubleVerticalBar": []byte("∥"), | ||
| 317 | "DownArrow": []byte("↓"), | ||
| 318 | "DownArrowBar": []byte("⤓"), | ||
| 319 | "DownArrowUpArrow": []byte("⇵"), | ||
| 320 | "DownBreve": []byte("̑"), | ||
| 321 | "DownLeftRightVector": []byte("⥐"), | ||
| 322 | "DownLeftTeeVector": []byte("⥞"), | ||
| 323 | "DownLeftVector": []byte("↽"), | ||
| 324 | "DownLeftVectorBar": []byte("⥖"), | ||
| 325 | "DownRightTeeVector": []byte("⥟"), | ||
| 326 | "DownRightVector": []byte("⇁"), | ||
| 327 | "DownRightVectorBar": []byte("⥗"), | ||
| 328 | "DownTee": []byte("⊤"), | ||
| 329 | "DownTeeArrow": []byte("↧"), | ||
| 330 | "Downarrow": []byte("⇓"), | ||
| 331 | "Dstrok": []byte("Đ"), | ||
| 332 | "Eacute": []byte("É"), | ||
| 333 | "Ecaron": []byte("Ě"), | ||
| 334 | "Ecirc": []byte("Ê"), | ||
| 335 | "Egrave": []byte("È"), | ||
| 336 | "Element": []byte("∈"), | ||
| 337 | "Emacr": []byte("Ē"), | ||
| 338 | "EmptySmallSquare": []byte("◻"), | ||
| 339 | "EmptyVerySmallSquare": []byte("▫"), | ||
| 340 | "Eogon": []byte("Ę"), | ||
| 341 | "Epsilon": []byte("Ε"), | ||
| 342 | "EqualTilde": []byte("≂"), | ||
| 343 | "Equilibrium": []byte("⇌"), | ||
| 344 | "Exists": []byte("∃"), | ||
| 345 | "ExponentialE": []byte("ⅇ"), | ||
| 346 | "FilledSmallSquare": []byte("◼"), | ||
| 347 | "FilledVerySmallSquare": []byte("▪"), | ||
| 348 | "ForAll": []byte("∀"), | ||
| 349 | "Fouriertrf": []byte("ℱ"), | ||
| 350 | "GT": []byte(">"), | ||
| 351 | "Gamma": []byte("Γ"), | ||
| 352 | "Gammad": []byte("Ϝ"), | ||
| 353 | "Gbreve": []byte("Ğ"), | ||
| 354 | "Gcedil": []byte("Ģ"), | ||
| 355 | "Gcirc": []byte("Ĝ"), | ||
| 356 | "GreaterEqual": []byte("≥"), | ||
| 357 | "GreaterEqualLess": []byte("⋛"), | ||
| 358 | "GreaterFullEqual": []byte("≧"), | ||
| 359 | "GreaterGreater": []byte("⪢"), | ||
| 360 | "GreaterLess": []byte("≷"), | ||
| 361 | "GreaterSlantEqual": []byte("⩾"), | ||
| 362 | "GreaterTilde": []byte("≳"), | ||
| 363 | "HARDcy": []byte("Ъ"), | ||
| 364 | "Hacek": []byte("ˇ"), | ||
| 365 | "Hat": []byte("^"), | ||
| 366 | "Hcirc": []byte("Ĥ"), | ||
| 367 | "HilbertSpace": []byte("ℋ"), | ||
| 368 | "HorizontalLine": []byte("─"), | ||
| 369 | "Hstrok": []byte("Ħ"), | ||
| 370 | "HumpDownHump": []byte("≎"), | ||
| 371 | "HumpEqual": []byte("≏"), | ||
| 372 | "IJlig": []byte("IJ"), | ||
| 373 | "Iacute": []byte("Í"), | ||
| 374 | "Icirc": []byte("Î"), | ||
| 375 | "Ifr": []byte("ℑ"), | ||
| 376 | "Igrave": []byte("Ì"), | ||
| 377 | "Imacr": []byte("Ī"), | ||
| 378 | "ImaginaryI": []byte("ⅈ"), | ||
| 379 | "Implies": []byte("⇒"), | ||
| 380 | "Integral": []byte("∫"), | ||
| 381 | "Intersection": []byte("⋂"), | ||
| 382 | "InvisibleComma": []byte("⁣"), | ||
| 383 | "InvisibleTimes": []byte("⁢"), | ||
| 384 | "Iogon": []byte("Į"), | ||
| 385 | "Itilde": []byte("Ĩ"), | ||
| 386 | "Jcirc": []byte("Ĵ"), | ||
| 387 | "Jsercy": []byte("Ј"), | ||
| 388 | "Kappa": []byte("Κ"), | ||
| 389 | "Kcedil": []byte("Ķ"), | ||
| 390 | "LT": []byte("<"), | ||
| 391 | "Lacute": []byte("Ĺ"), | ||
| 392 | "Lambda": []byte("Λ"), | ||
| 393 | "Laplacetrf": []byte("ℒ"), | ||
| 394 | "Lcaron": []byte("Ľ"), | ||
| 395 | "Lcedil": []byte("Ļ"), | ||
| 396 | "LeftAngleBracket": []byte("⟨"), | ||
| 397 | "LeftArrow": []byte("←"), | ||
| 398 | "LeftArrowBar": []byte("⇤"), | ||
| 399 | "LeftArrowRightArrow": []byte("⇆"), | ||
| 400 | "LeftCeiling": []byte("⌈"), | ||
| 401 | "LeftDoubleBracket": []byte("⟦"), | ||
| 402 | "LeftDownTeeVector": []byte("⥡"), | ||
| 403 | "LeftDownVector": []byte("⇃"), | ||
| 404 | "LeftDownVectorBar": []byte("⥙"), | ||
| 405 | "LeftFloor": []byte("⌊"), | ||
| 406 | "LeftRightArrow": []byte("↔"), | ||
| 407 | "LeftRightVector": []byte("⥎"), | ||
| 408 | "LeftTee": []byte("⊣"), | ||
| 409 | "LeftTeeArrow": []byte("↤"), | ||
| 410 | "LeftTeeVector": []byte("⥚"), | ||
| 411 | "LeftTriangle": []byte("⊲"), | ||
| 412 | "LeftTriangleBar": []byte("⧏"), | ||
| 413 | "LeftTriangleEqual": []byte("⊴"), | ||
| 414 | "LeftUpDownVector": []byte("⥑"), | ||
| 415 | "LeftUpTeeVector": []byte("⥠"), | ||
| 416 | "LeftUpVector": []byte("↿"), | ||
| 417 | "LeftUpVectorBar": []byte("⥘"), | ||
| 418 | "LeftVector": []byte("↼"), | ||
| 419 | "LeftVectorBar": []byte("⥒"), | ||
| 420 | "Leftarrow": []byte("⇐"), | ||
| 421 | "Leftrightarrow": []byte("⇔"), | ||
| 422 | "LessEqualGreater": []byte("⋚"), | ||
| 423 | "LessFullEqual": []byte("≦"), | ||
| 424 | "LessGreater": []byte("≶"), | ||
| 425 | "LessLess": []byte("⪡"), | ||
| 426 | "LessSlantEqual": []byte("⩽"), | ||
| 427 | "LessTilde": []byte("≲"), | ||
| 428 | "Lleftarrow": []byte("⇚"), | ||
| 429 | "Lmidot": []byte("Ŀ"), | ||
| 430 | "LongLeftArrow": []byte("⟵"), | ||
| 431 | "LongLeftRightArrow": []byte("⟷"), | ||
| 432 | "LongRightArrow": []byte("⟶"), | ||
| 433 | "Longleftarrow": []byte("⟸"), | ||
| 434 | "Longleftrightarrow": []byte("⟺"), | ||
| 435 | "Longrightarrow": []byte("⟹"), | ||
| 436 | "LowerLeftArrow": []byte("↙"), | ||
| 437 | "LowerRightArrow": []byte("↘"), | ||
| 438 | "Lstrok": []byte("Ł"), | ||
| 439 | "MediumSpace": []byte(" "), | ||
| 440 | "Mellintrf": []byte("ℳ"), | ||
| 441 | "MinusPlus": []byte("∓"), | ||
| 442 | "Nacute": []byte("Ń"), | ||
| 443 | "Ncaron": []byte("Ň"), | ||
| 444 | "Ncedil": []byte("Ņ"), | ||
| 445 | "NegativeMediumSpace": []byte("​"), | ||
| 446 | "NegativeThickSpace": []byte("​"), | ||
| 447 | "NegativeThinSpace": []byte("​"), | ||
| 448 | "NegativeVeryThinSpace": []byte("​"), | ||
| 449 | "NestedGreaterGreater": []byte("≫"), | ||
| 450 | "NestedLessLess": []byte("≪"), | ||
| 451 | "NewLine": []byte("\n"), | ||
| 452 | "NoBreak": []byte("⁠"), | ||
| 453 | "NonBreakingSpace": []byte(" "), | ||
| 454 | "NotCongruent": []byte("≢"), | ||
| 455 | "NotCupCap": []byte("≭"), | ||
| 456 | "NotDoubleVerticalBar": []byte("∦"), | ||
| 457 | "NotElement": []byte("∉"), | ||
| 458 | "NotEqual": []byte("≠"), | ||
| 459 | "NotExists": []byte("∄"), | ||
| 460 | "NotGreater": []byte("≯"), | ||
| 461 | "NotGreaterEqual": []byte("≱"), | ||
| 462 | "NotGreaterLess": []byte("≹"), | ||
| 463 | "NotGreaterTilde": []byte("≵"), | ||
| 464 | "NotLeftTriangle": []byte("⋪"), | ||
| 465 | "NotLeftTriangleEqual": []byte("⋬"), | ||
| 466 | "NotLess": []byte("≮"), | ||
| 467 | "NotLessEqual": []byte("≰"), | ||
| 468 | "NotLessGreater": []byte("≸"), | ||
| 469 | "NotLessTilde": []byte("≴"), | ||
| 470 | "NotPrecedes": []byte("⊀"), | ||
| 471 | "NotPrecedesSlantEqual": []byte("⋠"), | ||
| 472 | "NotReverseElement": []byte("∌"), | ||
| 473 | "NotRightTriangle": []byte("⋫"), | ||
| 474 | "NotRightTriangleEqual": []byte("⋭"), | ||
| 475 | "NotSquareSubsetEqual": []byte("⋢"), | ||
| 476 | "NotSquareSupersetEqual": []byte("⋣"), | ||
| 477 | "NotSubsetEqual": []byte("⊈"), | ||
| 478 | "NotSucceeds": []byte("⊁"), | ||
| 479 | "NotSucceedsSlantEqual": []byte("⋡"), | ||
| 480 | "NotSupersetEqual": []byte("⊉"), | ||
| 481 | "NotTilde": []byte("≁"), | ||
| 482 | "NotTildeEqual": []byte("≄"), | ||
| 483 | "NotTildeFullEqual": []byte("≇"), | ||
| 484 | "NotTildeTilde": []byte("≉"), | ||
| 485 | "NotVerticalBar": []byte("∤"), | ||
| 486 | "Ntilde": []byte("Ñ"), | ||
| 487 | "OElig": []byte("Œ"), | ||
| 488 | "Oacute": []byte("Ó"), | ||
| 489 | "Ocirc": []byte("Ô"), | ||
| 490 | "Odblac": []byte("Ő"), | ||
| 491 | "Ograve": []byte("Ò"), | ||
| 492 | "Omacr": []byte("Ō"), | ||
| 493 | "Omega": []byte("Ω"), | ||
| 494 | "Omicron": []byte("Ο"), | ||
| 495 | "OpenCurlyDoubleQuote": []byte("“"), | ||
| 496 | "OpenCurlyQuote": []byte("‘"), | ||
| 497 | "Oslash": []byte("Ø"), | ||
| 498 | "Otilde": []byte("Õ"), | ||
| 499 | "OverBar": []byte("‾"), | ||
| 500 | "OverBrace": []byte("⏞"), | ||
| 501 | "OverBracket": []byte("⎴"), | ||
| 502 | "OverParenthesis": []byte("⏜"), | ||
| 503 | "PartialD": []byte("∂"), | ||
| 504 | "PlusMinus": []byte("±"), | ||
| 505 | "Poincareplane": []byte("ℌ"), | ||
| 506 | "Precedes": []byte("≺"), | ||
| 507 | "PrecedesEqual": []byte("⪯"), | ||
| 508 | "PrecedesSlantEqual": []byte("≼"), | ||
| 509 | "PrecedesTilde": []byte("≾"), | ||
| 510 | "Product": []byte("∏"), | ||
| 511 | "Proportion": []byte("∷"), | ||
| 512 | "Proportional": []byte("∝"), | ||
| 513 | "QUOT": []byte("\""), | ||
| 514 | "Racute": []byte("Ŕ"), | ||
| 515 | "Rcaron": []byte("Ř"), | ||
| 516 | "Rcedil": []byte("Ŗ"), | ||
| 517 | "ReverseElement": []byte("∋"), | ||
| 518 | "ReverseEquilibrium": []byte("⇋"), | ||
| 519 | "ReverseUpEquilibrium": []byte("⥯"), | ||
| 520 | "Rfr": []byte("ℜ"), | ||
| 521 | "RightAngleBracket": []byte("⟩"), | ||
| 522 | "RightArrow": []byte("→"), | ||
| 523 | "RightArrowBar": []byte("⇥"), | ||
| 524 | "RightArrowLeftArrow": []byte("⇄"), | ||
| 525 | "RightCeiling": []byte("⌉"), | ||
| 526 | "RightDoubleBracket": []byte("⟧"), | ||
| 527 | "RightDownTeeVector": []byte("⥝"), | ||
| 528 | "RightDownVector": []byte("⇂"), | ||
| 529 | "RightDownVectorBar": []byte("⥕"), | ||
| 530 | "RightFloor": []byte("⌋"), | ||
| 531 | "RightTee": []byte("⊢"), | ||
| 532 | "RightTeeArrow": []byte("↦"), | ||
| 533 | "RightTeeVector": []byte("⥛"), | ||
| 534 | "RightTriangle": []byte("⊳"), | ||
| 535 | "RightTriangleBar": []byte("⧐"), | ||
| 536 | "RightTriangleEqual": []byte("⊵"), | ||
| 537 | "RightUpDownVector": []byte("⥏"), | ||
| 538 | "RightUpTeeVector": []byte("⥜"), | ||
| 539 | "RightUpVector": []byte("↾"), | ||
| 540 | "RightUpVectorBar": []byte("⥔"), | ||
| 541 | "RightVector": []byte("⇀"), | ||
| 542 | "RightVectorBar": []byte("⥓"), | ||
| 543 | "Rightarrow": []byte("⇒"), | ||
| 544 | "RoundImplies": []byte("⥰"), | ||
| 545 | "Rrightarrow": []byte("⇛"), | ||
| 546 | "RuleDelayed": []byte("⧴"), | ||
| 547 | "SHCHcy": []byte("Щ"), | ||
| 548 | "SOFTcy": []byte("Ь"), | ||
| 549 | "Sacute": []byte("Ś"), | ||
| 550 | "Scaron": []byte("Š"), | ||
| 551 | "Scedil": []byte("Ş"), | ||
| 552 | "Scirc": []byte("Ŝ"), | ||
| 553 | "ShortDownArrow": []byte("↓"), | ||
| 554 | "ShortLeftArrow": []byte("←"), | ||
| 555 | "ShortRightArrow": []byte("→"), | ||
| 556 | "ShortUpArrow": []byte("↑"), | ||
| 557 | "Sigma": []byte("Σ"), | ||
| 558 | "SmallCircle": []byte("∘"), | ||
| 559 | "Square": []byte("□"), | ||
| 560 | "SquareIntersection": []byte("⊓"), | ||
| 561 | "SquareSubset": []byte("⊏"), | ||
| 562 | "SquareSubsetEqual": []byte("⊑"), | ||
| 563 | "SquareSuperset": []byte("⊐"), | ||
| 564 | "SquareSupersetEqual": []byte("⊒"), | ||
| 565 | "SquareUnion": []byte("⊔"), | ||
| 566 | "Subset": []byte("⋐"), | ||
| 567 | "SubsetEqual": []byte("⊆"), | ||
| 568 | "Succeeds": []byte("≻"), | ||
| 569 | "SucceedsEqual": []byte("⪰"), | ||
| 570 | "SucceedsSlantEqual": []byte("≽"), | ||
| 571 | "SucceedsTilde": []byte("≿"), | ||
| 572 | "SuchThat": []byte("∋"), | ||
| 573 | "Superset": []byte("⊃"), | ||
| 574 | "SupersetEqual": []byte("⊇"), | ||
| 575 | "Supset": []byte("⋑"), | ||
| 576 | "THORN": []byte("Þ"), | ||
| 577 | "Tab": []byte(" "), | ||
| 578 | "Tcaron": []byte("Ť"), | ||
| 579 | "Tcedil": []byte("Ţ"), | ||
| 580 | "Therefore": []byte("∴"), | ||
| 581 | "Theta": []byte("Θ"), | ||
| 582 | "ThinSpace": []byte(" "), | ||
| 583 | "Tilde": []byte("∼"), | ||
| 584 | "TildeEqual": []byte("≃"), | ||
| 585 | "TildeFullEqual": []byte("≅"), | ||
| 586 | "TildeTilde": []byte("≈"), | ||
| 587 | "TripleDot": []byte("⃛"), | ||
| 588 | "Tstrok": []byte("Ŧ"), | ||
| 589 | "Uacute": []byte("Ú"), | ||
| 590 | "Uarrocir": []byte("⥉"), | ||
| 591 | "Ubreve": []byte("Ŭ"), | ||
| 592 | "Ucirc": []byte("Û"), | ||
| 593 | "Udblac": []byte("Ű"), | ||
| 594 | "Ugrave": []byte("Ù"), | ||
| 595 | "Umacr": []byte("Ū"), | ||
| 596 | "UnderBar": []byte("_"), | ||
| 597 | "UnderBrace": []byte("⏟"), | ||
| 598 | "UnderBracket": []byte("⎵"), | ||
| 599 | "UnderParenthesis": []byte("⏝"), | ||
| 600 | "Union": []byte("⋃"), | ||
| 601 | "UnionPlus": []byte("⊎"), | ||
| 602 | "Uogon": []byte("Ų"), | ||
| 603 | "UpArrow": []byte("↑"), | ||
| 604 | "UpArrowBar": []byte("⤒"), | ||
| 605 | "UpArrowDownArrow": []byte("⇅"), | ||
| 606 | "UpDownArrow": []byte("↕"), | ||
| 607 | "UpEquilibrium": []byte("⥮"), | ||
| 608 | "UpTee": []byte("⊥"), | ||
| 609 | "UpTeeArrow": []byte("↥"), | ||
| 610 | "Uparrow": []byte("⇑"), | ||
| 611 | "Updownarrow": []byte("⇕"), | ||
| 612 | "UpperLeftArrow": []byte("↖"), | ||
| 613 | "UpperRightArrow": []byte("↗"), | ||
| 614 | "Upsilon": []byte("Υ"), | ||
| 615 | "Uring": []byte("Ů"), | ||
| 616 | "Utilde": []byte("Ũ"), | ||
| 617 | "Verbar": []byte("‖"), | ||
| 618 | "VerticalBar": []byte("∣"), | ||
| 619 | "VerticalLine": []byte("|"), | ||
| 620 | "VerticalSeparator": []byte("❘"), | ||
| 621 | "VerticalTilde": []byte("≀"), | ||
| 622 | "VeryThinSpace": []byte(" "), | ||
| 623 | "Vvdash": []byte("⊪"), | ||
| 624 | "Wcirc": []byte("Ŵ"), | ||
| 625 | "Yacute": []byte("Ý"), | ||
| 626 | "Ycirc": []byte("Ŷ"), | ||
| 627 | "Zacute": []byte("Ź"), | ||
| 628 | "Zcaron": []byte("Ž"), | ||
| 629 | "ZeroWidthSpace": []byte("​"), | ||
| 630 | "aacute": []byte("á"), | ||
| 631 | "abreve": []byte("ă"), | ||
| 632 | "acirc": []byte("â"), | ||
| 633 | "acute": []byte("´"), | ||
| 634 | "aelig": []byte("æ"), | ||
| 635 | "agrave": []byte("à"), | ||
| 636 | "alefsym": []byte("ℵ"), | ||
| 637 | "alpha": []byte("α"), | ||
| 638 | "amacr": []byte("ā"), | ||
| 639 | "amp": []byte("&"), | ||
| 640 | "andslope": []byte("⩘"), | ||
| 641 | "angle": []byte("∠"), | ||
| 642 | "angmsd": []byte("∡"), | ||
| 643 | "angmsdaa": []byte("⦨"), | ||
| 644 | "angmsdab": []byte("⦩"), | ||
| 645 | "angmsdac": []byte("⦪"), | ||
| 646 | "angmsdad": []byte("⦫"), | ||
| 647 | "angmsdae": []byte("⦬"), | ||
| 648 | "angmsdaf": []byte("⦭"), | ||
| 649 | "angmsdag": []byte("⦮"), | ||
| 650 | "angmsdah": []byte("⦯"), | ||
| 651 | "angrtvb": []byte("⊾"), | ||
| 652 | "angrtvbd": []byte("⦝"), | ||
| 653 | "angsph": []byte("∢"), | ||
| 654 | "angst": []byte("Å"), | ||
| 655 | "angzarr": []byte("⍼"), | ||
| 656 | "aogon": []byte("ą"), | ||
| 657 | "apos": []byte("'"), | ||
| 658 | "approx": []byte("≈"), | ||
| 659 | "approxeq": []byte("≊"), | ||
| 660 | "aring": []byte("å"), | ||
| 661 | "ast": []byte("*"), | ||
| 662 | "asymp": []byte("≈"), | ||
| 663 | "asympeq": []byte("≍"), | ||
| 664 | "atilde": []byte("ã"), | ||
| 665 | "awconint": []byte("∳"), | ||
| 666 | "backcong": []byte("≌"), | ||
| 667 | "backepsilon": []byte("϶"), | ||
| 668 | "backprime": []byte("‵"), | ||
| 669 | "backsim": []byte("∽"), | ||
| 670 | "backsimeq": []byte("⋍"), | ||
| 671 | "barvee": []byte("⊽"), | ||
| 672 | "barwed": []byte("⌅"), | ||
| 673 | "barwedge": []byte("⌅"), | ||
| 674 | "bbrktbrk": []byte("⎶"), | ||
| 675 | "becaus": []byte("∵"), | ||
| 676 | "because": []byte("∵"), | ||
| 677 | "bemptyv": []byte("⦰"), | ||
| 678 | "bernou": []byte("ℬ"), | ||
| 679 | "between": []byte("≬"), | ||
| 680 | "bigcap": []byte("⋂"), | ||
| 681 | "bigcirc": []byte("◯"), | ||
| 682 | "bigcup": []byte("⋃"), | ||
| 683 | "bigodot": []byte("⨀"), | ||
| 684 | "bigoplus": []byte("⨁"), | ||
| 685 | "bigotimes": []byte("⨂"), | ||
| 686 | "bigsqcup": []byte("⨆"), | ||
| 687 | "bigstar": []byte("★"), | ||
| 688 | "bigtriangledown": []byte("▽"), | ||
| 689 | "bigtriangleup": []byte("△"), | ||
| 690 | "biguplus": []byte("⨄"), | ||
| 691 | "bigvee": []byte("⋁"), | ||
| 692 | "bigwedge": []byte("⋀"), | ||
| 693 | "bkarow": []byte("⤍"), | ||
| 694 | "blacklozenge": []byte("⧫"), | ||
| 695 | "blacksquare": []byte("▪"), | ||
| 696 | "blacktriangle": []byte("▴"), | ||
| 697 | "blacktriangledown": []byte("▾"), | ||
| 698 | "blacktriangleleft": []byte("◂"), | ||
| 699 | "blacktriangleright": []byte("▸"), | ||
| 700 | "bottom": []byte("⊥"), | ||
| 701 | "bowtie": []byte("⋈"), | ||
| 702 | "boxminus": []byte("⊟"), | ||
| 703 | "boxplus": []byte("⊞"), | ||
| 704 | "boxtimes": []byte("⊠"), | ||
| 705 | "bprime": []byte("‵"), | ||
| 706 | "breve": []byte("˘"), | ||
| 707 | "brvbar": []byte("¦"), | ||
| 708 | "bsol": []byte("\\"), | ||
| 709 | "bsolhsub": []byte("⟈"), | ||
| 710 | "bullet": []byte("•"), | ||
| 711 | "bumpeq": []byte("≏"), | ||
| 712 | "cacute": []byte("ć"), | ||
| 713 | "capbrcup": []byte("⩉"), | ||
| 714 | "caron": []byte("ˇ"), | ||
| 715 | "ccaron": []byte("č"), | ||
| 716 | "ccedil": []byte("ç"), | ||
| 717 | "ccirc": []byte("ĉ"), | ||
| 718 | "ccupssm": []byte("⩐"), | ||
| 719 | "cedil": []byte("¸"), | ||
| 720 | "cemptyv": []byte("⦲"), | ||
| 721 | "centerdot": []byte("·"), | ||
| 722 | "checkmark": []byte("✓"), | ||
| 723 | "circeq": []byte("≗"), | ||
| 724 | "circlearrowleft": []byte("↺"), | ||
| 725 | "circlearrowright": []byte("↻"), | ||
| 726 | "circledR": []byte("®"), | ||
| 727 | "circledS": []byte("Ⓢ"), | ||
| 728 | "circledast": []byte("⊛"), | ||
| 729 | "circledcirc": []byte("⊚"), | ||
| 730 | "circleddash": []byte("⊝"), | ||
| 731 | "cirfnint": []byte("⨐"), | ||
| 732 | "cirscir": []byte("⧂"), | ||
| 733 | "clubsuit": []byte("♣"), | ||
| 734 | "colon": []byte(":"), | ||
| 735 | "colone": []byte("≔"), | ||
| 736 | "coloneq": []byte("≔"), | ||
| 737 | "comma": []byte(","), | ||
| 738 | "commat": []byte("@"), | ||
| 739 | "compfn": []byte("∘"), | ||
| 740 | "complement": []byte("∁"), | ||
| 741 | "complexes": []byte("ℂ"), | ||
| 742 | "congdot": []byte("⩭"), | ||
| 743 | "conint": []byte("∮"), | ||
| 744 | "coprod": []byte("∐"), | ||
| 745 | "copysr": []byte("℗"), | ||
| 746 | "cudarrl": []byte("⤸"), | ||
| 747 | "cudarrr": []byte("⤵"), | ||
| 748 | "cularr": []byte("↶"), | ||
| 749 | "cularrp": []byte("⤽"), | ||
| 750 | "cupbrcap": []byte("⩈"), | ||
| 751 | "cupdot": []byte("⊍"), | ||
| 752 | "curarr": []byte("↷"), | ||
| 753 | "curarrm": []byte("⤼"), | ||
| 754 | "curlyeqprec": []byte("⋞"), | ||
| 755 | "curlyeqsucc": []byte("⋟"), | ||
| 756 | "curlyvee": []byte("⋎"), | ||
| 757 | "curlywedge": []byte("⋏"), | ||
| 758 | "curren": []byte("¤"), | ||
| 759 | "curvearrowleft": []byte("↶"), | ||
| 760 | "curvearrowright": []byte("↷"), | ||
| 761 | "cwconint": []byte("∲"), | ||
| 762 | "cylcty": []byte("⌭"), | ||
| 763 | "dagger": []byte("†"), | ||
| 764 | "daleth": []byte("ℸ"), | ||
| 765 | "dbkarow": []byte("⤏"), | ||
| 766 | "dblac": []byte("˝"), | ||
| 767 | "dcaron": []byte("ď"), | ||
| 768 | "ddagger": []byte("‡"), | ||
| 769 | "ddotseq": []byte("⩷"), | ||
| 770 | "delta": []byte("δ"), | ||
| 771 | "demptyv": []byte("⦱"), | ||
| 772 | "diamond": []byte("⋄"), | ||
| 773 | "diamondsuit": []byte("♦"), | ||
| 774 | "digamma": []byte("ϝ"), | ||
| 775 | "divide": []byte("÷"), | ||
| 776 | "divideontimes": []byte("⋇"), | ||
| 777 | "divonx": []byte("⋇"), | ||
| 778 | "dlcorn": []byte("⌞"), | ||
| 779 | "dlcrop": []byte("⌍"), | ||
| 780 | "dollar": []byte("$"), | ||
| 781 | "doteqdot": []byte("≑"), | ||
| 782 | "dotminus": []byte("∸"), | ||
| 783 | "dotplus": []byte("∔"), | ||
| 784 | "dotsquare": []byte("⊡"), | ||
| 785 | "doublebarwedge": []byte("⌆"), | ||
| 786 | "downarrow": []byte("↓"), | ||
| 787 | "downdownarrows": []byte("⇊"), | ||
| 788 | "downharpoonleft": []byte("⇃"), | ||
| 789 | "downharpoonright": []byte("⇂"), | ||
| 790 | "drbkarow": []byte("⤐"), | ||
| 791 | "drcorn": []byte("⌟"), | ||
| 792 | "drcrop": []byte("⌌"), | ||
| 793 | "dstrok": []byte("đ"), | ||
| 794 | "dwangle": []byte("⦦"), | ||
| 795 | "dzigrarr": []byte("⟿"), | ||
| 796 | "eacute": []byte("é"), | ||
| 797 | "ecaron": []byte("ě"), | ||
| 798 | "ecirc": []byte("ê"), | ||
| 799 | "ecolon": []byte("≕"), | ||
| 800 | "egrave": []byte("è"), | ||
| 801 | "elinters": []byte("⏧"), | ||
| 802 | "emacr": []byte("ē"), | ||
| 803 | "emptyset": []byte("∅"), | ||
| 804 | "emptyv": []byte("∅"), | ||
| 805 | "emsp13": []byte(" "), | ||
| 806 | "emsp14": []byte(" "), | ||
| 807 | "eogon": []byte("ę"), | ||
| 808 | "epsilon": []byte("ε"), | ||
| 809 | "eqcirc": []byte("≖"), | ||
| 810 | "eqcolon": []byte("≕"), | ||
| 811 | "eqsim": []byte("≂"), | ||
| 812 | "eqslantgtr": []byte("⪖"), | ||
| 813 | "eqslantless": []byte("⪕"), | ||
| 814 | "equals": []byte("="), | ||
| 815 | "equest": []byte("≟"), | ||
| 816 | "equivDD": []byte("⩸"), | ||
| 817 | "eqvparsl": []byte("⧥"), | ||
| 818 | "excl": []byte("!"), | ||
| 819 | "expectation": []byte("ℰ"), | ||
| 820 | "exponentiale": []byte("ⅇ"), | ||
| 821 | "fallingdotseq": []byte("≒"), | ||
| 822 | "female": []byte("♀"), | ||
| 823 | "forall": []byte("∀"), | ||
| 824 | "fpartint": []byte("⨍"), | ||
| 825 | "frac12": []byte("½"), | ||
| 826 | "frac13": []byte("⅓"), | ||
| 827 | "frac14": []byte("¼"), | ||
| 828 | "frac15": []byte("⅕"), | ||
| 829 | "frac16": []byte("⅙"), | ||
| 830 | "frac18": []byte("⅛"), | ||
| 831 | "frac23": []byte("⅔"), | ||
| 832 | "frac25": []byte("⅖"), | ||
| 833 | "frac34": []byte("¾"), | ||
| 834 | "frac35": []byte("⅗"), | ||
| 835 | "frac38": []byte("⅜"), | ||
| 836 | "frac45": []byte("⅘"), | ||
| 837 | "frac56": []byte("⅚"), | ||
| 838 | "frac58": []byte("⅝"), | ||
| 839 | "frac78": []byte("⅞"), | ||
| 840 | "gacute": []byte("ǵ"), | ||
| 841 | "gamma": []byte("γ"), | ||
| 842 | "gammad": []byte("ϝ"), | ||
| 843 | "gbreve": []byte("ğ"), | ||
| 844 | "gcirc": []byte("ĝ"), | ||
| 845 | "geq": []byte("≥"), | ||
| 846 | "geqq": []byte("≧"), | ||
| 847 | "geqslant": []byte("⩾"), | ||
| 848 | "gesdoto": []byte("⪂"), | ||
| 849 | "gesdotol": []byte("⪄"), | ||
| 850 | "ggg": []byte("⋙"), | ||
| 851 | "gnapprox": []byte("⪊"), | ||
| 852 | "gneq": []byte("⪈"), | ||
| 853 | "gneqq": []byte("≩"), | ||
| 854 | "grave": []byte("`"), | ||
| 855 | "gt": []byte(">"), | ||
| 856 | "gtquest": []byte("⩼"), | ||
| 857 | "gtrapprox": []byte("⪆"), | ||
| 858 | "gtrdot": []byte("⋗"), | ||
| 859 | "gtreqless": []byte("⋛"), | ||
| 860 | "gtreqqless": []byte("⪌"), | ||
| 861 | "gtrless": []byte("≷"), | ||
| 862 | "gtrsim": []byte("≳"), | ||
| 863 | "hArr": []byte("⇔"), | ||
| 864 | "hairsp": []byte(" "), | ||
| 865 | "hamilt": []byte("ℋ"), | ||
| 866 | "hardcy": []byte("ъ"), | ||
| 867 | "harrcir": []byte("⥈"), | ||
| 868 | "hcirc": []byte("ĥ"), | ||
| 869 | "hearts": []byte("♥"), | ||
| 870 | "heartsuit": []byte("♥"), | ||
| 871 | "hellip": []byte("…"), | ||
| 872 | "hercon": []byte("⊹"), | ||
| 873 | "hksearow": []byte("⤥"), | ||
| 874 | "hkswarow": []byte("⤦"), | ||
| 875 | "homtht": []byte("∻"), | ||
| 876 | "hookleftarrow": []byte("↩"), | ||
| 877 | "hookrightarrow": []byte("↪"), | ||
| 878 | "horbar": []byte("―"), | ||
| 879 | "hslash": []byte("ℏ"), | ||
| 880 | "hstrok": []byte("ħ"), | ||
| 881 | "hybull": []byte("⁃"), | ||
| 882 | "hyphen": []byte("‐"), | ||
| 883 | "iacute": []byte("í"), | ||
| 884 | "icirc": []byte("î"), | ||
| 885 | "iexcl": []byte("¡"), | ||
| 886 | "igrave": []byte("ì"), | ||
| 887 | "iiiint": []byte("⨌"), | ||
| 888 | "iiint": []byte("∭"), | ||
| 889 | "ijlig": []byte("ij"), | ||
| 890 | "imacr": []byte("ī"), | ||
| 891 | "image": []byte("ℑ"), | ||
| 892 | "imagline": []byte("ℐ"), | ||
| 893 | "imagpart": []byte("ℑ"), | ||
| 894 | "imath": []byte("ı"), | ||
| 895 | "imped": []byte("Ƶ"), | ||
| 896 | "incare": []byte("℅"), | ||
| 897 | "infintie": []byte("⧝"), | ||
| 898 | "inodot": []byte("ı"), | ||
| 899 | "intcal": []byte("⊺"), | ||
| 900 | "integers": []byte("ℤ"), | ||
| 901 | "intercal": []byte("⊺"), | ||
| 902 | "intlarhk": []byte("⨗"), | ||
| 903 | "intprod": []byte("⨼"), | ||
| 904 | "iogon": []byte("į"), | ||
| 905 | "iquest": []byte("¿"), | ||
| 906 | "isin": []byte("∈"), | ||
| 907 | "isindot": []byte("⋵"), | ||
| 908 | "isinsv": []byte("⋳"), | ||
| 909 | "isinv": []byte("∈"), | ||
| 910 | "itilde": []byte("ĩ"), | ||
| 911 | "jcirc": []byte("ĵ"), | ||
| 912 | "jmath": []byte("ȷ"), | ||
| 913 | "jsercy": []byte("ј"), | ||
| 914 | "kappa": []byte("κ"), | ||
| 915 | "kappav": []byte("ϰ"), | ||
| 916 | "kcedil": []byte("ķ"), | ||
| 917 | "kgreen": []byte("ĸ"), | ||
| 918 | "lacute": []byte("ĺ"), | ||
| 919 | "laemptyv": []byte("⦴"), | ||
| 920 | "lagran": []byte("ℒ"), | ||
| 921 | "lambda": []byte("λ"), | ||
| 922 | "langle": []byte("⟨"), | ||
| 923 | "laquo": []byte("«"), | ||
| 924 | "larrbfs": []byte("⤟"), | ||
| 925 | "larrhk": []byte("↩"), | ||
| 926 | "larrlp": []byte("↫"), | ||
| 927 | "larrsim": []byte("⥳"), | ||
| 928 | "larrtl": []byte("↢"), | ||
| 929 | "lbrace": []byte("{"), | ||
| 930 | "lbrack": []byte("["), | ||
| 931 | "lbrksld": []byte("⦏"), | ||
| 932 | "lbrkslu": []byte("⦍"), | ||
| 933 | "lcaron": []byte("ľ"), | ||
| 934 | "lcedil": []byte("ļ"), | ||
| 935 | "lcub": []byte("{"), | ||
| 936 | "ldquor": []byte("„"), | ||
| 937 | "ldrdhar": []byte("⥧"), | ||
| 938 | "ldrushar": []byte("⥋"), | ||
| 939 | "leftarrow": []byte("←"), | ||
| 940 | "leftarrowtail": []byte("↢"), | ||
| 941 | "leftharpoondown": []byte("↽"), | ||
| 942 | "leftharpoonup": []byte("↼"), | ||
| 943 | "leftleftarrows": []byte("⇇"), | ||
| 944 | "leftrightarrow": []byte("↔"), | ||
| 945 | "leftrightarrows": []byte("⇆"), | ||
| 946 | "leftrightharpoons": []byte("⇋"), | ||
| 947 | "leftrightsquigarrow": []byte("↭"), | ||
| 948 | "leftthreetimes": []byte("⋋"), | ||
| 949 | "leq": []byte("≤"), | ||
| 950 | "leqq": []byte("≦"), | ||
| 951 | "leqslant": []byte("⩽"), | ||
| 952 | "lesdoto": []byte("⪁"), | ||
| 953 | "lesdotor": []byte("⪃"), | ||
| 954 | "lessapprox": []byte("⪅"), | ||
| 955 | "lessdot": []byte("⋖"), | ||
| 956 | "lesseqgtr": []byte("⋚"), | ||
| 957 | "lesseqqgtr": []byte("⪋"), | ||
| 958 | "lessgtr": []byte("≶"), | ||
| 959 | "lesssim": []byte("≲"), | ||
| 960 | "lfloor": []byte("⌊"), | ||
| 961 | "llcorner": []byte("⌞"), | ||
| 962 | "lmidot": []byte("ŀ"), | ||
| 963 | "lmoust": []byte("⎰"), | ||
| 964 | "lmoustache": []byte("⎰"), | ||
| 965 | "lnapprox": []byte("⪉"), | ||
| 966 | "lneq": []byte("⪇"), | ||
| 967 | "lneqq": []byte("≨"), | ||
| 968 | "longleftarrow": []byte("⟵"), | ||
| 969 | "longleftrightarrow": []byte("⟷"), | ||
| 970 | "longmapsto": []byte("⟼"), | ||
| 971 | "longrightarrow": []byte("⟶"), | ||
| 972 | "looparrowleft": []byte("↫"), | ||
| 973 | "looparrowright": []byte("↬"), | ||
| 974 | "lotimes": []byte("⨴"), | ||
| 975 | "lowast": []byte("∗"), | ||
| 976 | "lowbar": []byte("_"), | ||
| 977 | "lozenge": []byte("◊"), | ||
| 978 | "lpar": []byte("("), | ||
| 979 | "lrcorner": []byte("⌟"), | ||
| 980 | "lsaquo": []byte("‹"), | ||
| 981 | "lsqb": []byte("["), | ||
| 982 | "lsquor": []byte("‚"), | ||
| 983 | "lstrok": []byte("ł"), | ||
| 984 | "lt": []byte("<"), | ||
| 985 | "lthree": []byte("⋋"), | ||
| 986 | "ltimes": []byte("⋉"), | ||
| 987 | "ltquest": []byte("⩻"), | ||
| 988 | "lurdshar": []byte("⥊"), | ||
| 989 | "luruhar": []byte("⥦"), | ||
| 990 | "maltese": []byte("✠"), | ||
| 991 | "mapsto": []byte("↦"), | ||
| 992 | "mapstodown": []byte("↧"), | ||
| 993 | "mapstoleft": []byte("↤"), | ||
| 994 | "mapstoup": []byte("↥"), | ||
| 995 | "marker": []byte("▮"), | ||
| 996 | "measuredangle": []byte("∡"), | ||
| 997 | "micro": []byte("µ"), | ||
| 998 | "midast": []byte("*"), | ||
| 999 | "middot": []byte("·"), | ||
| 1000 | "minusb": []byte("⊟"), | ||
| 1001 | "minusd": []byte("∸"), | ||
| 1002 | "minusdu": []byte("⨪"), | ||
| 1003 | "mnplus": []byte("∓"), | ||
| 1004 | "models": []byte("⊧"), | ||
| 1005 | "mstpos": []byte("∾"), | ||
| 1006 | "multimap": []byte("⊸"), | ||
| 1007 | "nLeftarrow": []byte("⇍"), | ||
| 1008 | "nLeftrightarrow": []byte("⇎"), | ||
| 1009 | "nRightarrow": []byte("⇏"), | ||
| 1010 | "nVDash": []byte("⊯"), | ||
| 1011 | "nVdash": []byte("⊮"), | ||
| 1012 | "nabla": []byte("∇"), | ||
| 1013 | "nacute": []byte("ń"), | ||
| 1014 | "napos": []byte("ʼn"), | ||
| 1015 | "napprox": []byte("≉"), | ||
| 1016 | "natural": []byte("♮"), | ||
| 1017 | "naturals": []byte("ℕ"), | ||
| 1018 | "ncaron": []byte("ň"), | ||
| 1019 | "ncedil": []byte("ņ"), | ||
| 1020 | "nearrow": []byte("↗"), | ||
| 1021 | "nequiv": []byte("≢"), | ||
| 1022 | "nesear": []byte("⤨"), | ||
| 1023 | "nexist": []byte("∄"), | ||
| 1024 | "nexists": []byte("∄"), | ||
| 1025 | "ngeq": []byte("≱"), | ||
| 1026 | "ngtr": []byte("≯"), | ||
| 1027 | "niv": []byte("∋"), | ||
| 1028 | "nleftarrow": []byte("↚"), | ||
| 1029 | "nleftrightarrow": []byte("↮"), | ||
| 1030 | "nleq": []byte("≰"), | ||
| 1031 | "nless": []byte("≮"), | ||
| 1032 | "nltrie": []byte("⋬"), | ||
| 1033 | "notinva": []byte("∉"), | ||
| 1034 | "notinvb": []byte("⋷"), | ||
| 1035 | "notinvc": []byte("⋶"), | ||
| 1036 | "notniva": []byte("∌"), | ||
| 1037 | "notnivb": []byte("⋾"), | ||
| 1038 | "notnivc": []byte("⋽"), | ||
| 1039 | "nparallel": []byte("∦"), | ||
| 1040 | "npolint": []byte("⨔"), | ||
| 1041 | "nprcue": []byte("⋠"), | ||
| 1042 | "nprec": []byte("⊀"), | ||
| 1043 | "nrightarrow": []byte("↛"), | ||
| 1044 | "nrtrie": []byte("⋭"), | ||
| 1045 | "nsccue": []byte("⋡"), | ||
| 1046 | "nshortmid": []byte("∤"), | ||
| 1047 | "nshortparallel": []byte("∦"), | ||
| 1048 | "nsimeq": []byte("≄"), | ||
| 1049 | "nsmid": []byte("∤"), | ||
| 1050 | "nspar": []byte("∦"), | ||
| 1051 | "nsqsube": []byte("⋢"), | ||
| 1052 | "nsqsupe": []byte("⋣"), | ||
| 1053 | "nsubseteq": []byte("⊈"), | ||
| 1054 | "nsucc": []byte("⊁"), | ||
| 1055 | "nsupseteq": []byte("⊉"), | ||
| 1056 | "ntilde": []byte("ñ"), | ||
| 1057 | "ntriangleleft": []byte("⋪"), | ||
| 1058 | "ntrianglelefteq": []byte("⋬"), | ||
| 1059 | "ntriangleright": []byte("⋫"), | ||
| 1060 | "ntrianglerighteq": []byte("⋭"), | ||
| 1061 | "num": []byte("#"), | ||
| 1062 | "numero": []byte("№"), | ||
| 1063 | "nvDash": []byte("⊭"), | ||
| 1064 | "nvdash": []byte("⊬"), | ||
| 1065 | "nvinfin": []byte("⧞"), | ||
| 1066 | "nwarrow": []byte("↖"), | ||
| 1067 | "oacute": []byte("ó"), | ||
| 1068 | "ocirc": []byte("ô"), | ||
| 1069 | "odblac": []byte("ő"), | ||
| 1070 | "oelig": []byte("œ"), | ||
| 1071 | "ograve": []byte("ò"), | ||
| 1072 | "olcross": []byte("⦻"), | ||
| 1073 | "omacr": []byte("ō"), | ||
| 1074 | "omega": []byte("ω"), | ||
| 1075 | "omicron": []byte("ο"), | ||
| 1076 | "ominus": []byte("⊖"), | ||
| 1077 | "order": []byte("ℴ"), | ||
| 1078 | "orderof": []byte("ℴ"), | ||
| 1079 | "origof": []byte("⊶"), | ||
| 1080 | "orslope": []byte("⩗"), | ||
| 1081 | "oslash": []byte("ø"), | ||
| 1082 | "otilde": []byte("õ"), | ||
| 1083 | "otimes": []byte("⊗"), | ||
| 1084 | "otimesas": []byte("⨶"), | ||
| 1085 | "parallel": []byte("∥"), | ||
| 1086 | "percnt": []byte("%"), | ||
| 1087 | "period": []byte("."), | ||
| 1088 | "permil": []byte("‰"), | ||
| 1089 | "perp": []byte("⊥"), | ||
| 1090 | "pertenk": []byte("‱"), | ||
| 1091 | "phmmat": []byte("ℳ"), | ||
| 1092 | "pitchfork": []byte("⋔"), | ||
| 1093 | "planck": []byte("ℏ"), | ||
| 1094 | "planckh": []byte("ℎ"), | ||
| 1095 | "plankv": []byte("ℏ"), | ||
| 1096 | "plus": []byte("+"), | ||
| 1097 | "plusacir": []byte("⨣"), | ||
| 1098 | "pluscir": []byte("⨢"), | ||
| 1099 | "plusdo": []byte("∔"), | ||
| 1100 | "plusmn": []byte("±"), | ||
| 1101 | "plussim": []byte("⨦"), | ||
| 1102 | "plustwo": []byte("⨧"), | ||
| 1103 | "pointint": []byte("⨕"), | ||
| 1104 | "pound": []byte("£"), | ||
| 1105 | "prec": []byte("≺"), | ||
| 1106 | "precapprox": []byte("⪷"), | ||
| 1107 | "preccurlyeq": []byte("≼"), | ||
| 1108 | "preceq": []byte("⪯"), | ||
| 1109 | "precnapprox": []byte("⪹"), | ||
| 1110 | "precneqq": []byte("⪵"), | ||
| 1111 | "precnsim": []byte("⋨"), | ||
| 1112 | "precsim": []byte("≾"), | ||
| 1113 | "primes": []byte("ℙ"), | ||
| 1114 | "prnsim": []byte("⋨"), | ||
| 1115 | "profalar": []byte("⌮"), | ||
| 1116 | "profline": []byte("⌒"), | ||
| 1117 | "profsurf": []byte("⌓"), | ||
| 1118 | "propto": []byte("∝"), | ||
| 1119 | "prurel": []byte("⊰"), | ||
| 1120 | "puncsp": []byte(" "), | ||
| 1121 | "qprime": []byte("⁗"), | ||
| 1122 | "quaternions": []byte("ℍ"), | ||
| 1123 | "quatint": []byte("⨖"), | ||
| 1124 | "quest": []byte("?"), | ||
| 1125 | "questeq": []byte("≟"), | ||
| 1126 | "quot": []byte("\""), | ||
| 1127 | "racute": []byte("ŕ"), | ||
| 1128 | "radic": []byte("√"), | ||
| 1129 | "raemptyv": []byte("⦳"), | ||
| 1130 | "rangle": []byte("⟩"), | ||
| 1131 | "raquo": []byte("»"), | ||
| 1132 | "rarrbfs": []byte("⤠"), | ||
| 1133 | "rarrhk": []byte("↪"), | ||
| 1134 | "rarrlp": []byte("↬"), | ||
| 1135 | "rarrsim": []byte("⥴"), | ||
| 1136 | "rarrtl": []byte("↣"), | ||
| 1137 | "rationals": []byte("ℚ"), | ||
| 1138 | "rbrace": []byte("}"), | ||
| 1139 | "rbrack": []byte("]"), | ||
| 1140 | "rbrksld": []byte("⦎"), | ||
| 1141 | "rbrkslu": []byte("⦐"), | ||
| 1142 | "rcaron": []byte("ř"), | ||
| 1143 | "rcedil": []byte("ŗ"), | ||
| 1144 | "rcub": []byte("}"), | ||
| 1145 | "rdldhar": []byte("⥩"), | ||
| 1146 | "rdquor": []byte("”"), | ||
| 1147 | "real": []byte("ℜ"), | ||
| 1148 | "realine": []byte("ℛ"), | ||
| 1149 | "realpart": []byte("ℜ"), | ||
| 1150 | "reals": []byte("ℝ"), | ||
| 1151 | "rfloor": []byte("⌋"), | ||
| 1152 | "rightarrow": []byte("→"), | ||
| 1153 | "rightarrowtail": []byte("↣"), | ||
| 1154 | "rightharpoondown": []byte("⇁"), | ||
| 1155 | "rightharpoonup": []byte("⇀"), | ||
| 1156 | "rightleftarrows": []byte("⇄"), | ||
| 1157 | "rightleftharpoons": []byte("⇌"), | ||
| 1158 | "rightrightarrows": []byte("⇉"), | ||
| 1159 | "rightsquigarrow": []byte("↝"), | ||
| 1160 | "rightthreetimes": []byte("⋌"), | ||
| 1161 | "risingdotseq": []byte("≓"), | ||
| 1162 | "rmoust": []byte("⎱"), | ||
| 1163 | "rmoustache": []byte("⎱"), | ||
| 1164 | "rotimes": []byte("⨵"), | ||
| 1165 | "rpar": []byte(")"), | ||
| 1166 | "rppolint": []byte("⨒"), | ||
| 1167 | "rsaquo": []byte("›"), | ||
| 1168 | "rsqb": []byte("]"), | ||
| 1169 | "rsquor": []byte("’"), | ||
| 1170 | "rthree": []byte("⋌"), | ||
| 1171 | "rtimes": []byte("⋊"), | ||
| 1172 | "rtriltri": []byte("⧎"), | ||
| 1173 | "ruluhar": []byte("⥨"), | ||
| 1174 | "sacute": []byte("ś"), | ||
| 1175 | "scaron": []byte("š"), | ||
| 1176 | "scedil": []byte("ş"), | ||
| 1177 | "scirc": []byte("ŝ"), | ||
| 1178 | "scnsim": []byte("⋩"), | ||
| 1179 | "scpolint": []byte("⨓"), | ||
| 1180 | "searrow": []byte("↘"), | ||
| 1181 | "semi": []byte(";"), | ||
| 1182 | "seswar": []byte("⤩"), | ||
| 1183 | "setminus": []byte("∖"), | ||
| 1184 | "sfrown": []byte("⌢"), | ||
| 1185 | "shchcy": []byte("щ"), | ||
| 1186 | "shortmid": []byte("∣"), | ||
| 1187 | "shortparallel": []byte("∥"), | ||
| 1188 | "sigma": []byte("σ"), | ||
| 1189 | "sigmaf": []byte("ς"), | ||
| 1190 | "sigmav": []byte("ς"), | ||
| 1191 | "simeq": []byte("≃"), | ||
| 1192 | "simplus": []byte("⨤"), | ||
| 1193 | "simrarr": []byte("⥲"), | ||
| 1194 | "slarr": []byte("←"), | ||
| 1195 | "smallsetminus": []byte("∖"), | ||
| 1196 | "smeparsl": []byte("⧤"), | ||
| 1197 | "smid": []byte("∣"), | ||
| 1198 | "softcy": []byte("ь"), | ||
| 1199 | "sol": []byte("/"), | ||
| 1200 | "solbar": []byte("⌿"), | ||
| 1201 | "spades": []byte("♠"), | ||
| 1202 | "spadesuit": []byte("♠"), | ||
| 1203 | "spar": []byte("∥"), | ||
| 1204 | "sqsube": []byte("⊑"), | ||
| 1205 | "sqsubset": []byte("⊏"), | ||
| 1206 | "sqsubseteq": []byte("⊑"), | ||
| 1207 | "sqsupe": []byte("⊒"), | ||
| 1208 | "sqsupset": []byte("⊐"), | ||
| 1209 | "sqsupseteq": []byte("⊒"), | ||
| 1210 | "square": []byte("□"), | ||
| 1211 | "squarf": []byte("▪"), | ||
| 1212 | "srarr": []byte("→"), | ||
| 1213 | "ssetmn": []byte("∖"), | ||
| 1214 | "ssmile": []byte("⌣"), | ||
| 1215 | "sstarf": []byte("⋆"), | ||
| 1216 | "straightepsilon": []byte("ϵ"), | ||
| 1217 | "straightphi": []byte("ϕ"), | ||
| 1218 | "strns": []byte("¯"), | ||
| 1219 | "subedot": []byte("⫃"), | ||
| 1220 | "submult": []byte("⫁"), | ||
| 1221 | "subplus": []byte("⪿"), | ||
| 1222 | "subrarr": []byte("⥹"), | ||
| 1223 | "subset": []byte("⊂"), | ||
| 1224 | "subseteq": []byte("⊆"), | ||
| 1225 | "subseteqq": []byte("⫅"), | ||
| 1226 | "subsetneq": []byte("⊊"), | ||
| 1227 | "subsetneqq": []byte("⫋"), | ||
| 1228 | "succ": []byte("≻"), | ||
| 1229 | "succapprox": []byte("⪸"), | ||
| 1230 | "succcurlyeq": []byte("≽"), | ||
| 1231 | "succeq": []byte("⪰"), | ||
| 1232 | "succnapprox": []byte("⪺"), | ||
| 1233 | "succneqq": []byte("⪶"), | ||
| 1234 | "succnsim": []byte("⋩"), | ||
| 1235 | "succsim": []byte("≿"), | ||
| 1236 | "supdsub": []byte("⫘"), | ||
| 1237 | "supedot": []byte("⫄"), | ||
| 1238 | "suphsol": []byte("⟉"), | ||
| 1239 | "suphsub": []byte("⫗"), | ||
| 1240 | "suplarr": []byte("⥻"), | ||
| 1241 | "supmult": []byte("⫂"), | ||
| 1242 | "supplus": []byte("⫀"), | ||
| 1243 | "supset": []byte("⊃"), | ||
| 1244 | "supseteq": []byte("⊇"), | ||
| 1245 | "supseteqq": []byte("⫆"), | ||
| 1246 | "supsetneq": []byte("⊋"), | ||
| 1247 | "supsetneqq": []byte("⫌"), | ||
| 1248 | "swarrow": []byte("↙"), | ||
| 1249 | "szlig": []byte("ß"), | ||
| 1250 | "target": []byte("⌖"), | ||
| 1251 | "tcaron": []byte("ť"), | ||
| 1252 | "tcedil": []byte("ţ"), | ||
| 1253 | "telrec": []byte("⌕"), | ||
| 1254 | "there4": []byte("∴"), | ||
| 1255 | "therefore": []byte("∴"), | ||
| 1256 | "theta": []byte("θ"), | ||
| 1257 | "thetasym": []byte("ϑ"), | ||
| 1258 | "thetav": []byte("ϑ"), | ||
| 1259 | "thickapprox": []byte("≈"), | ||
| 1260 | "thicksim": []byte("∼"), | ||
| 1261 | "thinsp": []byte(" "), | ||
| 1262 | "thkap": []byte("≈"), | ||
| 1263 | "thksim": []byte("∼"), | ||
| 1264 | "thorn": []byte("þ"), | ||
| 1265 | "tilde": []byte("˜"), | ||
| 1266 | "times": []byte("×"), | ||
| 1267 | "timesb": []byte("⊠"), | ||
| 1268 | "timesbar": []byte("⨱"), | ||
| 1269 | "topbot": []byte("⌶"), | ||
| 1270 | "topfork": []byte("⫚"), | ||
| 1271 | "tprime": []byte("‴"), | ||
| 1272 | "triangle": []byte("▵"), | ||
| 1273 | "triangledown": []byte("▿"), | ||
| 1274 | "triangleleft": []byte("◃"), | ||
| 1275 | "trianglelefteq": []byte("⊴"), | ||
| 1276 | "triangleq": []byte("≜"), | ||
| 1277 | "triangleright": []byte("▹"), | ||
| 1278 | "trianglerighteq": []byte("⊵"), | ||
| 1279 | "tridot": []byte("◬"), | ||
| 1280 | "triminus": []byte("⨺"), | ||
| 1281 | "triplus": []byte("⨹"), | ||
| 1282 | "tritime": []byte("⨻"), | ||
| 1283 | "trpezium": []byte("⏢"), | ||
| 1284 | "tstrok": []byte("ŧ"), | ||
| 1285 | "twoheadleftarrow": []byte("↞"), | ||
| 1286 | "twoheadrightarrow": []byte("↠"), | ||
| 1287 | "uacute": []byte("ú"), | ||
| 1288 | "ubreve": []byte("ŭ"), | ||
| 1289 | "ucirc": []byte("û"), | ||
| 1290 | "udblac": []byte("ű"), | ||
| 1291 | "ugrave": []byte("ù"), | ||
| 1292 | "ulcorn": []byte("⌜"), | ||
| 1293 | "ulcorner": []byte("⌜"), | ||
| 1294 | "ulcrop": []byte("⌏"), | ||
| 1295 | "umacr": []byte("ū"), | ||
| 1296 | "uogon": []byte("ų"), | ||
| 1297 | "uparrow": []byte("↑"), | ||
| 1298 | "updownarrow": []byte("↕"), | ||
| 1299 | "upharpoonleft": []byte("↿"), | ||
| 1300 | "upharpoonright": []byte("↾"), | ||
| 1301 | "upsih": []byte("ϒ"), | ||
| 1302 | "upsilon": []byte("υ"), | ||
| 1303 | "upuparrows": []byte("⇈"), | ||
| 1304 | "urcorn": []byte("⌝"), | ||
| 1305 | "urcorner": []byte("⌝"), | ||
| 1306 | "urcrop": []byte("⌎"), | ||
| 1307 | "uring": []byte("ů"), | ||
| 1308 | "utilde": []byte("ũ"), | ||
| 1309 | "uwangle": []byte("⦧"), | ||
| 1310 | "varepsilon": []byte("ϵ"), | ||
| 1311 | "varkappa": []byte("ϰ"), | ||
| 1312 | "varnothing": []byte("∅"), | ||
| 1313 | "varphi": []byte("ϕ"), | ||
| 1314 | "varpi": []byte("ϖ"), | ||
| 1315 | "varpropto": []byte("∝"), | ||
| 1316 | "varrho": []byte("ϱ"), | ||
| 1317 | "varsigma": []byte("ς"), | ||
| 1318 | "vartheta": []byte("ϑ"), | ||
| 1319 | "vartriangleleft": []byte("⊲"), | ||
| 1320 | "vartriangleright": []byte("⊳"), | ||
| 1321 | "vee": []byte("∨"), | ||
| 1322 | "veebar": []byte("⊻"), | ||
| 1323 | "vellip": []byte("⋮"), | ||
| 1324 | "verbar": []byte("|"), | ||
| 1325 | "vert": []byte("|"), | ||
| 1326 | "vprop": []byte("∝"), | ||
| 1327 | "vzigzag": []byte("⦚"), | ||
| 1328 | "wcirc": []byte("ŵ"), | ||
| 1329 | "wedge": []byte("∧"), | ||
| 1330 | "wedgeq": []byte("≙"), | ||
| 1331 | "weierp": []byte("℘"), | ||
| 1332 | "wreath": []byte("≀"), | ||
| 1333 | "xvee": []byte("⋁"), | ||
| 1334 | "xwedge": []byte("⋀"), | ||
| 1335 | "yacute": []byte("ý"), | ||
| 1336 | "ycirc": []byte("ŷ"), | ||
| 1337 | "zacute": []byte("ź"), | ||
| 1338 | "zcaron": []byte("ž"), | ||
| 1339 | "zeetrf": []byte("ℨ"), | ||
| 1340 | "zigrarr": []byte("⇝"), | ||
| 1341 | } | ||
| 1342 | |||
| 1343 | // TextRevEntitiesMap is a map of escapes. | ||
| 1344 | var TextRevEntitiesMap = map[byte][]byte{ | ||
| 1345 | '<': []byte("<"), | ||
| 1346 | } | ||
