diff options
author | Volpeon <git@volpeon.ink> | 2022-08-05 07:45:30 +0200 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2022-08-05 07:45:30 +0200 |
commit | bf36287607cbe7d5d3e393943b0b79e3d2c4b113 (patch) | |
tree | 711d9c8108b2f4de6bf8c414e90a885cfdd64a1b /scripts | |
parent | Prune parents and subpages (diff) | |
download | volpeon.ink-bf36287607cbe7d5d3e393943b0b79e3d2c4b113.tar.gz volpeon.ink-bf36287607cbe7d5d3e393943b0b79e3d2c4b113.tar.bz2 volpeon.ink-bf36287607cbe7d5d3e393943b0b79e3d2c4b113.zip |
Stricter pruning, don't pre-calculate description field
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/metadata.lua | 2 | ||||
-rw-r--r-- | scripts/page.lua | 22 |
2 files changed, 11 insertions, 13 deletions
diff --git a/scripts/metadata.lua b/scripts/metadata.lua index 5d372fc..d0a4f45 100644 --- a/scripts/metadata.lua +++ b/scripts/metadata.lua | |||
@@ -145,8 +145,6 @@ function process_base(build, meta) | |||
145 | meta.thumbnail = meta.thumbnail and make_absolute("thumbnail." .. utils.stringify(meta.thumbnail), meta.file_out) | 145 | meta.thumbnail = meta.thumbnail and make_absolute("thumbnail." .. utils.stringify(meta.thumbnail), meta.file_out) |
146 | meta.layout = prep_layout(meta.layout or (meta.redirect and "redirect") or resolve_layout(meta.depth)) | 146 | meta.layout = prep_layout(meta.layout or (meta.redirect and "redirect") or resolve_layout(meta.depth)) |
147 | 147 | ||
148 | meta.description = (meta.description and pandoc.MetaBlocks(pandoc.Para(meta.description))) or | ||
149 | (not meta.no_description and meta.content) | ||
150 | meta.show_date = meta.parent and meta.parent.list_order == "date_desc" | 148 | meta.show_date = meta.parent and meta.parent.list_order == "date_desc" |
151 | meta.category = meta.parent and meta.parent.title | 149 | meta.category = meta.parent and meta.parent.title |
152 | meta.icon = meta.icon or (meta.parent and meta.parent.icon) | 150 | meta.icon = meta.icon or (meta.parent and meta.parent.icon) |
diff --git a/scripts/page.lua b/scripts/page.lua index 4eeebb2..f3802a2 100644 --- a/scripts/page.lua +++ b/scripts/page.lua | |||
@@ -79,7 +79,8 @@ function cat_to_list_cat(meta, allItems) | |||
79 | 79 | ||
80 | return { | 80 | return { |
81 | title = meta.title, | 81 | title = meta.title, |
82 | description = meta.description, | 82 | description = (meta.description and pandoc.MetaBlocks(pandoc.Para(meta.description))) or |
83 | (not meta.no_description and meta.content), | ||
83 | last_update = meta.last_update, | 84 | last_update = meta.last_update, |
84 | schema_type = meta.schema_type, | 85 | schema_type = meta.schema_type, |
85 | url = meta.url, | 86 | url = meta.url, |
@@ -191,23 +192,22 @@ function process(global, build, meta, dir) | |||
191 | end | 192 | end |
192 | end | 193 | end |
193 | 194 | ||
194 | function prune_pages(meta, n) | 195 | function prune_pages(meta, up, down) |
195 | if n == 0 then | 196 | meta.pages.random = pandoc.List() |
196 | meta.pages = { | 197 | meta.pages.by_id = {} |
197 | all = pandoc.List(), | 198 | |
198 | date_desc = pandoc.List(), | 199 | if down == 0 then |
199 | random = pandoc.List(), | 200 | meta.pages.all = pandoc.List() |
200 | by_id = {} | 201 | meta.pages.date_desc = pandoc.List() |
201 | } | ||
202 | else | 202 | else |
203 | for _, p in pairs(meta.pages.by_id) do | 203 | for _, p in pairs(meta.pages.by_id) do |
204 | prune_pages(p, n - 1) | 204 | prune(p, up, down - 1) |
205 | end | 205 | end |
206 | end | 206 | end |
207 | end | 207 | end |
208 | 208 | ||
209 | function prune(meta, up, down) | 209 | function prune(meta, up, down) |
210 | prune_pages(meta, down) | 210 | prune_pages(meta, up, down) |
211 | 211 | ||
212 | if up == 0 then | 212 | if up == 0 then |
213 | meta.parent = nil | 213 | meta.parent = nil |