- Install deno
- Download source code
- Prepare the .html file of e-bridge timetable and rename it to
XJTLU e-Bridge.html
deno test -A tests.ts
- Check
test.ics
in the folder
or
- Install deno
- Download the source code
deno run -A cli.ts
Tip: control + C
to force quit cli
import { DOMParser, genCalendar, parseTimetable } from "https://deno.land/x/[email protected]/mod.ts";
const document = new DOMParser().parseFromString(
Deno.readTextFileSync('XJTLU e-Bridge.html').toString(),
'text/html'
)!;
const lessons = parseTimetable(document);
console.table(lessons);
const calendar = genCalendar(lessons);
console.log(calendar.toLines());
Deno.writeTextFileSync('test.ics', calendar.toString());