refactor: remove log parsing and activity display from templates

This commit is contained in:
doum1004
2026-04-30 23:45:20 -04:00
parent 5fad286ec1
commit 0331792725

View File

@@ -229,19 +229,6 @@ function extractFrontmatterField(content, field) {
return line.slice(field.length + 1).trim().replace(/^['"]|['"]$/g, "") || null;
}
function parseLogEntries(wikiDir) {
const logPath = path.join(wikiDir, "log.md");
if (!fs.existsSync(logPath)) return [];
const content = fs.readFileSync(logPath, "utf-8");
const entries = [];
const re = /##\\s+\\[([^\\]]+)\\]\\s+([^|]+)\\|\\s*(.+)/g;
let match;
while ((match = re.exec(content)) !== null) {
entries.push({ time: match[1].trim(), type: match[2].trim(), message: match[3].trim() });
}
return entries;
}
const wikiPrefix = WIKI_DIR.replace(/\\\\/g, "/").replace(/\\/$/, "") + "/";
function resolveLink(target, allFiles) {
@@ -293,13 +280,12 @@ for (const file of files) {
}
}
const activity = parseLogEntries(WIKI_DIR);
fs.mkdirSync(OUT_DIR, { recursive: true });
fs.writeFileSync(
path.join(OUT_DIR, "graph.json"),
JSON.stringify({ nodes, edges, activity }, null, 2)
JSON.stringify({ nodes, edges }, null, 2)
);
console.log("Graph: " + nodes.length + " nodes, " + edges.length + " edges, " + activity.length + " log entries → dist/graph.json");
console.log("Graph: " + nodes.length + " nodes, " + edges.length + " edges → dist/graph.json");
`;
}
@@ -650,10 +636,6 @@ const html = \`<!DOCTYPE html>
opacity: 0.65;
font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}
.viz-activity { font-size: 0.74rem; line-height: 1.45; margin-bottom: 0.5rem; }
.viz-activity-item { padding: 0.2rem 0; border-bottom: 1px dashed rgba(92,61,46,0.15); }
.viz-activity-item .act-type { font-weight: 600; color: var(--wood); text-transform: uppercase; font-size: 0.68rem; letter-spacing: 0.04em; }
.viz-activity-item .act-time { opacity: 0.6; font-size: 0.68rem; }
</style>
</head>
<body class="viz-root">
@@ -681,8 +663,6 @@ const html = \`<!DOCTYPE html>
<div class="viz-legend-row"><span class="swatch" style="background:#ff9800"></span><span><strong>Sources</strong> — readings &amp; inputs</span></div>
<div class="viz-legend-row"><span class="swatch" style="background:#ab47bc"></span><span><strong>Synthesis</strong> — cross-cutting views</span></div>
<div class="viz-legend-row"><span class="swatch" style="background:#888"></span><span><strong>Other</strong> — index, log, templates…</span></div>
<h2>Recent Activity</h2>
<div id="activityFeed" class="viz-activity"></div>
<p class="viz-hint">Tip: click a node in the graph to open the full page in the reader column and spotlight its neighborhood. On small screens the reader stacks below the graph. Rebuild graph + site after edits. Click the same node again to clear.</p>
</aside>
<div class="viz-canvas-wrap" aria-label="Graph canvas">
@@ -1013,19 +993,6 @@ const html = \`<!DOCTYPE html>
});
applyFocusOpacity();
const feed = document.getElementById("activityFeed");
if (feed && data.activity && data.activity.length) {
const recent = [...data.activity].reverse().slice(0, 8);
feed.innerHTML = DOMPurify.sanitize(
recent.map((a) =>
'<div class="viz-activity-item">' +
'<span class="act-type">' + a.type + '</span> ' + a.message +
'<br><span class="act-time">' + a.time + '</span></div>'
).join(""),
{ USE_PROFILES: { html: true } }
);
}
</script>
</body>
</html>\`;