diff options
author | Bjørn Erik Pedersen <[email protected]> | 2022-10-26 10:09:38 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2022-10-26 13:00:21 +0200 |
commit | 631d768be9dc2d5175eeacb8bf34ed8233e2201a (patch) | |
tree | 670dbabab18d4215f2495dd07fe012ed4e223438 /hugolib/page__output.go | |
parent | e5d2a8f6a3121701eb95712b5540989fafaa0c71 (diff) | |
download | hugo-631d768be9dc2d5175eeacb8bf34ed8233e2201a.tar.gz hugo-631d768be9dc2d5175eeacb8bf34ed8233e2201a.zip |
Revise the fix for shortcode vs output format nilpointer
We do lazy initialization and (potentially) reuse of an output format's rendered content. We do this evaluation when we
start a new rendering a new output format. There are, however, situation where these borders gets crossed (e.g.
accessing content from another output format). We have a check for this in place for most cases, but not the content
rendering of inner markdown blocks inside shortcodes. This patch applies that same logic to the newly introduced
RenderContent method (which is not available from the templates).
Fixes #10391
Diffstat (limited to 'hugolib/page__output.go')
-rw-r--r-- | hugolib/page__output.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/hugolib/page__output.go b/hugolib/page__output.go index 413323477..4ef78b612 100644 --- a/hugolib/page__output.go +++ b/hugolib/page__output.go @@ -81,6 +81,7 @@ type pageOutput struct { // These interface provides the functionality that is specific for this // output format. + contentRenderer page.ContentRenderer pagePerOutputProviders page.ContentProvider page.TableOfContentsProvider @@ -94,10 +95,12 @@ func (p *pageOutput) initContentProvider(cp *pageContentOutput) { if cp == nil { return } + p.contentRenderer = cp p.ContentProvider = cp p.TableOfContentsProvider = cp p.PageRenderProvider = cp p.cp = cp + } func (p *pageOutput) enablePlaceholders() { |