From 2aeea2082f8fbb36f503c508a08491c4a550f6ed Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sat, 20 Nov 2021 12:57:00 +0100 Subject: Improved list category descriptions --- assets/css/_vars.scss | 2 +- scripts/metadata_filter.lua | 12 ++++++++---- templates/layouts/categorized_list.html | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/assets/css/_vars.scss b/assets/css/_vars.scss index 7c2534d..3260ec4 100644 --- a/assets/css/_vars.scss +++ b/assets/css/_vars.scss @@ -1,5 +1,5 @@ $breakpoints: ( - lg: 1500px, + lg: 1360px, md: 900px, sm: 600px, xs: 400px, diff --git a/scripts/metadata_filter.lua b/scripts/metadata_filter.lua index c154708..9125696 100644 --- a/scripts/metadata_filter.lua +++ b/scripts/metadata_filter.lua @@ -210,7 +210,8 @@ 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 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, @@ -227,7 +228,8 @@ function generate_list(meta) return { title = cat.title, - content = cat.content, + description = (cat.description and pandoc.MetaBlocks(pandoc.Para(cat.description))) or + (not cat.no_description and cat.content), url = cat.url, grid = cat.list_grid, items = items, @@ -237,7 +239,8 @@ 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 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) @@ -269,7 +272,8 @@ function generate_list(meta) return { title = cat.title, - content = cat.content, + description = (cat.description and pandoc.MetaBlocks(pandoc.Para(cat.description))) or + (not cat.no_description and cat.content), url = cat.url, grid = cat.list_grid, items = items, diff --git a/templates/layouts/categorized_list.html b/templates/layouts/categorized_list.html index 0508230..690ab68 100644 --- a/templates/layouts/categorized_list.html +++ b/templates/layouts/categorized_list.html @@ -14,8 +14,8 @@ $body$ $if(it.omitted)$$it.omitted$ more$endif$ - $if(it.content)$ - $it.content$ + $if(it.description)$ + $it.description$ $endif$ $if(it.grid)$ -- cgit v1.2.3-70-g09d2