Fix .Fragments when called cross sites on uninitialized output format

Fixes #10794
This commit is contained in:
Bjørn Erik Pedersen
2023-03-05 10:32:00 +01:00
parent df5608f8a0
commit b83050cb40
7 changed files with 114 additions and 33 deletions

View File

@@ -17,7 +17,6 @@ import (
"bytes"
"context"
"fmt"
"html/template"
"path"
"path/filepath"
"sort"
@@ -151,19 +150,6 @@ func (p *pageState) GetIdentity() identity.Identity {
return identity.NewPathIdentity(files.ComponentFolderContent, filepath.FromSlash(p.Pathc()))
}
func (p *pageState) Fragments(ctx context.Context) *tableofcontents.Fragments {
p.s.initInit(ctx, p.cp.initToC, p)
if p.pageOutput.cp.tableOfContents == nil {
return tableofcontents.Empty
}
return p.pageOutput.cp.tableOfContents
}
func (p *pageState) TableOfContents(ctx context.Context) template.HTML {
p.s.initInit(ctx, p.cp.initToC, p)
return p.pageOutput.cp.tableOfContentsHTML
}
func (p *pageState) HeadingsFiltered(context.Context) tableofcontents.Headings {
return nil
}
@@ -957,6 +943,7 @@ func (p *pageState) shiftToOutputFormat(isRenderingSite bool, idx int) error {
p.pageOutput.contentRenderer = lcp
p.pageOutput.ContentProvider = lcp
p.pageOutput.PageRenderProvider = lcp
p.pageOutput.TableOfContentsProvider = lcp
}
}