aboutsummaryrefslogtreecommitdiffhomepage
path: root/output
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2017-04-01 15:12:31 +0200
committerBjørn Erik Pedersen <[email protected]>2017-04-01 15:12:31 +0200
commitf911b107ef32c1c4369aa252a790e3c933660135 (patch)
treee1ac6996be0cc65eff325fb2ff12723fc73605a3 /output
parent05949c903817b93dd7fd71211260db625180eed6 (diff)
downloadhugo-f911b107ef32c1c4369aa252a790e3c933660135.tar.gz
hugo-f911b107ef32c1c4369aa252a790e3c933660135.zip
media, output: Add CSV type and format
And make CSS correclty behave as plain text.
Diffstat (limited to 'output')
-rw-r--r--output/outputFormat.go16
-rw-r--r--output/outputFormat_test.go18
2 files changed, 28 insertions, 6 deletions
diff --git a/output/outputFormat.go b/output/outputFormat.go
index 797c7ae2d..76329a936 100644
--- a/output/outputFormat.go
+++ b/output/outputFormat.go
@@ -43,10 +43,18 @@ var (
}
CSSFormat = Format{
- Name: "CSS",
- MediaType: media.CSSType,
- BaseName: "styles",
- Rel: "stylesheet",
+ Name: "CSS",
+ MediaType: media.CSSType,
+ BaseName: "styles",
+ IsPlainText: true,
+ Rel: "stylesheet",
+ }
+ CSVFormat = Format{
+ Name: "CSV",
+ MediaType: media.CSVType,
+ BaseName: "index",
+ IsPlainText: true,
+ Rel: "alternate",
}
HTMLFormat = Format{
diff --git a/output/outputFormat_test.go b/output/outputFormat_test.go
index 1d3700f4b..e742012ba 100644
--- a/output/outputFormat_test.go
+++ b/output/outputFormat_test.go
@@ -28,17 +28,31 @@ func TestDefaultTypes(t *testing.T) {
require.True(t, CalendarFormat.IsPlainText)
require.False(t, CalendarFormat.IsHTML)
+ require.Equal(t, "CSS", CSSFormat.Name)
+ require.Equal(t, media.CSSType, CSSFormat.MediaType)
+ require.Empty(t, CSSFormat.Path)
+ require.Empty(t, CSSFormat.Protocol) // Will inherit the BaseURL protocol.
+ require.True(t, CSSFormat.IsPlainText)
+ require.False(t, CSSFormat.IsHTML)
+
+ require.Equal(t, "CSV", CSVFormat.Name)
+ require.Equal(t, media.CSVType, CSVFormat.MediaType)
+ require.Empty(t, CSVFormat.Path)
+ require.Empty(t, CSVFormat.Protocol)
+ require.True(t, CSVFormat.IsPlainText)
+ require.False(t, CSVFormat.IsHTML)
+
require.Equal(t, "HTML", HTMLFormat.Name)
require.Equal(t, media.HTMLType, HTMLFormat.MediaType)
require.Empty(t, HTMLFormat.Path)
- require.Empty(t, HTMLFormat.Protocol) // Will inherit the BaseURL protocol.
+ require.Empty(t, HTMLFormat.Protocol)
require.False(t, HTMLFormat.IsPlainText)
require.True(t, HTMLFormat.IsHTML)
require.Equal(t, "AMP", AMPFormat.Name)
require.Equal(t, media.HTMLType, AMPFormat.MediaType)
require.Equal(t, "amp", AMPFormat.Path)
- require.Empty(t, AMPFormat.Protocol) // Will inherit the BaseURL protocol.
+ require.Empty(t, AMPFormat.Protocol)
require.False(t, AMPFormat.IsPlainText)
require.True(t, AMPFormat.IsHTML)