blob: 12b693a30221692eec93eb6d93773d8b4a6da23e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
env = {}
current_entry = {}
function append_entry(entry)
if entry['series_url'] then
if build_dir .. entry['series_url'] == target_file then
if not entry['series_prev_url'] then
current_entry = entry['url']
end
env[entry['url']] = entry
end
end
end
if site_index and site_index[1] then
index = HTML.select_one(page, config['index_selector'])
if index then
Table.iter_values_ordered(append_entry, site_index)
res = {}
res['entries'] = {}
res_count = 1
while current_entry do
res['entries'][res_count] = env[current_entry]
res_count = res_count + 1
current_entry = env[current_entry]['series_next_url']
end
template = Sys.read_file(config["index_template_file"])
rendered_entries = HTML.parse(String.render_template(template, res))
HTML.replace_content(index, rendered_entries)
end
end
|