satelito

Static [web] site (or page) generator (ssg) made with Lua script.
git clone git://soucy.cc/satelito.git
Log | Files | Refs | README

commit 2847af60e27cabbfea4146ee77d8f319ff9f0300
parent df6b3af9ce8874cfaa74488798eb1bf8fe354d4e
Author: Hugo Soucy <hugo@soucy.cc>
Date:   Tue, 23 Nov 2021 22:07:38 -0500

Create the list.set_pagination function and make a first test

Diffstat:
Msatelito/list.lua | 18++++++++++++++++++
1 file changed, 18 insertions(+), 0 deletions(-)

diff --git a/satelito/list.lua b/satelito/list.lua @@ -8,6 +8,21 @@ local lume = require 'satelito.lib.lume.lume' local inspect = require 'inspect' +-- Pagination +function list.set_pagination(page_list, len) + local sliced_list = {} + local i = 1 + + while(i < #page_list) do + local j = i + + i = i + (len-1) + sliced_list[#sliced_list+1] = lume.slice(page_list, j, i) + end + + return sliced_list +end + -- Children function list.get_children(children_list, sitemap, asc) local children = {} @@ -29,6 +44,9 @@ function list.get_children(children_list, sitemap, asc) end end + print(inspect(list.set_pagination(children, 2))) + --print(inspect(children)) + return children end