Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanThatOneKid committed Feb 20, 2024
1 parent 7d858ed commit 2f99cd0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/links/links.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// TODO: Parse links from JSON file.
// TODO: Add `test` helper function to check if a URL or URL map is valid.
//
29 changes: 29 additions & 0 deletions lib/workshops/workshops.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { extract, test } from "#/deps.ts";

export interface WorkshopAttrs {
title?: string;
description?: string;
participants?: string[];
labels?: string[];
resources?: string[];
}

export interface Workshop {
id: string;
md: string;
attrs?: WorkshopAttrs;
}

export function parseWorkshop(filename: string, md: string): Workshop {
const id = filename.replace(/\.md$/, "");
if (!test(md)) {
return { id, md };
}

const extracted = extract<WorkshopAttrs>(md);
return {
id,
md: extracted.body,
attrs: extracted.attrs,
};
}

0 comments on commit 2f99cd0

Please sign in to comment.