feat: scaffold webinar-dash plugin with config block

This commit is contained in:
meels
2026-07-28 13:01:52 +02:00
parent b75730fda3
commit af247326b3
3 changed files with 63 additions and 0 deletions

48
.obsidian/plugins/webinar-dash/main.js vendored Normal file
View File

@@ -0,0 +1,48 @@
"use strict";
// Obsidian injects its own module resolver. Under plain `node --test` it is
// absent, so guard the require and fall back to an empty base class. This is
// what keeps the pure helpers below unit-testable without an Obsidian runtime.
let OB = null;
try {
OB = require("obsidian");
} catch (_) {
OB = null;
}
const PluginBase = OB ? OB.Plugin : class {};
const STATIONS = ["Chat box", "ReAct", "Tools", "Memory", "Skills", "Process", "OS"];
const DEFAULTS = {
script: "raw/sources/Webinar script.md",
coverage: "wiki/script-coverage.md",
rawDir: "raw/sources",
wikiSourceDir: "wiki/sources",
conceptDir: "wiki/concepts",
};
function parseConfig(source) {
const cfg = Object.assign({}, DEFAULTS);
for (const line of String(source).split(/\r?\n/)) {
const m = line.match(/^\s*([A-Za-z][A-Za-z0-9_]*)\s*:\s*(.+?)\s*$/);
if (m && Object.prototype.hasOwnProperty.call(DEFAULTS, m[1])) {
cfg[m[1]] = m[2];
}
}
return cfg;
}
class WebinarDashPlugin extends PluginBase {
async onload() {
this.registerMarkdownCodeBlockProcessor("webinar-dash", (source, el, ctx) => {
const cfg = parseConfig(source);
const root = el.createDiv({ cls: "webinar-dash" });
root.createDiv({ cls: "wd-eyebrow", text: "Webinar dashboard" });
root.createEl("p", { text: `Reading coverage from ${cfg.coverage}` });
});
}
}
module.exports = WebinarDashPlugin;
module.exports.default = WebinarDashPlugin;
module.exports.__test__ = { parseConfig, STATIONS, DEFAULTS };

View File

@@ -0,0 +1,9 @@
{
"id": "webinar-dash",
"name": "Webinar dashboard",
"version": "0.1.0",
"minAppVersion": "1.5.0",
"description": "Source pipeline and script coverage for the webinar vault.",
"author": "meels",
"isDesktopOnly": true
}