diff options
author | Volpeon <git@volpeon.ink> | 2021-11-20 12:57:00 +0100 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2021-11-20 12:57:00 +0100 |
commit | 2aeea2082f8fbb36f503c508a08491c4a550f6ed (patch) | |
tree | cabb2c7a0bea4cd4fcedabc4e2c4b840446167bf /scripts | |
parent | Fix card hover transition on Chrome (diff) | |
download | volpeon.ink-2aeea2082f8fbb36f503c508a08491c4a550f6ed.tar.gz volpeon.ink-2aeea2082f8fbb36f503c508a08491c4a550f6ed.tar.bz2 volpeon.ink-2aeea2082f8fbb36f503c508a08491c4a550f6ed.zip |
Improved list category descriptions
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/metadata_filter.lua | 12 |
1 files changed, 8 insertions, 4 deletions
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) | |||
210 | end) | 210 | end) |
211 | elseif meta.depth == "2" then | 211 | elseif meta.depth == "2" then |
212 | return meta.pages.all:map(function(cat) | 212 | return meta.pages.all:map(function(cat) |
213 | local limit = (cat.list_limit and tonumber(pandoc.utils.stringify(cat.list_limit))) or 9999 | 213 | local limit = (cat.list_limit and tonumber(pandoc.utils.stringify(cat.list_limit))) or |
214 | 9999 | ||
214 | local allItems = ((cat.pages and cat.pages.all) or pandoc.List()):map(function(p) | 215 | local allItems = ((cat.pages and cat.pages.all) or pandoc.List()):map(function(p) |
215 | return { | 216 | return { |
216 | title = p.title, | 217 | title = p.title, |
@@ -227,7 +228,8 @@ function generate_list(meta) | |||
227 | 228 | ||
228 | return { | 229 | return { |
229 | title = cat.title, | 230 | title = cat.title, |
230 | content = cat.content, | 231 | description = (cat.description and pandoc.MetaBlocks(pandoc.Para(cat.description))) or |
232 | (not cat.no_description and cat.content), | ||
231 | url = cat.url, | 233 | url = cat.url, |
232 | grid = cat.list_grid, | 234 | grid = cat.list_grid, |
233 | items = items, | 235 | items = items, |
@@ -237,7 +239,8 @@ function generate_list(meta) | |||
237 | end):filter(function(cat) return #cat.items ~= 0 end) | 239 | end):filter(function(cat) return #cat.items ~= 0 end) |
238 | elseif meta.depth == "3" then | 240 | elseif meta.depth == "3" then |
239 | return meta.pages.all:map(function(cat) | 241 | return meta.pages.all:map(function(cat) |
240 | local limit = (cat.list_limit and tonumber(pandoc.utils.stringify(cat.list_limit))) or 9999 | 242 | local limit = (cat.list_limit and tonumber(pandoc.utils.stringify(cat.list_limit))) or |
243 | 9999 | ||
241 | local allItems = (cat.pages and cat.pages.all or pandoc.List()):flatMap(function(c) | 244 | local allItems = (cat.pages and cat.pages.all or pandoc.List()):flatMap(function(c) |
242 | if c.pages then | 245 | if c.pages then |
243 | return c.pages.all:map(function(p) | 246 | return c.pages.all:map(function(p) |
@@ -269,7 +272,8 @@ function generate_list(meta) | |||
269 | 272 | ||
270 | return { | 273 | return { |
271 | title = cat.title, | 274 | title = cat.title, |
272 | content = cat.content, | 275 | description = (cat.description and pandoc.MetaBlocks(pandoc.Para(cat.description))) or |
276 | (not cat.no_description and cat.content), | ||
273 | url = cat.url, | 277 | url = cat.url, |
274 | grid = cat.list_grid, | 278 | grid = cat.list_grid, |
275 | items = items, | 279 | items = items, |