Add custom protocol support in Permalink

This commit is contained in:
Bjørn Erik Pedersen 2017-03-23 20:05:10 +01:00
parent 8bcc08e3b0
commit d851d6b98f
9 changed files with 171 additions and 37 deletions

View file

@ -52,7 +52,7 @@ func TestDefaultOutputFormats(t *testing.T) {
}
func TestSiteWithPageOutputs(t *testing.T) {
for _, outputs := range [][]string{{"html", "json"}, {"json"}} {
for _, outputs := range [][]string{{"html", "json", "calendar"}, {"json"}} {
t.Run(fmt.Sprintf("%v", outputs), func(t *testing.T) {
doTestSiteWithPageOutputs(t, outputs)
})
@ -146,4 +146,12 @@ Output/Rel: {{ .Name -}}/{{ .Rel }}|
require.Equal(t, "/blog/index.json", json.RelPermalink())
require.Equal(t, "http://example.com/blog/index.json", json.Permalink())
if helpers.InStringArray(outputs, "cal") {
// TODO(bep) output have do some protocil handling for the default too if set.
cal := of.Get("calendar")
require.NotNil(t, cal)
require.Equal(t, "/blog/index.ics", cal.RelPermalink())
require.Equal(t, "webcal://example.com/blog/index.ics", cal.Permalink())
}
}