diff options
author | Bjørn Erik Pedersen <[email protected]> | 2018-12-21 16:21:13 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2018-12-23 10:02:42 +0100 |
commit | 822dc627a1cfdf1f97882f27761675ac6ace7669 (patch) | |
tree | b453158c329495fa59dc38374eb8296995ba0ce0 /media | |
parent | 43f9df0194d229805d80b13c9e38a7a0fec12cf4 (diff) | |
download | hugo-822dc627a1cfdf1f97882f27761675ac6ace7669.tar.gz hugo-822dc627a1cfdf1f97882f27761675ac6ace7669.zip |
tpl/transform: Add transform.Unmarshal func
Fixes #5428
Diffstat (limited to 'media')
-rw-r--r-- | media/mediaType.go | 4 | ||||
-rw-r--r-- | media/mediaType_test.go | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/media/mediaType.go b/media/mediaType.go index 9f7673ecc..01a6b9582 100644 --- a/media/mediaType.go +++ b/media/mediaType.go @@ -135,6 +135,8 @@ var ( XMLType = Type{MainType: "application", SubType: "xml", Suffixes: []string{"xml"}, Delimiter: defaultDelimiter} SVGType = Type{MainType: "image", SubType: "svg", mimeSuffix: "xml", Suffixes: []string{"svg"}, Delimiter: defaultDelimiter} TextType = Type{MainType: "text", SubType: "plain", Suffixes: []string{"txt"}, Delimiter: defaultDelimiter} + TOMLType = Type{MainType: "application", SubType: "toml", Suffixes: []string{"toml"}, Delimiter: defaultDelimiter} + YAMLType = Type{MainType: "application", SubType: "yaml", Suffixes: []string{"yaml", "yml"}, Delimiter: defaultDelimiter} OctetType = Type{MainType: "application", SubType: "octet-stream"} ) @@ -154,6 +156,8 @@ var DefaultTypes = Types{ SVGType, TextType, OctetType, + YAMLType, + TOMLType, } func init() { diff --git a/media/mediaType_test.go b/media/mediaType_test.go index bf356582f..ea6499a14 100644 --- a/media/mediaType_test.go +++ b/media/mediaType_test.go @@ -39,6 +39,8 @@ func TestDefaultTypes(t *testing.T) { {SVGType, "image", "svg", "svg", "image/svg+xml", "image/svg+xml"}, {TextType, "text", "plain", "txt", "text/plain", "text/plain"}, {XMLType, "application", "xml", "xml", "application/xml", "application/xml"}, + {TOMLType, "application", "toml", "toml", "application/toml", "application/toml"}, + {YAMLType, "application", "yaml", "yaml", "application/yaml", "application/yaml"}, } { require.Equal(t, test.expectedMainType, test.tp.MainType) require.Equal(t, test.expectedSubType, test.tp.SubType) @@ -50,6 +52,8 @@ func TestDefaultTypes(t *testing.T) { } + require.Equal(t, 15, len(DefaultTypes)) + } func TestGetByType(t *testing.T) { |