-
Notifications
You must be signed in to change notification settings - Fork 0
/
pagecollections.go
52 lines (42 loc) · 1.25 KB
/
pagecollections.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package hugolib
import (
"github.com/sunwei/hugo-playground/resources/page"
)
// PageCollections contains the page collections for a site.
type PageCollections struct {
pageMap *pageMap
}
// Pages returns all pages.
// This is for the current language only.
func (c *PageCollections) Pages() page.Pages {
panic("page collections Pages not implemented")
}
// RegularPages returns all the regular pages.
// This is for the current language only.
func (c *PageCollections) RegularPages() page.Pages {
panic("page collections not implement RegularPages")
}
// AllPages returns all pages for all languages.
func (c *PageCollections) AllPages() page.Pages {
panic("page collections not implement AllPages")
}
// AllRegularPages AllPages returns all regular pages for all languages.
func (c *PageCollections) AllRegularPages() page.Pages {
panic("page collections not implement AllRegularPages")
}
func newPageCollections(m *pageMap) *PageCollections {
if m == nil {
panic("must provide a pageMap")
}
c := &PageCollections{pageMap: m}
return c
}
func (*PageCollections) findPagesByKindIn(kind string, inPages page.Pages) page.Pages {
var pages page.Pages
for _, p := range inPages {
if p.Kind() == kind {
pages = append(pages, p)
}
}
return pages
}