diff options
author | Volpeon <git@volpeon.ink> | 2022-08-04 21:48:03 +0200 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2022-08-04 21:48:03 +0200 |
commit | 04df8a3e57789af37d9455aac174bdcec8513553 (patch) | |
tree | b66fffd77f1325e150787032354c4a444d36a190 /scripts | |
parent | Improved metadata processing (diff) | |
download | volpeon.ink-04df8a3e57789af37d9455aac174bdcec8513553.tar.gz volpeon.ink-04df8a3e57789af37d9455aac174bdcec8513553.tar.bz2 volpeon.ink-04df8a3e57789af37d9455aac174bdcec8513553.zip |
Don't generate randomized pages list
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/metadata.lua | 4 | ||||
-rw-r--r-- | scripts/page.lua | 20 |
2 files changed, 11 insertions, 13 deletions
diff --git a/scripts/metadata.lua b/scripts/metadata.lua index 5d372fc..42bf71c 100644 --- a/scripts/metadata.lua +++ b/scripts/metadata.lua | |||
@@ -84,12 +84,12 @@ function process_pages(meta) | |||
84 | 84 | ||
85 | pages_all:sort(sort.page_sort(meta.list_order, meta.pages)) | 85 | pages_all:sort(sort.page_sort(meta.list_order, meta.pages)) |
86 | pages_date_desc:sort(sort.page_sort("date_desc", meta.pages)) | 86 | pages_date_desc:sort(sort.page_sort("date_desc", meta.pages)) |
87 | local pages_random = pages_all:clone():shuffle() | 87 | --local pages_random = pages_all:clone():shuffle() |
88 | 88 | ||
89 | meta.pages = { | 89 | meta.pages = { |
90 | all = pages_all, | 90 | all = pages_all, |
91 | date_desc = pages_date_desc, | 91 | date_desc = pages_date_desc, |
92 | random = pages_random, | 92 | --random = pages_random, |
93 | by_id = meta.pages | 93 | by_id = meta.pages |
94 | } | 94 | } |
95 | end | 95 | end |
diff --git a/scripts/page.lua b/scripts/page.lua index fd12230..1ce060e 100644 --- a/scripts/page.lua +++ b/scripts/page.lua | |||
@@ -4,12 +4,8 @@ local common = require 'scripts.lib.common' | |||
4 | local sort = require 'scripts.lib.sort' | 4 | local sort = require 'scripts.lib.sort' |
5 | 5 | ||
6 | function resolve_url(site_url, ref_file, target_file) | 6 | function resolve_url(site_url, ref_file, target_file) |
7 | site_url = utils.stringify(site_url) | ||
8 | ref_file = utils.stringify(ref_file) | ||
9 | target_file = utils.stringify(target_file):gsub("/index%.html$", "/") | ||
10 | |||
11 | local ref_base_dir = path.directory(ref_file) | 7 | local ref_base_dir = path.directory(ref_file) |
12 | local abs = target_file | 8 | local abs = target_file:gsub("/index%.html$", "/") |
13 | local rel = path.make_relative(abs, ref_base_dir, true) | 9 | local rel = path.make_relative(abs, ref_base_dir, true) |
14 | local full = (abs:sub(1, 1) == "/" and (site_url .. abs)) or abs | 10 | local full = (abs:sub(1, 1) == "/" and (site_url .. abs)) or abs |
15 | 11 | ||
@@ -142,7 +138,7 @@ end | |||
142 | function process_pages(meta) | 138 | function process_pages(meta) |
143 | meta.pages.all = meta.pages.all:filterMap(deref_page(meta.pages.by_id)) | 139 | meta.pages.all = meta.pages.all:filterMap(deref_page(meta.pages.by_id)) |
144 | meta.pages.date_desc = meta.pages.date_desc:filterMap(deref_page(meta.pages.by_id)) | 140 | meta.pages.date_desc = meta.pages.date_desc:filterMap(deref_page(meta.pages.by_id)) |
145 | -- meta.pages.random = meta.pages.random:filterMap(deref_page(meta.pages.by_id)) | 141 | --meta.pages.random = meta.pages.random:filterMap(deref_page(meta.pages.by_id)) |
146 | end | 142 | end |
147 | 143 | ||
148 | function resolve_urls(global, build, meta) | 144 | function resolve_urls(global, build, meta) |
@@ -190,11 +186,9 @@ function process(global, build, meta, dir) | |||
190 | 186 | ||
191 | process_pages(meta) | 187 | process_pages(meta) |
192 | 188 | ||
193 | meta.list = generate_list(meta) | 189 | if dir <= 0 and meta.parent then |
194 | 190 | process(global, build, meta.parent, -1) | |
195 | -- if dir <= 0 and meta.parent then | 191 | end |
196 | -- process(global, build, meta.parent, -1) | ||
197 | -- end | ||
198 | end | 192 | end |
199 | 193 | ||
200 | function Meta(meta) | 194 | function Meta(meta) |
@@ -215,6 +209,8 @@ function Meta(meta) | |||
215 | menus = meta.menus | 209 | menus = meta.menus |
216 | } | 210 | } |
217 | 211 | ||
212 | global.site.url = utils.stringify(global.site.url) | ||
213 | |||
218 | meta = meta.tree | 214 | meta = meta.tree |
219 | 215 | ||
220 | local parts = utils.stringify(build.namespace):split('/'):skip(1) | 216 | local parts = utils.stringify(build.namespace):split('/'):skip(1) |
@@ -228,6 +224,8 @@ function Meta(meta) | |||
228 | 224 | ||
229 | process(global, build, meta, 0) | 225 | process(global, build, meta, 0) |
230 | 226 | ||
227 | meta.list = generate_list(meta) | ||
228 | |||
231 | if global.menus and global.menus.main then | 229 | if global.menus and global.menus.main then |
232 | global.menus.main = prep_menu(meta.namespace.full, global.menus.main) | 230 | global.menus.main = prep_menu(meta.namespace.full, global.menus.main) |
233 | end | 231 | end |