Skip to content

Commit

Permalink
Add Page.Contents with scope support
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Aug 13, 2024
1 parent b2d4f67 commit 2a97e48
Show file tree
Hide file tree
Showing 10 changed files with 596 additions and 282 deletions.
8 changes: 3 additions & 5 deletions hugolib/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ var (
pageTypesProvider = resource.NewResourceTypesProvider(media.Builtin.OctetType, pageResourceType)
nopPageOutput = &pageOutput{
pagePerOutputProviders: nopPagePerOutput,
ContentsProvider: page.NopPage,
ContentProvider: page.NopPage,
}
)
Expand Down Expand Up @@ -213,11 +214,8 @@ func (p *pageHeadingsFiltered) page() page.Page {

// For internal use by the related content feature.
func (p *pageState) ApplyFilterToHeadings(ctx context.Context, fn func(*tableofcontents.Heading) bool) related.Document {
r, err := p.m.content.contentToC(ctx, p.pageOutput.pco)
if err != nil {
panic(err)
}
headings := r.tableOfContents.Headings.FilterBy(fn)
fragments := p.pageOutput.pco.c().Fragments(ctx)
headings := fragments.Headings.FilterBy(fn)
return &pageHeadingsFiltered{
pageState: p,
headings: headings,
Expand Down
Loading

0 comments on commit 2a97e48

Please sign in to comment.