This repository has been archived by the owner on Jan 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
parse-to-mm.js
50 lines (37 loc) · 1.56 KB
/
parse-to-mm.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Parse to Meeting Minutes program
let fetch = require('node-fetch');
const DATE = 'September 21'; // Update this before running (Will be fixed later)
function getVisibleTalks() {
return fetch('http://talks.cosi.clarkson.edu/api/talks/visible')
.then(res => {
return res.json();
});
}
function generateMeetingMinutes(talks) {
let forumTopics = talks.filter(talk => talk.type == 'forum topic');
let lightningTalks = talks.filter(talk => talk.type == 'lightning talk');
let projectUpdates = talks.filter(talk => talk.type == 'project update');
let announcements = talks.filter(talk => talk.type == 'announcement');
let afterMeetingSlot = talks.filter(talk => talk.type == 'after meeting slot');
let outputMarkdown = "";
outputMarkdown += `---\nlayout: post\ntitle: "Meeting Minutes: ${DATE}"\ncategories: minutes\n---\n\n`;
outputMarkdown += genCategory(forumTopics, 'Forum Topics');
outputMarkdown += genCategory(lightningTalks, 'Lightning Talk');
outputMarkdown += genCategory(projectUpdates, 'Project Updates');
outputMarkdown += genCategory(announcements, 'Announcements');
outputMarkdown += genCategory(afterMeetingSlot, 'After Meeting Slot');
return outputMarkdown;
}
function genCategory(talksList, title) {
let result = "";
result += `# ${title}\n\n`;
for (let topic of talksList) {
result += `## ${topic.desc}\n\n`;
}
return result;
}
getVisibleTalks().then(talks => {
return generateMeetingMinutes(talks);
}).then(markdown => {
console.log(markdown);
});