mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Simplify a bit pagination code.
This commit is contained in:
parent
c90a62ea13
commit
18e6ec9f02
1 changed files with 3 additions and 11 deletions
|
|
@ -177,21 +177,13 @@ class Writer(object):
|
||||||
localcontext['output_file'] = name
|
localcontext['output_file'] = name
|
||||||
localcontext.update(kwargs)
|
localcontext.update(kwargs)
|
||||||
|
|
||||||
# check paginated
|
# pagination
|
||||||
paginated = paginated or {}
|
|
||||||
if paginated:
|
if paginated:
|
||||||
name_root = os.path.splitext(name)[0]
|
name_root = os.path.splitext(name)[0]
|
||||||
|
|
||||||
# pagination needed, init paginators
|
# pagination needed, init paginators
|
||||||
paginators = {}
|
paginators = {key: Paginator(name_root, val, self.settings)
|
||||||
for key in paginated.keys():
|
for key, val in paginated.items()}
|
||||||
object_list = paginated[key]
|
|
||||||
|
|
||||||
paginators[key] = Paginator(
|
|
||||||
name_root,
|
|
||||||
object_list,
|
|
||||||
self.settings,
|
|
||||||
)
|
|
||||||
|
|
||||||
# generated pages, and write
|
# generated pages, and write
|
||||||
for page_num in range(list(paginators.values())[0].num_pages):
|
for page_num in range(list(paginators.values())[0].num_pages):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue