summaryrefslogtreecommitdiffstats
path: root/hugolib/template_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-03-09 12:04:33 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-03-09 15:01:55 +0100
commitffcb4aeb8e392a80da7cad0f1e03a4102efb24ec (patch)
tree945afe631ef8451f8a401b0a159a78b64e905713 /hugolib/template_test.go
parent8279d2e2271ee64725133d36a12d1d7e2158bffd (diff)
Fix handling of HTML files without front matter
This means that any HTML file inside /content will be treated as a regular file. If you want it processes with shortcodes and a layout, add front matter. The defintion of an HTML file here is: * File with extension .htm or .html * With first non-whitespace character "<" that isn't a HTML comment. This is in line with the documentation. Fixes #7030 Fixes #7028 See #6789
Diffstat (limited to 'hugolib/template_test.go')
-rw-r--r--hugolib/template_test.go81
1 files changed, 0 insertions, 81 deletions
diff --git a/hugolib/template_test.go b/hugolib/template_test.go
index 99e57c75f..9f04aabdd 100644
--- a/hugolib/template_test.go
+++ b/hugolib/template_test.go
@@ -245,87 +245,6 @@ Page Content
}
-func TestTemplateLateTemplates(t *testing.T) {
- t.Parallel()
- b := newTestSitesBuilder(t).WithSimpleConfigFile().Running()
-
- numPages := 500 // To get some parallelism
- homeTempl := `
-Len RegularPages: {{ len site.RegularPages }}
-{{ range site.RegularPages }}
-Link: {{ .RelPermalink }} Len Content: {{ len .Content }}
-{{ end }}
-`
- pageTemplate := `<!doctype html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <title>{{ .RelPermalink }}</title>
- <meta name="description" content="The HTML5 Herald">
- <meta name="author" content="SitePoint">
- <link rel="stylesheet" href="css/styles.css?v=1.0">
-</head>
-<body>
- <h1>{{ .RelPermalink }}</h1>
- <p>Shortcode: {{< shortcode >}}</p>
- <p>Partial: {{ partial "mypartial.html" . }}</p>
- <script src="js/scripts.js"></script>
-</body>
-</html>
-`
-
- b.WithTemplatesAdded(
- "index.html", homeTempl,
- "partials/mypartial.html", `this my partial`,
- )
-
- // Make sure we get some parallelism.
- for i := 0; i < numPages; i++ {
- b.WithContent(fmt.Sprintf("page%d.html", i+1), pageTemplate)
- }
-
- b.Build(BuildCfg{})
-
- b.AssertFileContent("public/index.html", fmt.Sprintf(`
-Len RegularPages: %d
-Link: /page3/ Len Content: 0
-Link: /page22/ Len Content: 0
-`, numPages))
-
- for i := 0; i < numPages; i++ {
- b.AssertFileContent(fmt.Sprintf("public/page%d/index.html", i+1),
- fmt.Sprintf(`<title>/page%d/</title>`, i+1),
- `<p>Shortcode: Shortcode: Hello</p>`,
- "<p>Partial: this my partial</p>",
- )
- }
-
- b.EditFiles(
- "layouts/partials/mypartial.html", `this my changed partial`,
- "layouts/index.html", (homeTempl + "CHANGED"),
- )
- for i := 0; i < 5; i++ {
- b.EditFiles(fmt.Sprintf("content/page%d.html", i+1), pageTemplate+"CHANGED")
- }
-
- b.Build(BuildCfg{})
- b.AssertFileContent("public/index.html", fmt.Sprintf(`
-Len RegularPages: %d
-Link: /page3/ Len Content: 0
-Link: /page2/ Len Content: 0
-CHANGED
-`, numPages))
- for i := 0; i < 5; i++ {
- b.AssertFileContent(fmt.Sprintf("public/page%d/index.html", i+1),
- fmt.Sprintf(`<title>/page%d/</title>`, i+1),
- `<p>Shortcode: Shortcode: Hello</p>`,
- "<p>Partial: this my changed partial</p>",
- "CHANGED",
- )
- }
-
-}
-
func TestTemplateManyBaseTemplates(t *testing.T) {
t.Parallel()
b := newTestSitesBuilder(t).WithSimpleConfigFile()