Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--media/mediaType.go10
-rw-r--r--media/mediaType_test.go7
-rw-r--r--output/outputFormat.go9
-rw-r--r--output/outputFormat_test.go6
4 files changed, 27 insertions, 5 deletions
diff --git a/media/mediaType.go b/media/mediaType.go
index 45b850077..07dbcc211 100644
--- a/media/mediaType.go
+++ b/media/mediaType.go
@@ -47,11 +47,11 @@ func (m Type) String() string {
}
var (
- CSSType = Type{"text", "css", "css"}
- HTMLType = Type{"text", "html", "html"}
- JSONType = Type{"application", "json", "json"}
- RSSType = Type{"application", "rss", "xml"}
+ CalendarType = Type{"text", "calendar", "ics"}
+ CSSType = Type{"text", "css", "css"}
+ HTMLType = Type{"text", "html", "html"}
+ JSONType = Type{"application", "json", "json"}
+ RSSType = Type{"application", "rss", "xml"}
)
// TODO(bep) output mime.AddExtensionType
-// TODO(bep) text/template vs html/template
diff --git a/media/mediaType_test.go b/media/mediaType_test.go
index e9de66d0e..40efc4f06 100644
--- a/media/mediaType_test.go
+++ b/media/mediaType_test.go
@@ -20,6 +20,13 @@ import (
)
func TestDefaultTypes(t *testing.T) {
+ require.Equal(t, "text", CalendarType.MainType)
+ require.Equal(t, "calendar", CalendarType.SubType)
+ require.Equal(t, "ics", CalendarType.Suffix)
+
+ require.Equal(t, "text/calendar+ics", CalendarType.String())
+ require.Equal(t, "text/calendar", CalendarType.Type())
+
require.Equal(t, "text", HTMLType.MainType)
require.Equal(t, "html", HTMLType.SubType)
require.Equal(t, "html", HTMLType.Suffix)
diff --git a/output/outputFormat.go b/output/outputFormat.go
index 3812030d1..efc0cd85f 100644
--- a/output/outputFormat.go
+++ b/output/outputFormat.go
@@ -31,6 +31,15 @@ var (
Rel: "amphtml",
}
+ CalendarType = Format{
+ Name: "Calendar",
+ MediaType: media.CalendarType,
+ IsPlainText: true,
+ Protocol: "webcal://",
+ BaseName: "index",
+ Rel: "alternate",
+ }
+
CSSType = Format{
Name: "CSS",
MediaType: media.CSSType,
diff --git a/output/outputFormat_test.go b/output/outputFormat_test.go
index 21375bf56..efc31a223 100644
--- a/output/outputFormat_test.go
+++ b/output/outputFormat_test.go
@@ -21,6 +21,12 @@ import (
)
func TestDefaultTypes(t *testing.T) {
+ require.Equal(t, "Calendar", CalendarType.Name)
+ require.Equal(t, media.CalendarType, CalendarType.MediaType)
+ require.Equal(t, "webcal://", CalendarType.Protocol)
+ require.Empty(t, CalendarType.Path)
+ require.True(t, CalendarType.IsPlainText)
+
require.Equal(t, "HTML", HTMLType.Name)
require.Equal(t, media.HTMLType, HTMLType.MediaType)
require.Empty(t, HTMLType.Path)