mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
Create pages from _content.gotmpl
Closes #12427 Closes #12485 Closes #6310 Closes #5074
This commit is contained in:
@@ -18,8 +18,10 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gohugoio/hugo/common/loggers"
|
||||
"github.com/gohugoio/hugo/config"
|
||||
"github.com/gohugoio/hugo/config/testconfig"
|
||||
"github.com/gohugoio/hugo/media"
|
||||
|
||||
"github.com/gohugoio/hugo/resources/page/pagemeta"
|
||||
|
||||
@@ -148,3 +150,32 @@ func TestFrontMatterDatesDefaultKeyword(t *testing.T) {
|
||||
c.Assert(d.PageConfig.Dates.PublishDate.Day(), qt.Equals, 4)
|
||||
c.Assert(d.PageConfig.Dates.ExpiryDate.IsZero(), qt.Equals, true)
|
||||
}
|
||||
|
||||
func TestContentMediaTypeFromMarkup(t *testing.T) {
|
||||
c := qt.New(t)
|
||||
logger := loggers.NewDefault()
|
||||
|
||||
for _, test := range []struct {
|
||||
in string
|
||||
expected string
|
||||
}{
|
||||
{"", "text/markdown"},
|
||||
{"md", "text/markdown"},
|
||||
{"markdown", "text/markdown"},
|
||||
{"mdown", "text/markdown"},
|
||||
{"goldmark", "text/markdown"},
|
||||
{"html", "text/html"},
|
||||
{"htm", "text/html"},
|
||||
{"asciidoc", "text/asciidoc"},
|
||||
{"asciidocext", "text/asciidoc"},
|
||||
{"adoc", "text/asciidoc"},
|
||||
{"pandoc", "text/pandoc"},
|
||||
{"pdc", "text/pandoc"},
|
||||
{"rst", "text/rst"},
|
||||
} {
|
||||
var pc pagemeta.PageConfig
|
||||
pc.Content.Markup = test.in
|
||||
c.Assert(pc.Compile("", true, "", logger, media.DefaultTypes), qt.IsNil)
|
||||
c.Assert(pc.ContentMediaType.Type, qt.Equals, test.expected)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user