mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
Render the shortcodes as late as possible
This is needed to make shortcode users happy with the new multilanguage support, but it will also solve many other related posts about "stuff not available in the shortcode". We will have to revisit this re the handler chain at some point, but that will be easier now as the integration test story has improved so much. As part of this commit, the site-building tests in page_test.go is refreshed, they now tests for all the rendering engines (when available), and all of them now uses the same code-path as used in production. Fixes #1229 Fixes #2323 Fixes ##1076
This commit is contained in:
@@ -30,6 +30,7 @@ import (
|
||||
"github.com/spf13/hugo/target"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -84,10 +85,16 @@ func pageMust(p *Page, err error) *Page {
|
||||
}
|
||||
|
||||
func TestDegenerateRenderThingMissingTemplate(t *testing.T) {
|
||||
p, _ := NewPageFrom(strings.NewReader(pageSimpleTitle), "content/a/file.md")
|
||||
p.Convert()
|
||||
s := new(Site)
|
||||
s.prepTemplates(nil)
|
||||
s := newSiteFromSources("content/a/file.md", pageSimpleTitle)
|
||||
|
||||
if err := buildSiteSkipRender(s); err != nil {
|
||||
t.Fatalf("Failed to build site: %s", err)
|
||||
}
|
||||
|
||||
require.Len(t, s.Pages, 1)
|
||||
|
||||
p := s.Pages[0]
|
||||
|
||||
err := s.renderThing(p, "foobar", nil)
|
||||
if err == nil {
|
||||
t.Errorf("Expected err to be returned when missing the template.")
|
||||
|
Reference in New Issue
Block a user