diff options
author | Bjørn Erik Pedersen <[email protected]> | 2022-01-27 09:46:51 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2022-01-27 11:51:13 +0100 |
commit | f22c4aba047e89130bf9921c5ded3823743a9ffa (patch) | |
tree | c8ab595f87d320359d3c80236fd9ac6d619817ae /hugolib/page__output.go | |
parent | 85d31f7bfb7a13c9ab7655829a315a820dc1b403 (diff) | |
download | hugo-f22c4aba047e89130bf9921c5ded3823743a9ffa.tar.gz hugo-f22c4aba047e89130bf9921c5ded3823743a9ffa.zip |
Make the RenderString content provider fix more general
Updates #9383
Diffstat (limited to 'hugolib/page__output.go')
-rw-r--r-- | hugolib/page__output.go | 60 |
1 files changed, 3 insertions, 57 deletions
diff --git a/hugolib/page__output.go b/hugolib/page__output.go index 377e16df5..413323477 100644 --- a/hugolib/page__output.go +++ b/hugolib/page__output.go @@ -14,7 +14,6 @@ package hugolib import ( - "github.com/gohugoio/hugo/markup/converter" "github.com/gohugoio/hugo/output" "github.com/gohugoio/hugo/resources/page" "github.com/gohugoio/hugo/resources/resource" @@ -59,6 +58,7 @@ func newPageOutput( pagePerOutputProviders: providers, ContentProvider: page.NopPage, TableOfContentsProvider: page.NopPage, + PageRenderProvider: page.NopPage, render: render, paginator: pag, } @@ -84,73 +84,19 @@ type pageOutput struct { pagePerOutputProviders page.ContentProvider page.TableOfContentsProvider + page.PageRenderProvider // May be nil. cp *pageContentOutput } -func (o *pageOutput) initRenderHooks() error { - if o.cp == nil { - return nil - } - - var initErr error - - o.cp.renderHooks.init.Do(func() { - ps := o.cp.p - - c := ps.getContentConverter() - if c == nil || !c.Supports(converter.FeatureRenderHooks) { - return - } - - h, err := ps.createRenderHooks(o.f) - if err != nil { - initErr = err - return - } - o.cp.renderHooks.hooks = h - - if !o.cp.renderHooksHaveVariants || h.IsZero() { - // Check if there is a different render hooks template - // for any of the other page output formats. - // If not, we can reuse this. - for _, po := range ps.pageOutputs { - if po.f.Name != o.f.Name { - h2, err := ps.createRenderHooks(po.f) - if err != nil { - initErr = err - return - } - - if h2.IsZero() { - continue - } - - if o.cp.renderHooks.hooks.IsZero() { - o.cp.renderHooks.hooks = h2 - } - - o.cp.renderHooksHaveVariants = !h2.Eq(o.cp.renderHooks.hooks) - - if o.cp.renderHooksHaveVariants { - break - } - - } - } - } - }) - - return initErr -} - func (p *pageOutput) initContentProvider(cp *pageContentOutput) { if cp == nil { return } p.ContentProvider = cp p.TableOfContentsProvider = cp + p.PageRenderProvider = cp p.cp = cp } |