import { Marked } from "https://deno.land/x/markdown/mod.ts"
import * as yaml from "https://deno.land/x/js_yaml_port/js-yaml.js"
// the structure of policies/list.yml
interface policyList {
[file: string]: {
name: string;
description: string;
aliases?: string[];
};
}
const decoder = new TextDecoder("utf-8");
const encoder = new TextEncoder();
const policyFile = "policies/list.yml";
const rawPolicies = decoder.decode(await Deno.readFile(policyFile));
const policies: policyList = yaml.load(rawPolicies);
const index = {
prefix: `
The Mana World Policies
\n\n"
};
// the _redirects file used by netlify
let redirects = "";
console.info(">> Building the static site...");
// empty the build directory
await Deno.remove("build", { recursive: true });
// loop through every policy markdown file
for (const [file, props] of Object.entries(policies)) {
if (file.startsWith(".")) {
console.log(`Ignoring disabled policy file: ${file}.md`);
continue;
}
// add to the index page
index.list += `