aboutsummaryrefslogtreecommitdiffhomepage
path: root/resources/page/pagemeta/page_frontmatter_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'resources/page/pagemeta/page_frontmatter_test.go')
-rw-r--r--resources/page/pagemeta/page_frontmatter_test.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/resources/page/pagemeta/page_frontmatter_test.go b/resources/page/pagemeta/page_frontmatter_test.go
index 9e1151f22..18f9e5aa1 100644
--- a/resources/page/pagemeta/page_frontmatter_test.go
+++ b/resources/page/pagemeta/page_frontmatter_test.go
@@ -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)
+ }
+}