diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-01-10 10:55:03 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-02-04 11:37:25 +0700 |
commit | c71e1b106e6011d148cac899f83c4685dee33a22 (patch) | |
tree | c5c7090f0c2398c7771e4908ebcc97aa7714ffd2 /hugolib/pagination.go | |
parent | 0ada40591216572b0e4c6a8ab986b0aa4fb13c13 (diff) |
all: Refactor to nonglobal file systems
Updates #2701
Fixes #2951
Diffstat (limited to 'hugolib/pagination.go')
-rw-r--r-- | hugolib/pagination.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/hugolib/pagination.go b/hugolib/pagination.go index 14a081131..acfa2b75e 100644 --- a/hugolib/pagination.go +++ b/hugolib/pagination.go @@ -279,7 +279,7 @@ func (p *Page) Paginator(options ...interface{}) (*Pager, error) { return } - pagers, err := paginatePages(p.Data["Pages"], pagerSize, p.sections...) + pagers, err := paginatePages(p.s.PathSpec, p.Data["Pages"], pagerSize, p.sections...) if err != nil { initError = err @@ -322,7 +322,7 @@ func (p *Page) Paginate(seq interface{}, options ...interface{}) (*Pager, error) if p.paginator != nil { return } - pagers, err := paginatePages(seq, pagerSize, p.sections...) + pagers, err := paginatePages(p.s.PathSpec, seq, pagerSize, p.sections...) if err != nil { initError = err @@ -371,13 +371,13 @@ func resolvePagerSize(options ...interface{}) (int, error) { return pas, nil } -func paginatePages(seq interface{}, pagerSize int, sections ...string) (pagers, error) { +func paginatePages(pathSpec *helpers.PathSpec, seq interface{}, pagerSize int, sections ...string) (pagers, error) { if pagerSize <= 0 { return nil, errors.New("'paginate' configuration setting must be positive to paginate") } - urlFactory := newPaginationURLFactory(sections...) + urlFactory := newPaginationURLFactory(pathSpec, sections...) var paginator *paginator @@ -504,8 +504,7 @@ func newPaginator(elements []paginatedElement, total, size int, urlFactory pagin return p, nil } -func newPaginationURLFactory(pathElements ...string) paginationURLFactory { - pathSpec := helpers.CurrentPathSpec() +func newPaginationURLFactory(pathSpec *helpers.PathSpec, pathElements ...string) paginationURLFactory { basePath := path.Join(pathElements...) |