diff options
| author | 2025-08-10 15:05:54 +0200 | |
|---|---|---|
| committer | 2025-08-10 15:05:54 +0200 | |
| commit | 67100809b399b60e58490fa8b1c0a72be75ac820 (patch) | |
| tree | ae6df939bf9fe557a766120bee3363f89b47f961 /vendor/github.com | |
| parent | [feature + performance] add JSON logging format (#4355) (diff) | |
| download | gotosocial-67100809b399b60e58490fa8b1c0a72be75ac820.tar.xz | |
[chore] update dependencies (#4361)
- codeberg.org/gruf/go-kv/v2 v2.0.5 => v2.0.6
- github.com/coreos/go-oidc/v3 v3.14.1 => v3.15.0
- github.com/miekg/dns v1.1.67 => v1.1.68
- github.com/tdewolff/minify/v2 v2.23.9 => v2.23.11
- github.com/yuin/goldmark v1.7.12 => v1.7.13
- golang.org/x/crypto v0.40.0 => v0.41.0
- golang.org/x/image v0.29.0 => v0.30.0
- golang.org/x/net v0.42.0 => v0.43.0
- golang.org/x/sys v0.34.0 => v0.35.0
- golang.org/x/text v0.27.0 => v0.28.0
- modernc.org/sqlite v1.38.0 => v1.38.2
Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4361
Co-authored-by: kim <grufwub@gmail.com>
Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'vendor/github.com')
| -rw-r--r-- | vendor/github.com/coreos/go-oidc/v3/oidc/verify.go | 99 | ||||
| -rw-r--r-- | vendor/github.com/miekg/dns/server.go | 10 | ||||
| -rw-r--r-- | vendor/github.com/miekg/dns/version.go | 2 | ||||
| -rw-r--r-- | vendor/github.com/tdewolff/minify/v2/html/hash.go | 825 | ||||
| -rw-r--r-- | vendor/github.com/tdewolff/minify/v2/html/html.go | 15 | ||||
| -rw-r--r-- | vendor/github.com/tdewolff/minify/v2/publish.sh | 3 | ||||
| -rw-r--r-- | vendor/github.com/tdewolff/parse/v2/html/hash.go | 64 | ||||
| -rw-r--r-- | vendor/github.com/tdewolff/parse/v2/html/lex.go | 21 | ||||
| -rw-r--r-- | vendor/github.com/yuin/goldmark/README.md | 1 | ||||
| -rw-r--r-- | vendor/github.com/yuin/goldmark/parser/fcode_block.go | 5 |
10 files changed, 668 insertions, 377 deletions
diff --git a/vendor/github.com/coreos/go-oidc/v3/oidc/verify.go b/vendor/github.com/coreos/go-oidc/v3/oidc/verify.go index 52b27b746..a8bf107d4 100644 --- a/vendor/github.com/coreos/go-oidc/v3/oidc/verify.go +++ b/vendor/github.com/coreos/go-oidc/v3/oidc/verify.go @@ -1,15 +1,11 @@ package oidc import ( - "bytes" "context" - "encoding/base64" "encoding/json" - "errors" "fmt" "io" "net/http" - "strings" "time" jose "github.com/go-jose/go-jose/v4" @@ -145,18 +141,6 @@ func (p *Provider) newVerifier(keySet KeySet, config *Config) *IDTokenVerifier { return NewVerifier(p.issuer, keySet, config) } -func parseJWT(p string) ([]byte, error) { - parts := strings.Split(p, ".") - if len(parts) < 2 { - return nil, fmt.Errorf("oidc: malformed jwt, expected 3 parts got %d", len(parts)) - } - payload, err := base64.RawURLEncoding.DecodeString(parts[1]) - if err != nil { - return nil, fmt.Errorf("oidc: malformed jwt payload: %v", err) - } - return payload, nil -} - func contains(sli []string, ele string) bool { for _, s := range sli { if s == ele { @@ -219,12 +203,49 @@ func resolveDistributedClaim(ctx context.Context, verifier *IDTokenVerifier, src // // token, err := verifier.Verify(ctx, rawIDToken) func (v *IDTokenVerifier) Verify(ctx context.Context, rawIDToken string) (*IDToken, error) { - // Throw out tokens with invalid claims before trying to verify the token. This lets - // us do cheap checks before possibly re-syncing keys. - payload, err := parseJWT(rawIDToken) + var supportedSigAlgs []jose.SignatureAlgorithm + for _, alg := range v.config.SupportedSigningAlgs { + supportedSigAlgs = append(supportedSigAlgs, jose.SignatureAlgorithm(alg)) + } + if len(supportedSigAlgs) == 0 { + // If no algorithms were specified by both the config and discovery, default + // to the one mandatory algorithm "RS256". + supportedSigAlgs = []jose.SignatureAlgorithm{jose.RS256} + } + if v.config.InsecureSkipSignatureCheck { + // "none" is a required value to even parse a JWT with the "none" algorithm + // using go-jose. + supportedSigAlgs = append(supportedSigAlgs, "none") + } + + // Parse and verify the signature first. This at least forces the user to have + // a valid, signed ID token before we do any other processing. + jws, err := jose.ParseSigned(rawIDToken, supportedSigAlgs) if err != nil { return nil, fmt.Errorf("oidc: malformed jwt: %v", err) } + switch len(jws.Signatures) { + case 0: + return nil, fmt.Errorf("oidc: id token not signed") + case 1: + default: + return nil, fmt.Errorf("oidc: multiple signatures on id token not supported") + } + sig := jws.Signatures[0] + + var payload []byte + if v.config.InsecureSkipSignatureCheck { + // Yolo mode. + payload = jws.UnsafePayloadWithoutVerification() + } else { + // The JWT is attached here for the happy path to avoid the verifier from + // having to parse the JWT twice. + ctx = context.WithValue(ctx, parsedJWTKey, jws) + payload, err = v.keySet.VerifySignature(ctx, rawIDToken) + if err != nil { + return nil, fmt.Errorf("failed to verify signature: %v", err) + } + } var token idToken if err := json.Unmarshal(payload, &token); err != nil { return nil, fmt.Errorf("oidc: failed to unmarshal claims: %v", err) @@ -254,6 +275,7 @@ func (v *IDTokenVerifier) Verify(ctx context.Context, rawIDToken string) (*IDTok AccessTokenHash: token.AtHash, claims: payload, distributedClaims: distributedClaims, + sigAlgorithm: sig.Header.Algorithm, } // Check issuer. @@ -306,45 +328,6 @@ func (v *IDTokenVerifier) Verify(ctx context.Context, rawIDToken string) (*IDTok } } - if v.config.InsecureSkipSignatureCheck { - return t, nil - } - - var supportedSigAlgs []jose.SignatureAlgorithm - for _, alg := range v.config.SupportedSigningAlgs { - supportedSigAlgs = append(supportedSigAlgs, jose.SignatureAlgorithm(alg)) - } - if len(supportedSigAlgs) == 0 { - // If no algorithms were specified by both the config and discovery, default - // to the one mandatory algorithm "RS256". - supportedSigAlgs = []jose.SignatureAlgorithm{jose.RS256} - } - jws, err := jose.ParseSigned(rawIDToken, supportedSigAlgs) - if err != nil { - return nil, fmt.Errorf("oidc: malformed jwt: %v", err) - } - - switch len(jws.Signatures) { - case 0: - return nil, fmt.Errorf("oidc: id token not signed") - case 1: - default: - return nil, fmt.Errorf("oidc: multiple signatures on id token not supported") - } - sig := jws.Signatures[0] - t.sigAlgorithm = sig.Header.Algorithm - - ctx = context.WithValue(ctx, parsedJWTKey, jws) - gotPayload, err := v.keySet.VerifySignature(ctx, rawIDToken) - if err != nil { - return nil, fmt.Errorf("failed to verify signature: %v", err) - } - - // Ensure that the payload returned by the square actually matches the payload parsed earlier. - if !bytes.Equal(gotPayload, payload) { - return nil, errors.New("oidc: internal error, payload parsed did not match previous payload") - } - return t, nil } diff --git a/vendor/github.com/miekg/dns/server.go b/vendor/github.com/miekg/dns/server.go index 2b4630f38..364149cfc 100644 --- a/vendor/github.com/miekg/dns/server.go +++ b/vendor/github.com/miekg/dns/server.go @@ -44,8 +44,6 @@ type ResponseWriter interface { LocalAddr() net.Addr // RemoteAddr returns the net.Addr of the client that sent the current request. RemoteAddr() net.Addr - // Network returns the value of the Net field of the Server (e.g., "tcp", "tcp-tls"). - Network() string // WriteMsg writes a reply back to the client. WriteMsg(*Msg) error // Write writes a raw buffer back to the client. @@ -79,7 +77,6 @@ type response struct { udpSession *SessionUDP // oob data to get egress interface right pcSession net.Addr // address to use when writing to a generic net.PacketConn writer Writer // writer to output the raw DNS bits - network string // corresponding Server.Net value } // handleRefused returns a HandlerFunc that returns REFUSED for every request it gets. @@ -560,7 +557,7 @@ func (srv *Server) serveUDP(l net.PacketConn) error { // Serve a new TCP connection. func (srv *Server) serveTCPConn(wg *sync.WaitGroup, rw net.Conn) { - w := &response{tsigProvider: srv.tsigProvider(), tcp: rw, network: srv.Net} + w := &response{tsigProvider: srv.tsigProvider(), tcp: rw} if srv.DecorateWriter != nil { w.writer = srv.DecorateWriter(w) } else { @@ -615,7 +612,7 @@ func (srv *Server) serveTCPConn(wg *sync.WaitGroup, rw net.Conn) { // Serve a new UDP request. func (srv *Server) serveUDPPacket(wg *sync.WaitGroup, m []byte, u net.PacketConn, udpSession *SessionUDP, pcSession net.Addr) { - w := &response{tsigProvider: srv.tsigProvider(), udp: u, udpSession: udpSession, pcSession: pcSession, network: srv.Net} + w := &response{tsigProvider: srv.tsigProvider(), udp: u, udpSession: udpSession, pcSession: pcSession} if srv.DecorateWriter != nil { w.writer = srv.DecorateWriter(w) } else { @@ -821,9 +818,6 @@ func (w *response) RemoteAddr() net.Addr { } } -// Network implements the ResponseWriter.Network method. -func (w *response) Network() string { return w.network } - // TsigStatus implements the ResponseWriter.TsigStatus method. func (w *response) TsigStatus() error { return w.tsigStatus } diff --git a/vendor/github.com/miekg/dns/version.go b/vendor/github.com/miekg/dns/version.go index 4d402489f..4af7d286c 100644 --- a/vendor/github.com/miekg/dns/version.go +++ b/vendor/github.com/miekg/dns/version.go @@ -3,7 +3,7 @@ package dns import "fmt" // Version is current version of this library. -var Version = v{1, 1, 67} +var Version = v{1, 1, 68} // v holds the version of this library. type v struct { diff --git a/vendor/github.com/tdewolff/minify/v2/html/hash.go b/vendor/github.com/tdewolff/minify/v2/html/hash.go index 5eefcebb0..ce337c869 100644 --- a/vendor/github.com/tdewolff/minify/v2/html/hash.go +++ b/vendor/github.com/tdewolff/minify/v2/html/hash.go @@ -1,14 +1,12 @@ package html -// generated by hasher -type=Hash -file=hash.go; DO NOT EDIT, except for adding more constants to the list and rerun go generate - // uses github.com/tdewolff/hasher //go:generate hasher -type=Hash -file=hash.go // Hash defines perfect hashes for a predefined list of strings type Hash uint32 -// Unique hash definitions to be used instead of strings +// Identifiers for the hashes associated with the text in the comments. const ( A Hash = 0x1 // a Abbr Hash = 0x40004 // abbr @@ -277,22 +275,297 @@ const ( Xmp Hash = 0x7903 // xmp ) -// String returns the hash' name. +//var HashMap = map[string]Hash{ +// "a": A, +// "abbr": Abbr, +// "about": About, +// "accept": Accept, +// "accept-charset": Accept_Charset, +// "accesskey": Accesskey, +// "acronym": Acronym, +// "action": Action, +// "address": Address, +// "allow": Allow, +// "allowfullscreen": Allowfullscreen, +// "amp-boilerplate": Amp_Boilerplate, +// "applet": Applet, +// "area": Area, +// "article": Article, +// "as": As, +// "aside": Aside, +// "async": Async, +// "audio": Audio, +// "autocapitalize": Autocapitalize, +// "autocomplete": Autocomplete, +// "autofocus": Autofocus, +// "autoplay": Autoplay, +// "b": B, +// "base": Base, +// "basefont": Basefont, +// "bb": Bb, +// "bdi": Bdi, +// "bdo": Bdo, +// "big": Big, +// "blocking": Blocking, +// "blockquote": Blockquote, +// "body": Body, +// "br": Br, +// "button": Button, +// "canvas": Canvas, +// "caption": Caption, +// "capture": Capture, +// "center": Center, +// "charset": Charset, +// "checked": Checked, +// "cite": Cite, +// "class": Class, +// "code": Code, +// "col": Col, +// "colgroup": Colgroup, +// "color": Color, +// "cols": Cols, +// "colspan": Colspan, +// "content": Content, +// "contenteditable": Contenteditable, +// "controls": Controls, +// "coords": Coords, +// "crossorigin": Crossorigin, +// "data": Data, +// "datalist": Datalist, +// "datatype": Datatype, +// "datetime": Datetime, +// "dd": Dd, +// "decoding": Decoding, +// "default": Default, +// "defer": Defer, +// "del": Del, +// "details": Details, +// "dfn": Dfn, +// "dialog": Dialog, +// "dir": Dir, +// "disabled": Disabled, +// "div": Div, +// "dl": Dl, +// "draggable": Draggable, +// "dt": Dt, +// "em": Em, +// "embed": Embed, +// "enctype": Enctype, +// "enterkeyhint": Enterkeyhint, +// "fetchpriority": Fetchpriority, +// "fieldset": Fieldset, +// "figcaption": Figcaption, +// "figure": Figure, +// "font": Font, +// "footer": Footer, +// "for": For, +// "form": Form, +// "formaction": Formaction, +// "formenctype": Formenctype, +// "formmethod": Formmethod, +// "formnovalidate": Formnovalidate, +// "formtarget": Formtarget, +// "frame": Frame, +// "frameset": Frameset, +// "h1": H1, +// "h2": H2, +// "h3": H3, +// "h4": H4, +// "h5": H5, +// "h6": H6, +// "head": Head, +// "header": Header, +// "headers": Headers, +// "height": Height, +// "hgroup": Hgroup, +// "hidden": Hidden, +// "high": High, +// "hr": Hr, +// "href": Href, +// "hreflang": Hreflang, +// "html": Html, +// "http-equiv": Http_Equiv, +// "i": I, +// "id": Id, +// "iframe": Iframe, +// "image": Image, +// "imagesizes": Imagesizes, +// "imagesrcset": Imagesrcset, +// "img": Img, +// "inert": Inert, +// "inlist": Inlist, +// "input": Input, +// "inputmode": Inputmode, +// "ins": Ins, +// "is": Is, +// "ismap": Ismap, +// "itemid": Itemid, +// "itemprop": Itemprop, +// "itemref": Itemref, +// "itemscope": Itemscope, +// "itemtype": Itemtype, +// "kbd": Kbd, +// "kind": Kind, +// "label": Label, +// "lang": Lang, +// "legend": Legend, +// "li": Li, +// "link": Link, +// "list": List, +// "loading": Loading, +// "loop": Loop, +// "low": Low, +// "main": Main, +// "map": Map, +// "mark": Mark, +// "marquee": Marquee, +// "math": Math, +// "max": Max, +// "maxlength": Maxlength, +// "media": Media, +// "menu": Menu, +// "menuitem": Menuitem, +// "meta": Meta, +// "meter": Meter, +// "method": Method, +// "min": Min, +// "minlength": Minlength, +// "multiple": Multiple, +// "muted": Muted, +// "name": Name, +// "nav": Nav, +// "nobr": Nobr, +// "noembed": Noembed, +// "noframes": Noframes, +// "nomodule": Nomodule, +// "noscript": Noscript, +// "novalidate": Novalidate, +// "object": Object, +// "ol": Ol, +// "open": Open, +// "optgroup": Optgroup, +// "optimum": Optimum, +// "option": Option, +// "output": Output, +// "p": P, +// "param": Param, +// "pattern": Pattern, +// "picture": Picture, +// "ping": Ping, +// "plaintext": Plaintext, +// "playsinline": Playsinline, +// "popover": Popover, +// "popovertarget": Popovertarget, +// "popovertargetaction": Popovertargetaction, +// "portal": Portal, +// "poster": Poster, +// "pre": Pre, +// "prefix": Prefix, +// "preload": Preload, +// "profile": Profile, +// "progress": Progress, +// "property": Property, +// "q": Q, +// "rb": Rb, +// "readonly": Readonly, +// "referrerpolicy": Referrerpolicy, +// "rel": Rel, +// "required": Required, +// "resource": Resource, +// "rev": Rev, +// "reversed": Reversed, +// "rows": Rows, +// "rowspan": Rowspan, +// "rp": Rp, +// "rt": Rt, +// "rtc": Rtc, +// "ruby": Ruby, +// "s": S, +// "samp": Samp, +// "sandbox": Sandbox, +// "scope": Scope, +// "script": Script, +// "section": Section, +// "select": Select, +// "selected": Selected, +// "shadowrootdelegatesfocus": Shadowrootdelegatesfocus, +// "shadowrootmode": Shadowrootmode, +// "shape": Shape, +// "size": Size, +// "sizes": Sizes, +// "slot": Slot, +// "small": Small, +// "source": Source, +// "span": Span, +// "spellcheck": Spellcheck, +// "src": Src, +// "srclang": Srclang, +// "srcset": Srcset, +// "start": Start, +// "step": Step, +// "strike": Strike, +// "strong": Strong, +// "style": Style, +// "sub": Sub, +// "summary": Summary, +// "sup": Sup, +// "svg": Svg, +// "tabindex": Tabindex, +// "table": Table, +// "target": Target, +// "tbody": Tbody, +// "td": Td, +// "template": Template, +// "text": Text, +// "textarea": Textarea, +// "tfoot": Tfoot, +// "th": Th, +// "thead": Thead, +// "time": Time, +// "title": Title, +// "tr": Tr, +// "track": Track, +// "translate": Translate, +// "tt": Tt, +// "type": Type, +// "typeof": Typeof, +// "u": U, +// "ul": Ul, +// "usemap": Usemap, +// "value": Value, +// "var": Var, +// "video": Video, +// "vocab": Vocab, +// "wbr": Wbr, +// "width": Width, +// "wrap": Wrap, +// "xmlns": Xmlns, +// "xmp": Xmp, +//} + +// String returns the text associated with the hash. func (i Hash) String() string { + return string(i.Bytes()) +} + +// Bytes returns the text associated with the hash. +func (i Hash) Bytes() []byte { start := uint32(i >> 8) n := uint32(i & 0xff) if start+n > uint32(len(_Hash_text)) { - return "" + return []byte{} } return _Hash_text[start : start+n] } -// ToHash returns the hash whose name is s. It returns zero if there is no -// such hash. It is case sensitive. +// ToHash returns a hash Hash for a given []byte. Hash is a uint32 that is associated with the text in []byte. It returns zero if no match found. func ToHash(s []byte) Hash { if len(s) == 0 || len(s) > _Hash_maxLen { return 0 } + //if 3 < len(s) { + // return HashMap[string(s)] + //} h := uint32(_Hash_hash0) for i := 0; i < len(s); i++ { h ^= uint32(s[i]) @@ -320,9 +593,11 @@ NEXT: return 0 } -const _Hash_hash0 = 0x51243bbc +const _Hash_hash0 = 0x87d8a7d9 const _Hash_maxLen = 24 -const _Hash_text = "aboutputbodyaccept-charsetfooterbasefontitleaccesskeyacronym" + + +var _Hash_text = []byte("" + + "aboutputbodyaccept-charsetfooterbasefontitleaccesskeyacronym" + "ainputmodeferowspanametabindexmlnsamp-boilerplateaddressandb" + "oxmparamarkbdirubyasyncanvasidecodingaudiobjectrackindatalis" + "tepatternavalueautocapitalizeautocompletemplateautofocusemap" + @@ -339,272 +614,272 @@ const _Hash_text = "aboutputbodyaccept-charsetfooterbasefontitleaccesskeyacronym "mreferrerpolicyitemscopenitemtypematheaderspellcheckedmaxlen" + "gth2meterminlength3multiplemutedprefixpreloadingprofileprogr" + "essrclangstrikestrongstylesubdoptimumarqueesummarysuportalsv" + - "gvocabbrwbrwidth4wraposter" + "gvocabbrwbrwidth4wraposter") var _Hash_table = [1 << 9]Hash{ - 0x0: 0x4405, // defer - 0x5: 0x18002, // ol - 0x6: 0x3720a, // spellcheck - 0x7: 0x40b02, // h4 - 0x8: 0x40705, // width - 0x9: 0x9402, // id - 0xb: 0x14904, // nobr - 0xc: 0x31d05, // small - 0xf: 0x2b506, // hgroup - 0x10: 0x27702, // th - 0x15: 0x24f06, // center - 0x18: 0xd10c, // autocomplete - 0x1b: 0x2c304, // area - 0x1e: 0x17f03, // col - 0x1f: 0x2a106, // height - 0x21: 0x4b04, // span - 0x22: 0x37e03, // max - 0x23: 0x3cf06, // strong - 0x24: 0x501, // p - 0x29: 0x24b06, // source - 0x2c: 0x8e06, // canvas - 0x2d: 0x2c09, // accesskey - 0x2e: 0x18607, // picture - 0x30: 0x3a403, // pre - 0x31: 0x5d04, // samp - 0x34: 0x40902, // dt - 0x36: 0x30505, // sizes - 0x37: 0x1a908, // nomodule - 0x39: 0x2a504, // html - 0x3a: 0x31203, // src - 0x3c: 0x28d06, // dialog - 0x3e: 0x3ab03, // rel - 0x40: 0x1a06, // footer - 0x43: 0x30d0b, // imagesrcset - 0x46: 0x3c906, // strike - 0x47: 0x2e805, // video - 0x4a: 0x2d702, // hr - 0x4b: 0x36108, // itemtype - 0x4c: 0x1c804, // link - 0x4e: 0x6702, // rp - 0x4f: 0x2801, // i - 0x50: 0xee06, // applet - 0x51: 0x17f08, // colgroup - 0x53: 0x1905, // tfoot - 0x54: 0xc06, // accept - 0x57: 0x14d04, // cite - 0x58: 0x1307, // charset - 0x59: 0x17604, // code - 0x5a: 0x4e04, // name - 0x5b: 0x2bf04, // text - 0x5d: 0x31f05, // allow - 0x5e: 0x36c04, // head - 0x61: 0x16605, // embed - 0x62: 0x3fa03, // svg - 0x63: 0x3fd05, // vocab - 0x64: 0x5e0f, // amp-boilerplate - 0x65: 0x38805, // meter - 0x67: 0x3320d, // popovertarget - 0x69: 0x3b04, // main - 0x6a: 0x41006, // poster - 0x6c: 0x1c302, // dl - 0x6e: 0x26006, // action - 0x71: 0x17807, // default - 0x72: 0x3d05, // input - 0x74: 0xb202, // is - 0x75: 0x27506, // method - 0x79: 0x7903, // xmp - 0x7a: 0x101, // b - 0x7b: 0x21f06, // inlist - 0x7c: 0x25c0a, // formaction - 0x7e: 0x39708, // multiple - 0x80: 0x1f203, // del - 0x81: 0x26a07, // enctype - 0x83: 0x27b0e, // formnovalidate - 0x84: 0x2404, // font - 0x85: 0x11d06, // typeof - 0x86: 0x2d704, // href - 0x87: 0x13a0a, // blockquote - 0x88: 0x4807, // rowspan - 0x89: 0x3aa07, // preload - 0x8a: 0x12f03, // big - 0x8c: 0x38d09, // minlength - 0x90: 0x1bb05, // table - 0x91: 0x39f05, // muted - 0x92: 0x3e407, // marquee - 0x94: 0x3507, // acronym - 0x96: 0x40d04, // wrap - 0x98: 0x14b02, // br - 0x9a: 0x10b02, // rt - 0x9e: 0xa602, // tr - 0x9f: 0x35709, // itemscope - 0xa4: 0xad04, // data - 0xa5: 0x29706, // target - 0xac: 0x11908, // datatype - 0xae: 0xb304, // step - 0xb3: 0x1cc08, // controls - 0xb5: 0xbe05, // value - 0xb6: 0x2ba09, // plaintext - 0xb7: 0x1da09, // draggable - 0xc0: 0x8a05, // async - 0xc2: 0x2a804, // loop - 0xc3: 0x28904, // time - 0xc6: 0x2004, // base - 0xc7: 0x23f06, // script - 0xce: 0x32103, // low - 0xcf: 0x3dc03, // bdo - 0xd1: 0x18b03, // rev - 0xd2: 0x1e306, // coords - 0xd3: 0x8403, // dir - 0xd4: 0x2f608, // menuitem - 0xd6: 0x22507, // article - 0xd8: 0x11d04, // type - 0xda: 0x18b08, // reversed - 0xdb: 0x23707, // caption - 0xdc: 0x35d04, // open - 0xdd: 0x1701, // s - 0xe0: 0x2705, // title - 0xe1: 0x9508, // decoding - 0xe3: 0xc0e, // accept-charset - 0xe4: 0x15a05, // class - 0xe5: 0x3f203, // sup - 0xe6: 0xdb08, // template - 0xe7: 0x16c08, // noframes - 0xe8: 0x3ad07, // loading - 0xeb: 0xa106, // object - 0xee: 0x3da03, // sub - 0xef: 0x2fa06, // itemid - 0xf0: 0x30904, // slot - 0xf1: 0x8604, // ruby - 0xf4: 0x1f102, // td - 0xf5: 0x11208, // required - 0xf9: 0x16e05, // frame - 0xfc: 0x2102, // as - 0xfd: 0x37e09, // maxlength - 0xff: 0x31f0f, // allowfullscreen - 0x101: 0x2160b, // crossorigin - 0x102: 0xed03, // map - 0x104: 0x6e02, // dd - 0x105: 0x705, // tbody - 0x107: 0x2d502, // h1 - 0x109: 0x5004, // meta - 0x10a: 0x1, // a - 0x10c: 0x16a03, // dfn - 0x10e: 0x34507, // itemref - 0x110: 0x38d03, // min - 0x111: 0x28508, // datetime - 0x114: 0xdc02, // em - 0x115: 0x7f04, // mark - 0x119: 0x2d708, // hreflang - 0x11a: 0x3de07, // optimum - 0x11c: 0x1220d, // fetchpriority - 0x11d: 0x39502, // h3 - 0x11e: 0x5905, // xmlns - 0x11f: 0x19903, // div - 0x121: 0x40403, // wbr - 0x128: 0x2bf08, // textarea - 0x129: 0x3d505, // style - 0x12a: 0x3f406, // portal - 0x12b: 0x1b107, // content - 0x12d: 0x19b03, // var - 0x12f: 0x40004, // abbr - 0x133: 0x31803, // img - 0x138: 0x35b05, // scope - 0x13b: 0x30504, // size - 0x13e: 0x29f02, // h6 - 0x141: 0xfc08, // autoplay - 0x142: 0x2c408, // readonly - 0x143: 0x3d09, // inputmode - 0x144: 0x19208, // disabled - 0x145: 0x4804, // rows - 0x149: 0x3490e, // referrerpolicy - 0x14a: 0x1c405, // label - 0x14b: 0x36c06, // header - 0x14c: 0xad08, // datalist - 0x14d: 0xe309, // autofocus - 0x14e: 0xb607, // pattern - 0x150: 0x2cc06, // hidden - 0x151: 0x5, // about - 0x152: 0x14406, // button - 0x154: 0x2f206, // iframe - 0x155: 0x1d308, // selected - 0x156: 0x3c207, // srclang - 0x15b: 0xb102, // li - 0x15c: 0x22305, // start - 0x15d: 0x7307, // sandbox - 0x15e: 0x31b03, // ins - 0x162: 0x1a307, // colspan - 0x163: 0x1ff0e, // shadowrootmode - 0x164: 0xb104, // list - 0x166: 0x5208, // tabindex - 0x169: 0x3b407, // profile - 0x16b: 0x301, // u - 0x16c: 0x23d08, // noscript - 0x16e: 0x2660b, // formenctype - 0x16f: 0x16e08, // frameset - 0x170: 0x28b05, // media - 0x174: 0x2008, // basefont - 0x176: 0x2b104, // ping - 0x177: 0x3bb08, // progress - 0x178: 0x206, // output - 0x17a: 0x36904, // math - 0x17b: 0x2930a, // formtarget - 0x17d: 0x7b05, // param - 0x180: 0x13208, // blocking - 0x185: 0x37707, // checked - 0x188: 0x32e05, // ismap - 0x18a: 0x38602, // h2 - 0x18c: 0x2df0a, // http-equiv - 0x18e: 0x10d07, // capture - 0x190: 0x2db04, // lang - 0x195: 0x27f0a, // novalidate - 0x197: 0x1a304, // cols - 0x198: 0x804, // body - 0x199: 0xbc03, // nav - 0x19a: 0x1b10f, // contenteditable - 0x19b: 0x15e07, // section - 0x19e: 0x14e08, // itemprop - 0x19f: 0x15208, // property - 0x1a1: 0xc30e, // autocapitalize - 0x1a4: 0x3eb07, // summary - 0x1a6: 0x1000b, // playsinline - 0x1a9: 0x8303, // bdi - 0x1ab: 0x29d02, // h5 - 0x1ac: 0x6d07, // address - 0x1b0: 0x2d204, // high - 0x1b1: 0x33207, // popover - 0x1b3: 0xa605, // track - 0x1b6: 0x8203, // kbd - 0x1b7: 0x11401, // q - 0x1b8: 0x2340a, // figcaption - 0x1b9: 0x30005, // image - 0x1ba: 0x25c04, // form - 0x1c1: 0x3000a, // imagesizes - 0x1c4: 0x1e818, // shadowrootdelegatesfocus - 0x1c5: 0x2ec06, // option - 0x1c6: 0x9d05, // audio - 0x1c8: 0x40102, // bb - 0x1c9: 0x16407, // noembed - 0x1cc: 0x10805, // inert - 0x1cf: 0x1d306, // select - 0x1d1: 0x22c08, // fieldset - 0x1d2: 0x31206, // srcset - 0x1d3: 0x2f604, // menu - 0x1d5: 0x36c07, // headers - 0x1dd: 0x1be06, // legend - 0x1de: 0xaa04, // kind - 0x1e0: 0x24908, // resource - 0x1e2: 0xf309, // translate - 0x1e4: 0x2aa08, // optgroup - 0x1e6: 0x33213, // popovertargetaction - 0x1e7: 0x2710a, // formmethod - 0x1e9: 0xb802, // tt - 0x1ea: 0x36b05, // thead - 0x1eb: 0x17c02, // ul - 0x1ee: 0x3a406, // prefix - 0x1ef: 0x19e05, // color - 0x1f1: 0x21105, // shape - 0x1f3: 0x25c03, // for - 0x1f4: 0x2500c, // enterkeyhint - 0x1f7: 0xea06, // usemap - 0x1f8: 0x1f02, // rb - 0x1fa: 0x20b07, // details - 0x1fb: 0x10b03, // rtc - 0x1fc: 0x9205, // aside - 0x1fe: 0x24506, // figure + 0x3: 0xb304, // step + 0x4: 0x2004, // base + 0x5: 0xb607, // pattern + 0x8: 0x8403, // dir + 0xa: 0xe309, // autofocus + 0xc: 0x3b04, // main + 0xf: 0x2801, // i + 0x10: 0x1, // a + 0x12: 0x40004, // abbr + 0x13: 0x40705, // width + 0x15: 0x24506, // figure + 0x16: 0x23f06, // script + 0x17: 0x5e0f, // amp-boilerplate + 0x18: 0x3d09, // inputmode + 0x19: 0xb802, // tt + 0x1c: 0x2d704, // href + 0x1d: 0x22305, // start + 0x21: 0x4807, // rowspan + 0x23: 0x1e306, // coords + 0x25: 0xb104, // list + 0x28: 0x3fa03, // svg + 0x29: 0x2d502, // h1 + 0x2a: 0x15a05, // class + 0x2b: 0x2e805, // video + 0x2c: 0x3490e, // referrerpolicy + 0x2d: 0x2f608, // menuitem + 0x2e: 0x38805, // meter + 0x30: 0x17604, // code + 0x33: 0x2c408, // readonly + 0x35: 0x3c207, // srclang + 0x37: 0x3320d, // popovertarget + 0x39: 0x2db04, // lang + 0x3a: 0x3a403, // pre + 0x3d: 0x2f206, // iframe + 0x3e: 0x1b107, // content + 0x3f: 0x2fa06, // itemid + 0x40: 0x27f0a, // novalidate + 0x41: 0x1d306, // select + 0x43: 0x3c906, // strike + 0x44: 0x1a304, // cols + 0x46: 0x36b05, // thead + 0x48: 0x32103, // low + 0x4b: 0x1000b, // playsinline + 0x4d: 0x31206, // srcset + 0x51: 0x1c405, // label + 0x52: 0x3bb08, // progress + 0x53: 0x6702, // rp + 0x54: 0x19903, // div + 0x55: 0xad08, // datalist + 0x5b: 0x28d06, // dialog + 0x5c: 0x5208, // tabindex + 0x5d: 0x40d04, // wrap + 0x61: 0x16e05, // frame + 0x64: 0x3000a, // imagesizes + 0x67: 0x6d07, // address + 0x69: 0x3da03, // sub + 0x6d: 0x4b04, // span + 0x6f: 0x16a03, // dfn + 0x70: 0xf309, // translate + 0x71: 0x1f203, // del + 0x72: 0x705, // tbody + 0x74: 0x15208, // property + 0x7b: 0x38d09, // minlength + 0x7d: 0x2cc06, // hidden + 0x7e: 0x18b03, // rev + 0x7f: 0xdb08, // template + 0x81: 0x20b07, // details + 0x82: 0x8303, // bdi + 0x86: 0x22507, // article + 0x88: 0x2ec06, // option + 0x89: 0x40902, // dt + 0x8b: 0x31b03, // ins + 0x8d: 0x18607, // picture + 0x8f: 0x18b08, // reversed + 0x92: 0x19b03, // var + 0x93: 0xad04, // data + 0x95: 0x8e06, // canvas + 0x96: 0x7b05, // param + 0x97: 0x3eb07, // summary + 0x98: 0x15e07, // section + 0x9a: 0x2c09, // accesskey + 0x9b: 0x26006, // action + 0x9c: 0x9402, // id + 0x9e: 0x1701, // s + 0x9f: 0x10b02, // rt + 0xa0: 0x2c304, // area + 0xa2: 0x3b407, // profile + 0xa5: 0x31203, // src + 0xa6: 0xea06, // usemap + 0xa8: 0x1be06, // legend + 0xa9: 0x8604, // ruby + 0xaf: 0x26a07, // enctype + 0xb0: 0x2a106, // height + 0xb1: 0x2340a, // figcaption + 0xb2: 0x3aa07, // preload + 0xb4: 0x10b03, // rtc + 0xb5: 0x40b02, // h4 + 0xb6: 0xa106, // object + 0xb8: 0x3fd05, // vocab + 0xb9: 0x19208, // disabled + 0xba: 0x16605, // embed + 0xbc: 0x9508, // decoding + 0xc1: 0x2102, // as + 0xc2: 0x14904, // nobr + 0xc4: 0x16c08, // noframes + 0xc5: 0x3507, // acronym + 0xc6: 0x2930a, // formtarget + 0xc7: 0x35b05, // scope + 0xc8: 0x30504, // size + 0xcb: 0x3ad07, // loading + 0xcd: 0x17f03, // col + 0xd0: 0x2a804, // loop + 0xd1: 0x1307, // charset + 0xd2: 0x1bb05, // table + 0xd5: 0x3a406, // prefix + 0xd6: 0x3de07, // optimum + 0xd8: 0x24f06, // center + 0xdb: 0xdc02, // em + 0xdc: 0x2aa08, // optgroup + 0xde: 0x40403, // wbr + 0xe2: 0x3cf06, // strong + 0xe6: 0xbe05, // value + 0xe9: 0x14b02, // br + 0xed: 0xee06, // applet + 0xf0: 0x206, // output + 0xf1: 0x22c08, // fieldset + 0xfb: 0x14406, // button + 0xfc: 0x30d0b, // imagesrcset + 0xfd: 0xc06, // accept + 0x100: 0x31d05, // small + 0x102: 0x3f406, // portal + 0x103: 0x8a05, // async + 0x104: 0x11208, // required + 0x105: 0x35d04, // open + 0x107: 0xaa04, // kind + 0x108: 0x33213, // popovertargetaction + 0x109: 0x2a504, // html + 0x10b: 0x501, // p + 0x10c: 0x7f04, // mark + 0x10d: 0x32e05, // ismap + 0x10f: 0x1cc08, // controls + 0x110: 0xa605, // track + 0x112: 0x38d03, // min + 0x113: 0x16407, // noembed + 0x116: 0x21f06, // inlist + 0x118: 0x1da09, // draggable + 0x119: 0x14e08, // itemprop + 0x11a: 0x1f02, // rb + 0x11c: 0x17c02, // ul + 0x11e: 0xa602, // tr + 0x11f: 0x27702, // th + 0x122: 0x29d02, // h5 + 0x126: 0x1905, // tfoot + 0x127: 0x37e03, // max + 0x129: 0x2d702, // hr + 0x12b: 0x1ff0e, // shadowrootmode + 0x12c: 0x29706, // target + 0x12f: 0x3f203, // sup + 0x134: 0x11d06, // typeof + 0x136: 0x18002, // ol + 0x137: 0x36c04, // head + 0x138: 0x7307, // sandbox + 0x13a: 0x2b506, // hgroup + 0x13f: 0x5004, // meta + 0x141: 0x5905, // xmlns + 0x143: 0x38602, // h2 + 0x144: 0xc0e, // accept-charset + 0x146: 0x2bf04, // text + 0x147: 0x13a0a, // blockquote + 0x149: 0x1f102, // td + 0x14a: 0x37707, // checked + 0x14d: 0x2b104, // ping + 0x14e: 0x2f604, // menu + 0x150: 0x5d04, // samp + 0x151: 0x2008, // basefont + 0x152: 0x2710a, // formmethod + 0x155: 0xed03, // map + 0x156: 0x27b0e, // formnovalidate + 0x159: 0x6e02, // dd + 0x15c: 0xc30e, // autocapitalize + 0x15d: 0x2660b, // formenctype + 0x15e: 0xbc03, // nav + 0x161: 0x101, // b + 0x163: 0x1a06, // footer + 0x164: 0x24b06, // source + 0x166: 0x35709, // itemscope + 0x16a: 0x10d07, // capture + 0x16c: 0x36c06, // header + 0x16d: 0x1c804, // link + 0x171: 0x2160b, // crossorigin + 0x172: 0x4405, // defer + 0x175: 0x2705, // title + 0x177: 0x28b05, // media + 0x178: 0x11401, // q + 0x179: 0x21105, // shape + 0x17c: 0x25c03, // for + 0x17d: 0x30904, // slot + 0x17e: 0x7903, // xmp + 0x184: 0x2404, // font + 0x187: 0x13208, // blocking + 0x188: 0x8203, // kbd + 0x18a: 0x1a908, // nomodule + 0x18b: 0x4e04, // name + 0x18f: 0x29f02, // h6 + 0x191: 0x31f05, // allow + 0x194: 0x39708, // multiple + 0x196: 0x30505, // sizes + 0x199: 0x23707, // caption + 0x19b: 0x34507, // itemref + 0x19c: 0x19e05, // color + 0x19f: 0x1220d, // fetchpriority + 0x1a7: 0xd10c, // autocomplete + 0x1a8: 0x1a307, // colspan + 0x1aa: 0x16e08, // frameset + 0x1ab: 0x31f0f, // allowfullscreen + 0x1ac: 0x14d04, // cite + 0x1ae: 0x3ab03, // rel + 0x1b0: 0x39502, // h3 + 0x1b1: 0x25c0a, // formaction + 0x1b3: 0x36904, // math + 0x1b4: 0x39f05, // muted + 0x1b5: 0x1e818, // shadowrootdelegatesfocus + 0x1b6: 0x24908, // resource + 0x1b9: 0x40102, // bb + 0x1ba: 0x2df0a, // http-equiv + 0x1be: 0x30005, // image + 0x1bf: 0x2bf08, // textarea + 0x1c1: 0x28904, // time + 0x1c2: 0x5, // about + 0x1c3: 0x25c04, // form + 0x1c4: 0x301, // u + 0x1c5: 0x41006, // poster + 0x1c8: 0x1d308, // selected + 0x1c9: 0x2d204, // high + 0x1ca: 0x3d505, // style + 0x1cc: 0x4804, // rows + 0x1cd: 0x36c07, // headers + 0x1cf: 0x3720a, // spellcheck + 0x1d1: 0x11d04, // type + 0x1d3: 0xfc08, // autoplay + 0x1d4: 0x28508, // datetime + 0x1d7: 0x9d05, // audio + 0x1d9: 0xb202, // is + 0x1de: 0x3dc03, // bdo + 0x1df: 0x3d05, // input + 0x1e0: 0x31803, // img + 0x1e1: 0x11908, // datatype + 0x1e2: 0x36108, // itemtype + 0x1e3: 0x33207, // popover + 0x1e4: 0x2ba09, // plaintext + 0x1e6: 0x12f03, // big + 0x1e9: 0x2500c, // enterkeyhint + 0x1ea: 0x17807, // default + 0x1ec: 0x27506, // method + 0x1ed: 0x37e09, // maxlength + 0x1f0: 0x2d708, // hreflang + 0x1f1: 0x1c302, // dl + 0x1f2: 0xb102, // li + 0x1f4: 0x17f08, // colgroup + 0x1f6: 0x1b10f, // contenteditable + 0x1f7: 0x3e407, // marquee + 0x1f9: 0x9205, // aside + 0x1fa: 0x804, // body + 0x1fb: 0x10805, // inert + 0x1fd: 0x23d08, // noscript } diff --git a/vendor/github.com/tdewolff/minify/v2/html/html.go b/vendor/github.com/tdewolff/minify/v2/html/html.go index 45643c5d8..140fc79e7 100644 --- a/vendor/github.com/tdewolff/minify/v2/html/html.go +++ b/vendor/github.com/tdewolff/minify/v2/html/html.go @@ -23,6 +23,7 @@ var ( svgMimeBytes = []byte("image/svg+xml") formMimeBytes = []byte("application/x-www-form-urlencoded") mathMimeBytes = []byte("application/mathml+xml") + xmlMimeBytes = []byte("text/xml") dataSchemeBytes = []byte("data:") jsSchemeBytes = []byte("javascript:") httpBytes = []byte("http") @@ -129,7 +130,7 @@ func (o *Minifier) Minify(m *minify.M, w io.Writer, r io.Reader, _ map[string]st w.Write(t.Data) } } - case html.SvgToken: + case html.SVGToken: if err := m.MinifyMimetype(svgMimeBytes, w, buffer.NewReader(t.Data), inlineParams); err != nil { if err != minify.ErrNotExist { return minify.UpdateErrorPosition(err, z, t.Offset) @@ -145,6 +146,14 @@ func (o *Minifier) Minify(m *minify.M, w io.Writer, r io.Reader, _ map[string]st w.Write(t.Data) } omitSpace = false + case html.XMLToken: + if err := m.MinifyMimetype(xmlMimeBytes, w, buffer.NewReader(t.Data), nil); err != nil { + if err != minify.ErrNotExist { + return minify.UpdateErrorPosition(err, z, t.Offset) + } + w.Write(t.Data) + } + omitSpace = false case html.TemplateToken: w.Write(t.Data) omitSpace = false @@ -199,7 +208,7 @@ func (o *Minifier) Minify(m *minify.M, w io.Writer, r io.Reader, _ map[string]st } else if next.TokenType == html.TextToken && !parse.IsAllWhitespace(next.Data) || next.TokenType == html.TemplateToken { // stop looking when text encountered break - } else if next.TokenType == html.StartTagToken || next.TokenType == html.EndTagToken || next.TokenType == html.SvgToken || next.TokenType == html.MathToken { + } else if next.TokenType == html.StartTagToken || next.TokenType == html.EndTagToken || next.TokenType == html.SVGToken || next.TokenType == html.MathToken || next.TokenType == html.XMLToken { if o.KeepWhitespace { break } @@ -208,7 +217,7 @@ func (o *Minifier) Minify(m *minify.M, w io.Writer, r io.Reader, _ map[string]st t.Data = t.Data[:len(t.Data)-1] omitSpace = false break - } else if next.TokenType == html.StartTagToken || next.TokenType == html.SvgToken || next.TokenType == html.MathToken { + } else if next.TokenType == html.StartTagToken || next.TokenType == html.SVGToken || next.TokenType == html.MathToken || next.TokenType == html.XMLToken { break } } diff --git a/vendor/github.com/tdewolff/minify/v2/publish.sh b/vendor/github.com/tdewolff/minify/v2/publish.sh index 0e56de5f6..64ea672a2 100644 --- a/vendor/github.com/tdewolff/minify/v2/publish.sh +++ b/vendor/github.com/tdewolff/minify/v2/publish.sh @@ -9,6 +9,9 @@ wget -q --show-progress https://github.com/tdewolff/minify/archive/v$VERSION.tar SHA256=`sha256sum v$VERSION.tar.gz` SHA256=( $SHA256 ) +GOMODCACHE="$PWD"/go-mod go mod download -modcacherw -x +tar -caf minify-v$VERSION-deps.tar.xz go-mod + echo "" echo "Releasing for AUR..." cd /home/taco/dev/aur/minify diff --git a/vendor/github.com/tdewolff/parse/v2/html/hash.go b/vendor/github.com/tdewolff/parse/v2/html/hash.go index 16432ade1..e54bd8fe4 100644 --- a/vendor/github.com/tdewolff/parse/v2/html/hash.go +++ b/vendor/github.com/tdewolff/parse/v2/html/hash.go @@ -1,42 +1,61 @@ package html -// generated by hasher -type=Hash -file=hash.go; DO NOT EDIT, except for adding more constants to the list and rerun go generate - // uses github.com/tdewolff/hasher //go:generate hasher -type=Hash -file=hash.go // Hash defines perfect hashes for a predefined list of strings type Hash uint32 -// Unique hash definitions to be used instead of strings +// Identifiers for the hashes associated with the text in the comments. const ( Iframe Hash = 0x6 // iframe Math Hash = 0x604 // math - Plaintext Hash = 0x1e09 // plaintext + Plaintext Hash = 0x2109 // plaintext Script Hash = 0xa06 // script Style Hash = 0x1405 // style Svg Hash = 0x1903 // svg - Textarea Hash = 0x2308 // textarea + Textarea Hash = 0x2608 // textarea Title Hash = 0xf05 // title - Xmp Hash = 0x1c03 // xmp + Xml Hash = 0x1c03 // xml + Xmp Hash = 0x1f03 // xmp ) -// String returns the hash' name. +//var HashMap = map[string]Hash{ +// "iframe": Iframe, +// "math": Math, +// "plaintext": Plaintext, +// "script": Script, +// "style": Style, +// "svg": Svg, +// "textarea": Textarea, +// "title": Title, +// "xml": Xml, +// "xmp": Xmp, +//} + +// String returns the text associated with the hash. func (i Hash) String() string { + return string(i.Bytes()) +} + +// Bytes returns the text associated with the hash. +func (i Hash) Bytes() []byte { start := uint32(i >> 8) n := uint32(i & 0xff) if start+n > uint32(len(_Hash_text)) { - return "" + return []byte{} } return _Hash_text[start : start+n] } -// ToHash returns the hash whose name is s. It returns zero if there is no -// such hash. It is case sensitive. +// ToHash returns a hash Hash for a given []byte. Hash is a uint32 that is associated with the text in []byte. It returns zero if no match found. func ToHash(s []byte) Hash { if len(s) == 0 || len(s) > _Hash_maxLen { return 0 } + //if 3 < len(s) { + // return HashMap[string(s)] + //} h := uint32(_Hash_hash0) for i := 0; i < len(s); i++ { h ^= uint32(s[i]) @@ -64,18 +83,21 @@ NEXT: return 0 } -const _Hash_hash0 = 0x9acb0442 +const _Hash_hash0 = 0xb4b790b3 const _Hash_maxLen = 9 -const _Hash_text = "iframemathscriptitlestylesvgxmplaintextarea" + +var _Hash_text = []byte("" + + "iframemathscriptitlestylesvgxmlxmplaintextarea") var _Hash_table = [1 << 4]Hash{ - 0x0: 0x2308, // textarea - 0x2: 0x6, // iframe - 0x4: 0xf05, // title - 0x5: 0x1e09, // plaintext - 0x7: 0x1405, // style - 0x8: 0x604, // math - 0x9: 0xa06, // script - 0xa: 0x1903, // svg - 0xb: 0x1c03, // xmp + 0x2: 0xa06, // script + 0x3: 0xf05, // title + 0x4: 0x1405, // style + 0x5: 0x604, // math + 0x6: 0x6, // iframe + 0x8: 0x1c03, // xml + 0x9: 0x2608, // textarea + 0xc: 0x1f03, // xmp + 0xe: 0x2109, // plaintext + 0xf: 0x1903, // svg } diff --git a/vendor/github.com/tdewolff/parse/v2/html/lex.go b/vendor/github.com/tdewolff/parse/v2/html/lex.go index 4eb50f49d..e44a77ce8 100644 --- a/vendor/github.com/tdewolff/parse/v2/html/lex.go +++ b/vendor/github.com/tdewolff/parse/v2/html/lex.go @@ -21,8 +21,9 @@ const ( EndTagToken AttributeToken TextToken - SvgToken + SVGToken MathToken + XMLToken TemplateToken ) @@ -47,10 +48,14 @@ func (tt TokenType) String() string { return "Attribute" case TextToken: return "Text" - case SvgToken: - return "Svg" + case SVGToken: + return "SVG" case MathToken: return "Math" + case XMLToken: + return "XML" + case TemplateToken: + return "Template" } return "Invalid(" + strconv.Itoa(int(tt)) + ")" } @@ -371,8 +376,8 @@ func (l *Lexer) shiftStartTag() (TokenType, []byte) { l.r.Move(1) } l.text = parse.ToLower(l.r.Lexeme()[1:]) - if h := ToHash(l.text); h == Textarea || h == Title || h == Style || h == Xmp || h == Iframe || h == Script || h == Plaintext || h == Svg || h == Math { - if h == Svg || h == Math { + if h := ToHash(l.text); h == Textarea || h == Title || h == Style || h == Xmp || h == Iframe || h == Script || h == Plaintext || h == Svg || h == Math || h == Xml { + if h == Svg || h == Math || h == Xml { data := l.shiftXML(h) if l.err != nil { return ErrorToken, nil @@ -380,9 +385,11 @@ func (l *Lexer) shiftStartTag() (TokenType, []byte) { l.inTag = false if h == Svg { - return SvgToken, data + return SVGToken, data + } else if h == Math { + return MathToken, data } - return MathToken, data + return XMLToken, data } l.rawTag = h } diff --git a/vendor/github.com/yuin/goldmark/README.md b/vendor/github.com/yuin/goldmark/README.md index ef74fc9f8..1922fd06d 100644 --- a/vendor/github.com/yuin/goldmark/README.md +++ b/vendor/github.com/yuin/goldmark/README.md @@ -496,6 +496,7 @@ Extensions - [goldmark-enclave](https://github.com/quailyquaily/goldmark-enclave): Adds support for embedding youtube/bilibili video, X's [oembed X](https://publish.x.com/), [tradingview chart](https://www.tradingview.com/widget/)'s chart, [quaily widget](https://quaily.com), [spotify embeds](https://developer.spotify.com/documentation/embeds), [dify embed](https://dify.ai/) and html audio into the document. - [goldmark-wiki-table](https://github.com/movsb/goldmark-wiki-table): Adds support for embedding Wiki Tables. - [goldmark-tgmd](https://github.com/Mad-Pixels/goldmark-tgmd): A Telegram markdown renderer that can be passed to `goldmark.WithRenderer()`. +- [goldmark-treeblood](https://github.com/Wyatt915/goldmark-treeblood): Renders $\LaTeX$ expressions as MathML (pure Go, no external dependencies). ### Loading extensions at runtime [goldmark-dynamic](https://github.com/yuin/goldmark-dynamic) allows you to write a goldmark extension in Lua and load it at runtime without re-compilation. diff --git a/vendor/github.com/yuin/goldmark/parser/fcode_block.go b/vendor/github.com/yuin/goldmark/parser/fcode_block.go index 953b8dcba..d0833fbb2 100644 --- a/vendor/github.com/yuin/goldmark/parser/fcode_block.go +++ b/vendor/github.com/yuin/goldmark/parser/fcode_block.go @@ -89,10 +89,7 @@ func (b *fencedCodeBlockParser) Continue(node ast.Node, reader text.Reader, pc C } pos, padding := util.IndentPositionPadding(line, reader.LineOffset(), segment.Padding, fdata.indent) if pos < 0 { - pos = util.FirstNonSpacePosition(line) - if pos < 0 { - pos = 0 - } + pos = max(0, util.FirstNonSpacePosition(line)) - segment.Padding padding = 0 } seg := text.NewSegmentPadding(segment.Start+pos, segment.Stop, padding) |
