From cc02f7e0b99bf4b4c5139a3ae83840bf833a0c6d Mon Sep 17 00:00:00 2001 From: Volpeon Date: Wed, 17 Nov 2021 18:49:27 +0100 Subject: Better list limit --- content/index.md | 3 +-- content/projects/index.md | 7 ++++--- scripts/metadata_filter.lua | 4 ++-- templates/layouts/categorized_list.html | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/content/index.md b/content/index.md index f6e7893..75efead 100644 --- a/content/index.md +++ b/content/index.md @@ -1,6 +1,5 @@ --- -title: Volpeon's Den -list_limit: 4 +title: Volpeon's Den --- Hi, I'm Volpeon! I'm a software developer who creates vector art. diff --git a/content/projects/index.md b/content/projects/index.md index 546ae46..3b6b718 100644 --- a/content/projects/index.md +++ b/content/projects/index.md @@ -1,5 +1,6 @@ --- -title: Projects -position: 2 -list_grid: true +title: Projects +position: 2 +list_grid: true +list_limit: 4 --- diff --git a/scripts/metadata_filter.lua b/scripts/metadata_filter.lua index 5fa7dfc..c154708 100644 --- a/scripts/metadata_filter.lua +++ b/scripts/metadata_filter.lua @@ -196,8 +196,6 @@ end function generate_list(meta) if not meta.pages then return nil end - local limit = (meta.list_limit and tonumber(pandoc.utils.stringify(meta.list_limit))) or 9999 - if meta.depth == "1" then return meta.pages.all:map(function(p) return { @@ -212,6 +210,7 @@ function generate_list(meta) end) elseif meta.depth == "2" then return meta.pages.all:map(function(cat) + local limit = (cat.list_limit and tonumber(pandoc.utils.stringify(cat.list_limit))) or 9999 local allItems = ((cat.pages and cat.pages.all) or pandoc.List()):map(function(p) return { title = p.title, @@ -238,6 +237,7 @@ function generate_list(meta) end):filter(function(cat) return #cat.items ~= 0 end) elseif meta.depth == "3" then return meta.pages.all:map(function(cat) + local limit = (cat.list_limit and tonumber(pandoc.utils.stringify(cat.list_limit))) or 9999 local allItems = (cat.pages and cat.pages.all or pandoc.List()):flatMap(function(c) if c.pages then return c.pages.all:map(function(p) diff --git a/templates/layouts/categorized_list.html b/templates/layouts/categorized_list.html index c5a76b2..0508230 100644 --- a/templates/layouts/categorized_list.html +++ b/templates/layouts/categorized_list.html @@ -10,7 +10,7 @@ $body$

- $it.title$ → + $it.title$

$if(it.omitted)$$it.omitted$ more$endif$
-- cgit v1.2.3-70-g09d2