diff options
Diffstat (limited to 'tpl/transform')
-rw-r--r-- | tpl/transform/init.go | 22 | ||||
-rw-r--r-- | tpl/transform/remarshal_test.go | 2 | ||||
-rw-r--r-- | tpl/transform/transform.go | 1 | ||||
-rw-r--r-- | tpl/transform/transform_test.go | 2 | ||||
-rw-r--r-- | tpl/transform/unmarshal.go | 2 | ||||
-rw-r--r-- | tpl/transform/unmarshal_test.go | 5 |
6 files changed, 15 insertions, 19 deletions
diff --git a/tpl/transform/init.go b/tpl/transform/init.go index 62cb0a9c3..9e57c07f6 100644 --- a/tpl/transform/init.go +++ b/tpl/transform/init.go @@ -46,13 +46,16 @@ func init() { [][2]string{ { `{{ htmlEscape "Cathal Garvey & The Sunshine Band <cathal@foo.bar>" | safeHTML}}`, - `Cathal Garvey & The Sunshine Band <cathal@foo.bar>`}, + `Cathal Garvey & The Sunshine Band <cathal@foo.bar>`, + }, { `{{ htmlEscape "Cathal Garvey & The Sunshine Band <cathal@foo.bar>"}}`, - `Cathal Garvey &amp; The Sunshine Band &lt;cathal@foo.bar&gt;`}, + `Cathal Garvey &amp; The Sunshine Band &lt;cathal@foo.bar&gt;`, + }, { `{{ htmlEscape "Cathal Garvey & The Sunshine Band <cathal@foo.bar>" | htmlUnescape | safeHTML }}`, - `Cathal Garvey & The Sunshine Band <cathal@foo.bar>`}, + `Cathal Garvey & The Sunshine Band <cathal@foo.bar>`, + }, }, ) @@ -61,16 +64,20 @@ func init() { [][2]string{ { `{{ htmlUnescape "Cathal Garvey & The Sunshine Band <cathal@foo.bar>" | safeHTML}}`, - `Cathal Garvey & The Sunshine Band <cathal@foo.bar>`}, + `Cathal Garvey & The Sunshine Band <cathal@foo.bar>`, + }, { `{{"Cathal Garvey &amp; The Sunshine Band &lt;cathal@foo.bar&gt;" | htmlUnescape | htmlUnescape | safeHTML}}`, - `Cathal Garvey & The Sunshine Band <cathal@foo.bar>`}, + `Cathal Garvey & The Sunshine Band <cathal@foo.bar>`, + }, { `{{"Cathal Garvey &amp; The Sunshine Band &lt;cathal@foo.bar&gt;" | htmlUnescape | htmlUnescape }}`, - `Cathal Garvey & The Sunshine Band <cathal@foo.bar>`}, + `Cathal Garvey & The Sunshine Band <cathal@foo.bar>`, + }, { `{{ htmlUnescape "Cathal Garvey & The Sunshine Band <cathal@foo.bar>" | htmlEscape | safeHTML }}`, - `Cathal Garvey & The Sunshine Band <cathal@foo.bar>`}, + `Cathal Garvey & The Sunshine Band <cathal@foo.bar>`, + }, }, ) @@ -104,7 +111,6 @@ func init() { ) return ns - } internal.AddTemplateFuncsNamespace(f) diff --git a/tpl/transform/remarshal_test.go b/tpl/transform/remarshal_test.go index daf99fdb4..eb5f4253c 100644 --- a/tpl/transform/remarshal_test.go +++ b/tpl/transform/remarshal_test.go @@ -107,7 +107,6 @@ title: Test Metadata } } - } func TestRemarshalComments(t *testing.T) { @@ -168,7 +167,6 @@ func TestTestRemarshalError(t *testing.T) { _, err = ns.Remarshal("json", "asdf") c.Assert(err, qt.Not(qt.IsNil)) - } func TestTestRemarshalMapInput(t *testing.T) { diff --git a/tpl/transform/transform.go b/tpl/transform/transform.go index b168d2a50..82756ed97 100644 --- a/tpl/transform/transform.go +++ b/tpl/transform/transform.go @@ -98,7 +98,6 @@ func (ns *Namespace) Markdownify(s interface{}) (template.HTML, error) { } b, err := ns.deps.ContentSpec.RenderMarkdown([]byte(ss)) - if err != nil { return "", err } diff --git a/tpl/transform/transform_test.go b/tpl/transform/transform_test.go index b3f4206ff..b98d82d27 100644 --- a/tpl/transform/transform_test.go +++ b/tpl/transform/transform_test.go @@ -15,7 +15,6 @@ package transform import ( "html/template" - "testing" "github.com/gohugoio/hugo/common/loggers" @@ -206,7 +205,6 @@ And then some. c.Assert(err, qt.IsNil) c.Assert(result, qt.Equals, template.HTML( "<p>#First</p>\n<p>This is some <em>bold</em> text.</p>\n<h2 id=\"second\">Second</h2>\n<p>This is some more text.</p>\n<p>And then some.</p>\n")) - } func TestPlainify(t *testing.T) { diff --git a/tpl/transform/unmarshal.go b/tpl/transform/unmarshal.go index b606c870a..aa84ca1f8 100644 --- a/tpl/transform/unmarshal.go +++ b/tpl/transform/unmarshal.go @@ -39,7 +39,7 @@ func (ns *Namespace) Unmarshal(args ...interface{}) (interface{}, error) { } var data interface{} - var decoder = metadecoders.Default + decoder := metadecoders.Default if len(args) == 1 { data = args[0] diff --git a/tpl/transform/unmarshal_test.go b/tpl/transform/unmarshal_test.go index 183bdefd5..ec81c316a 100644 --- a/tpl/transform/unmarshal_test.go +++ b/tpl/transform/unmarshal_test.go @@ -79,7 +79,6 @@ func (t testContentResource) Key() string { } func TestUnmarshal(t *testing.T) { - v := viper.New() ns := New(newDeps(v)) c := qt.New(t) @@ -120,21 +119,17 @@ func TestUnmarshal(t *testing.T) { }}, {testContentResource{key: "r1", content: `a;b;c`, mime: media.CSVType}, map[string]interface{}{"delimiter": ";"}, func(r [][]string) { c.Assert([][]string{{"a", "b", "c"}}, qt.DeepEquals, r) - }}, {"a,b,c", nil, func(r [][]string) { c.Assert([][]string{{"a", "b", "c"}}, qt.DeepEquals, r) - }}, {"a;b;c", map[string]interface{}{"delimiter": ";"}, func(r [][]string) { c.Assert([][]string{{"a", "b", "c"}}, qt.DeepEquals, r) - }}, {testContentResource{key: "r1", content: ` % This is a comment a;b;c`, mime: media.CSVType}, map[string]interface{}{"DElimiter": ";", "Comment": "%"}, func(r [][]string) { c.Assert([][]string{{"a", "b", "c"}}, qt.DeepEquals, r) - }}, // errors {"thisisnotavaliddataformat", nil, false}, |