Revert "tpl: Rework to handle both text and HTML templates"

Will have to take another stab at this ...

This reverts commit 5c5efa03d2.

Closes #3260
This commit is contained in:
Bjørn Erik Pedersen
2017-04-02 14:20:34 +02:00
parent c97dae40d9
commit 7eb71ee064
31 changed files with 839 additions and 1248 deletions

View File

@@ -65,7 +65,7 @@ func TestDefaultTypes(t *testing.T) {
}
func TestGetFormat(t *testing.T) {
func TestGetType(t *testing.T) {
tp, _ := GetFormat("html")
require.Equal(t, HTMLFormat, tp)
tp, _ = GetFormat("HTML")
@@ -73,28 +73,3 @@ func TestGetFormat(t *testing.T) {
_, found := GetFormat("FOO")
require.False(t, found)
}
func TestGeGetFormatByName(t *testing.T) {
formats := Formats{AMPFormat, CalendarFormat}
tp, _ := formats.GetByName("AMP")
require.Equal(t, AMPFormat, tp)
_, found := formats.GetByName("HTML")
require.False(t, found)
_, found = formats.GetByName("FOO")
require.False(t, found)
}
func TestGeGetFormatByExt(t *testing.T) {
formats1 := Formats{AMPFormat, CalendarFormat}
formats2 := Formats{AMPFormat, HTMLFormat, CalendarFormat}
tp, _ := formats1.GetBySuffix("html")
require.Equal(t, AMPFormat, tp)
tp, _ = formats1.GetBySuffix("ics")
require.Equal(t, CalendarFormat, tp)
_, found := formats1.GetBySuffix("not")
require.False(t, found)
// ambiguous
_, found = formats2.GetByName("html")
require.False(t, found)
}