diff options
author | Bjørn Erik Pedersen <[email protected]> | 2020-12-02 13:23:25 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2020-12-03 13:12:58 +0100 |
commit | d90e37e0c6e812f9913bf256c9c81aa05b7a08aa (patch) | |
tree | 7b1b14464eefec1188ca2eed53c64e4823453cc9 /publisher | |
parent | 32471b57bde51c55a15dbf1db75d6e5f7232c347 (diff) | |
download | hugo-d90e37e0c6e812f9913bf256c9c81aa05b7a08aa.tar.gz hugo-d90e37e0c6e812f9913bf256c9c81aa05b7a08aa.zip |
all: Format code with gofumpt
See https://github.com/mvdan/gofumpt
Diffstat (limited to 'publisher')
-rw-r--r-- | publisher/htmlElementsCollector.go | 12 | ||||
-rw-r--r-- | publisher/htmlElementsCollector_test.go | 7 | ||||
-rw-r--r-- | publisher/publisher.go | 1 |
3 files changed, 8 insertions, 12 deletions
diff --git a/publisher/htmlElementsCollector.go b/publisher/htmlElementsCollector.go index b9b0f4e11..82846e3d0 100644 --- a/publisher/htmlElementsCollector.go +++ b/publisher/htmlElementsCollector.go @@ -14,15 +14,14 @@ package publisher import ( - "regexp" - - "github.com/gohugoio/hugo/helpers" - "golang.org/x/net/html" - "bytes" + "regexp" "sort" "strings" "sync" + + "github.com/gohugoio/hugo/helpers" + "golang.org/x/net/html" ) func newHTMLElementsCollector() *htmlElementsCollector { @@ -52,7 +51,6 @@ func (h *HTMLElements) Merge(other HTMLElements) { h.Tags = helpers.UniqueStringsReuse(h.Tags) h.Classes = helpers.UniqueStringsReuse(h.Classes) h.IDs = helpers.UniqueStringsReuse(h.IDs) - } func (h *HTMLElements) Sort() { @@ -153,7 +151,6 @@ func (c *cssClassCollectorWriter) insertStandinHTMLElement(el string) (string, s } newv := strings.Replace(el, tag, "div", 1) return newv, strings.ToLower(tag) - } func (c *cssClassCollectorWriter) endCollecting(drop bool) { @@ -196,7 +193,6 @@ type htmlElementsCollector struct { } func (c *htmlElementsCollector) getHTMLElements() HTMLElements { - var ( classes []string ids []string diff --git a/publisher/htmlElementsCollector_test.go b/publisher/htmlElementsCollector_test.go index ab1529288..2c2fd3733 100644 --- a/publisher/htmlElementsCollector_test.go +++ b/publisher/htmlElementsCollector_test.go @@ -68,9 +68,11 @@ func TestClassCollector(t *testing.T) { </div> </body>`, f("body div", "class1 class2 class3", "")}, - {"Alpine bind 2", `<div x-bind:class="{ 'bg-black': filter.checked }" + { + "Alpine bind 2", `<div x-bind:class="{ 'bg-black': filter.checked }" class="inline-block mr-1 mb-2 rounded bg-gray-300 px-2 py-2">FOO</div>`, - f("div", "bg-black bg-gray-300 inline-block mb-2 mr-1 px-2 py-2 rounded", "")}, + f("div", "bg-black bg-gray-300 inline-block mb-2 mr-1 px-2 py-2 rounded", ""), + }, {"Alpine bind 3", `<div x-bind:class="{ 'text-gray-800': !checked, 'text-white': checked }"></div>`, f("div", "text-gray-800 text-white", "")}, {"Alpine bind 4", `<div x-bind:class="{ 'text-gray-800': !checked, @@ -97,7 +99,6 @@ func TestClassCollector(t *testing.T) { c.Assert(got, qt.DeepEquals, test.expect) }) } - } func BenchmarkClassCollectorWriter(b *testing.B) { diff --git a/publisher/publisher.go b/publisher/publisher.go index ac2151529..fc1fc0799 100644 --- a/publisher/publisher.go +++ b/publisher/publisher.go @@ -186,5 +186,4 @@ func (p DestinationPublisher) createTransformerChain(f Descriptor) transform.Cha } return transformers - } |