mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 23:12:10 -05:00
media, output: Add Calendar type
This commit is contained in:
parent
dbb83f925a
commit
8bcc08e3b0
4 changed files with 27 additions and 5 deletions
|
@ -47,11 +47,11 @@ func (m Type) String() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
CSSType = Type{"text", "css", "css"}
|
CalendarType = Type{"text", "calendar", "ics"}
|
||||||
HTMLType = Type{"text", "html", "html"}
|
CSSType = Type{"text", "css", "css"}
|
||||||
JSONType = Type{"application", "json", "json"}
|
HTMLType = Type{"text", "html", "html"}
|
||||||
RSSType = Type{"application", "rss", "xml"}
|
JSONType = Type{"application", "json", "json"}
|
||||||
|
RSSType = Type{"application", "rss", "xml"}
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO(bep) output mime.AddExtensionType
|
// TODO(bep) output mime.AddExtensionType
|
||||||
// TODO(bep) text/template vs html/template
|
|
||||||
|
|
|
@ -20,6 +20,13 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDefaultTypes(t *testing.T) {
|
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, "text", HTMLType.MainType)
|
||||||
require.Equal(t, "html", HTMLType.SubType)
|
require.Equal(t, "html", HTMLType.SubType)
|
||||||
require.Equal(t, "html", HTMLType.Suffix)
|
require.Equal(t, "html", HTMLType.Suffix)
|
||||||
|
|
|
@ -31,6 +31,15 @@ var (
|
||||||
Rel: "amphtml",
|
Rel: "amphtml",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CalendarType = Format{
|
||||||
|
Name: "Calendar",
|
||||||
|
MediaType: media.CalendarType,
|
||||||
|
IsPlainText: true,
|
||||||
|
Protocol: "webcal://",
|
||||||
|
BaseName: "index",
|
||||||
|
Rel: "alternate",
|
||||||
|
}
|
||||||
|
|
||||||
CSSType = Format{
|
CSSType = Format{
|
||||||
Name: "CSS",
|
Name: "CSS",
|
||||||
MediaType: media.CSSType,
|
MediaType: media.CSSType,
|
||||||
|
|
|
@ -21,6 +21,12 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDefaultTypes(t *testing.T) {
|
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, "HTML", HTMLType.Name)
|
||||||
require.Equal(t, media.HTMLType, HTMLType.MediaType)
|
require.Equal(t, media.HTMLType, HTMLType.MediaType)
|
||||||
require.Empty(t, HTMLType.Path)
|
require.Empty(t, HTMLType.Path)
|
||||||
|
|
Loading…
Reference in a new issue