Support flat event file
This commit is contained in:
rodič
3552be676e
revize
d3158e0d52
|
@ -46,11 +46,13 @@ difficulty = "All Welcome"
|
|||
# pick 1-4
|
||||
tags = ["Solarpunk"]
|
||||
|
||||
union = "gm-events"
|
||||
|
||||
# a color, to group key events visually. use sparingly
|
||||
# color=""
|
||||
|
||||
# A small logomark for the corner of the event
|
||||
logomark = "/logomarks/coinfeedslm.png"
|
||||
logomark = "./logo.png"
|
||||
|
||||
# a description of the event.
|
||||
# will show up when the user clicks the event card.
|
|
@ -85,8 +85,9 @@ class DeConf_Package {
|
|||
// load sub-events
|
||||
pkg.events = [];
|
||||
for await (const ef of Deno.readDir([...specDir, "events"].join("/"))) {
|
||||
if (!ef.name.match(/^[\w\d\-]+$/)) continue;
|
||||
const ev = new DeConf_Event(ef.name);
|
||||
const m = ef.name.match(/^([\w\d\-]+)(\.toml|)$/)
|
||||
if (!m) continue;
|
||||
const ev = new DeConf_Event(m[1]);
|
||||
await ev.load([...specDir, "events", ef.name]);
|
||||
pkg.events.push(ev);
|
||||
}
|
||||
|
@ -112,15 +113,24 @@ class DeConf_Event {
|
|||
this.dir = null;
|
||||
}
|
||||
|
||||
async load(dir) {
|
||||
this.dir = dir.join("/");
|
||||
const efIndex = await _tomlLoad([...dir, "index.toml"].join("/"));
|
||||
async load(path) {
|
||||
let fn;
|
||||
if (path[path.length-1].match(/^(.+)\.toml$/)) {
|
||||
fn = path
|
||||
} else {
|
||||
this.dir = path.join("/");
|
||||
fn = [...path, "index.toml"]
|
||||
}
|
||||
|
||||
const efIndex = await _tomlLoad(fn.join("/"));
|
||||
const data = {
|
||||
index: { id: this.id, ...efIndex },
|
||||
};
|
||||
const syncDataFn = [...dir, "data.json"].join("/");
|
||||
if (await exists(syncDataFn)) {
|
||||
data.sync = await _jsonLoad(syncDataFn);
|
||||
if (this.dir) {
|
||||
const syncDataFn = [...this.dir, "data.json"].join("/");
|
||||
if (await exists(syncDataFn)) {
|
||||
data.sync = await _jsonLoad(syncDataFn);
|
||||
}
|
||||
}
|
||||
this.data = data;
|
||||
}
|
||||
|
|
|
@ -92,6 +92,9 @@ properties:
|
|||
type: array
|
||||
items:
|
||||
type: string
|
||||
union:
|
||||
type: string
|
||||
pattern: "^[a-z0-9-]+$"
|
||||
logomark:
|
||||
type: string
|
||||
description:
|
||||
|
|
Načítá se…
Odkázat v novém úkolu