mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[chore]: Bump github.com/tdewolff/minify/v2 from 2.20.12 to 2.20.14 (#2530)
Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.20.12 to 2.20.14. - [Release notes](https://github.com/tdewolff/minify/releases) - [Commits](https://github.com/tdewolff/minify/compare/v2.20.12...v2.20.14) --- updated-dependencies: - dependency-name: github.com/tdewolff/minify/v2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
2
vendor/github.com/tdewolff/minify/v2/README.md
generated
vendored
2
vendor/github.com/tdewolff/minify/v2/README.md
generated
vendored
@ -198,7 +198,7 @@ The HTML5 minifier uses these minifications:
|
||||
|
||||
Options:
|
||||
|
||||
- `KeepConditionalComments` preserve all IE conditional comments such as `<!--[if IE 6]><![endif]-->` and `<![if IE 6]><![endif]>`, see https://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx#syntax
|
||||
- `KeepSpecialComments` preserve all special comments, including Server Side Includes such as `<!--#include file="header.html" -->` and IE conditional comments such as `<!--[if IE 6]><![endif]-->` and `<![if IE 6]><![endif]>`, see https://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx#syntax
|
||||
- `KeepDefaultAttrVals` preserve default attribute values such as `<script type="application/javascript">`
|
||||
- `KeepDocumentTags` preserve `html`, `head` and `body` tags
|
||||
- `KeepEndTags` preserve all end tags
|
||||
|
43
vendor/github.com/tdewolff/minify/v2/html/html.go
generated
vendored
43
vendor/github.com/tdewolff/minify/v2/html/html.go
generated
vendored
@ -3,6 +3,7 @@ package html
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/tdewolff/minify/v2"
|
||||
@ -52,6 +53,7 @@ var PHPTemplateDelims = [2]string{"<?", "?>"}
|
||||
type Minifier struct {
|
||||
KeepComments bool
|
||||
KeepConditionalComments bool
|
||||
KeepSpecialComments bool
|
||||
KeepDefaultAttrVals bool
|
||||
KeepDocumentTags bool
|
||||
KeepEndTags bool
|
||||
@ -70,6 +72,11 @@ func (o *Minifier) Minify(m *minify.M, w io.Writer, r io.Reader, _ map[string]st
|
||||
var rawTagHash Hash
|
||||
var rawTagMediatype []byte
|
||||
|
||||
if o.KeepConditionalComments {
|
||||
fmt.Println("DEPRECATED: KeepConditionalComments is replaced by KeepSpecialComments")
|
||||
o.KeepSpecialComments = true
|
||||
}
|
||||
|
||||
omitSpace := true // if true the next leading space is omitted
|
||||
inPre := false
|
||||
|
||||
@ -97,27 +104,29 @@ func (o *Minifier) Minify(m *minify.M, w io.Writer, r io.Reader, _ map[string]st
|
||||
case html.CommentToken:
|
||||
if o.KeepComments {
|
||||
w.Write(t.Data)
|
||||
} 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]--"))) {
|
||||
// [if ...] is always 7 or more characters, [endif] is only encountered for downlevel-revealed
|
||||
// see https://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx#syntax
|
||||
if bytes.HasPrefix(t.Data, []byte("<!--[if ")) && bytes.HasSuffix(t.Data, []byte("<![endif]-->")) { // downlevel-hidden
|
||||
begin := bytes.IndexByte(t.Data, '>') + 1
|
||||
end := len(t.Data) - len("<![endif]-->")
|
||||
if begin < end {
|
||||
w.Write(t.Data[:begin])
|
||||
if err := o.Minify(m, w, buffer.NewReader(t.Data[begin:end]), nil); err != nil {
|
||||
return minify.UpdateErrorPosition(err, z, t.Offset)
|
||||
} else if o.KeepSpecialComments {
|
||||
if 6 < len(t.Text) && (bytes.HasPrefix(t.Text, []byte("[if ")) || bytes.HasSuffix(t.Text, []byte("[endif]")) || bytes.HasSuffix(t.Text, []byte("[endif]--"))) {
|
||||
// [if ...] is always 7 or more characters, [endif] is only encountered for downlevel-revealed
|
||||
// see https://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx#syntax
|
||||
if bytes.HasPrefix(t.Data, []byte("<!--[if ")) && bytes.HasSuffix(t.Data, []byte("<![endif]-->")) { // downlevel-hidden
|
||||
begin := bytes.IndexByte(t.Data, '>') + 1
|
||||
end := len(t.Data) - len("<![endif]-->")
|
||||
if begin < end {
|
||||
w.Write(t.Data[:begin])
|
||||
if err := o.Minify(m, w, buffer.NewReader(t.Data[begin:end]), nil); err != nil {
|
||||
return minify.UpdateErrorPosition(err, z, t.Offset)
|
||||
}
|
||||
w.Write(t.Data[end:])
|
||||
} else {
|
||||
w.Write(t.Data) // malformed
|
||||
}
|
||||
w.Write(t.Data[end:])
|
||||
} else {
|
||||
w.Write(t.Data) // malformed
|
||||
w.Write(t.Data) // downlevel-revealed or short downlevel-hidden
|
||||
}
|
||||
} else {
|
||||
w.Write(t.Data) // downlevel-revealed or short downlevel-hidden
|
||||
} else if 1 < len(t.Text) && t.Text[0] == '#' {
|
||||
// SSI tags
|
||||
w.Write(t.Data)
|
||||
}
|
||||
} else if 1 < len(t.Text) && t.Text[0] == '#' {
|
||||
// SSI tags
|
||||
w.Write(t.Data)
|
||||
}
|
||||
case html.SvgToken:
|
||||
if err := m.MinifyMimetype(svgMimeBytes, w, buffer.NewReader(t.Data), nil); err != nil {
|
||||
|
Reference in New Issue
Block a user