diff options
| author | Volpeon <git@volpeon.ink> | 2023-01-10 09:04:11 +0100 |
|---|---|---|
| committer | Volpeon <git@volpeon.ink> | 2023-01-10 09:04:11 +0100 |
| commit | d8bda573008ab1f23e30cb4f1533468090e5dddb (patch) | |
| tree | 4d7e7f7c115e0bbe0c92787fd40d180d81f30fab /scripts | |
| parent | Update (diff) | |
| download | volpeon.ink-d8bda573008ab1f23e30cb4f1533468090e5dddb.tar.gz volpeon.ink-d8bda573008ab1f23e30cb4f1533468090e5dddb.tar.bz2 volpeon.ink-d8bda573008ab1f23e30cb4f1533468090e5dddb.zip | |
Better asset handling; paragraph fix for new Pandoc versions; updated emojis
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/lib/common.lua | 7 | ||||
| -rw-r--r-- | scripts/page.lua | 13 |
2 files changed, 12 insertions, 8 deletions
diff --git a/scripts/lib/common.lua b/scripts/lib/common.lua index d3c6c44..055e783 100644 --- a/scripts/lib/common.lua +++ b/scripts/lib/common.lua | |||
| @@ -20,12 +20,7 @@ function pandoc.List:flatten() | |||
| 20 | end | 20 | end |
| 21 | 21 | ||
| 22 | function pandoc.List:flatMap(fn) | 22 | function pandoc.List:flatMap(fn) |
| 23 | local mapped = self:map(fn) | 23 | return self:map(fn):flatten() |
| 24 | local result = pandoc.List() | ||
| 25 | |||
| 26 | for i = 1, #mapped do result:extend(mapped[i]) end | ||
| 27 | |||
| 28 | return result | ||
| 29 | end | 24 | end |
| 30 | 25 | ||
| 31 | function pandoc.List:filterMap(fn) | 26 | function pandoc.List:filterMap(fn) |
diff --git a/scripts/page.lua b/scripts/page.lua index 33982ba..606288a 100644 --- a/scripts/page.lua +++ b/scripts/page.lua | |||
| @@ -77,10 +77,19 @@ function cat_to_list_cat(meta, allItems) | |||
| 77 | local items = allItems:take(limit) | 77 | local items = allItems:take(limit) |
| 78 | local omitted = #allItems - #items | 78 | local omitted = #allItems - #items |
| 79 | 79 | ||
| 80 | local description = nil | ||
| 81 | |||
| 82 | if meta.description then | ||
| 83 | description = pandoc.Para(meta.description) | ||
| 84 | elseif not meta.no_description then | ||
| 85 | description = meta.content:filter(function (el) | ||
| 86 | return el.tag ~= "Str" or el.text ~= "ΒΆ" | ||
| 87 | end) | ||
| 88 | end | ||
| 89 | |||
| 80 | return { | 90 | return { |
| 81 | title = meta.title, | 91 | title = meta.title, |
| 82 | description = (meta.description and pandoc.MetaBlocks(pandoc.Para(meta.description))) or | 92 | description = pandoc.MetaBlocks(description), |
| 83 | (not meta.no_description and meta.content), | ||
| 84 | last_update = meta.last_update, | 93 | last_update = meta.last_update, |
| 85 | schema_type = meta.schema_type, | 94 | schema_type = meta.schema_type, |
| 86 | url = meta.url, | 95 | url = meta.url, |
