summaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
authorSepts <github@septs.pw>2022-11-30 12:02:57 +0800
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-12-23 10:14:53 +0100
commit3a216186b2cfa479c250dabb64eff022a388fb40 (patch)
tree77ebcc25658f473b6c9b077593ab572974fae946 /resources
parent7874b96815abf1e10b2947d9b3804767108ec939 (diff)
resource/page: Add Page.Ancestors
Fixes #10567
Diffstat (limited to 'resources')
-rw-r--r--resources/page/page.go3
-rw-r--r--resources/page/page_nop.go4
-rw-r--r--resources/page/testhelpers_test.go4
3 files changed, 11 insertions, 0 deletions
diff --git a/resources/page/page.go b/resources/page/page.go
index f9b8fdcec..929f04d93 100644
--- a/resources/page/page.go
+++ b/resources/page/page.go
@@ -407,6 +407,9 @@ type TreeProvider interface {
// To get a section's subsections, see Page's Sections method.
Parent() Page
+ // Ancestors returns the ancestors of each page
+ Ancestors() Pages
+
// Sections returns this section's subsections, if any.
// Note that for non-sections, this method will always return an empty list.
Sections() Pages
diff --git a/resources/page/page_nop.go b/resources/page/page_nop.go
index df3227f0a..15f8c3950 100644
--- a/resources/page/page_nop.go
+++ b/resources/page/page_nop.go
@@ -348,6 +348,10 @@ func (p *nopPage) Parent() Page {
return nil
}
+func (p *nopPage) Ancestors() Pages {
+ return nil
+}
+
func (p *nopPage) Path() string {
return ""
}
diff --git a/resources/page/testhelpers_test.go b/resources/page/testhelpers_test.go
index 30b8e4dff..22346c389 100644
--- a/resources/page/testhelpers_test.go
+++ b/resources/page/testhelpers_test.go
@@ -416,6 +416,10 @@ func (p *testPage) Parent() Page {
panic("not implemented")
}
+func (p *testPage) Ancestors() Pages {
+ panic("not implemented")
+}
+
func (p *testPage) Path() string {
return p.path
}