Convert event.xml and news.xml data to MDX #4

Open
j285he wants to merge 44 commits from mdx-conversion into master
2 changed files with 24 additions and 7 deletions
Showing only changes of commit 3b6f57edaa - Show all commits

View File

@ -10,18 +10,35 @@ const parseXML = (XML) => {
const shortRegex = /(?<=<short>)(.|\n)*?(?=<\/short>)/g;
const abstractRegex = /(?<=<abstract>)(.|\n)*?(?=<\/abstract>)/g;
const dateRegex = /(?<=<eventitem(.*)date=")(.|\n)*?(?="(.*)>)/g;
const timeRegex = /(?<=<eventitem(.*)time=")(.|\n)*?(?="(.*)>)/g;
const roomRegex = /(?<=<eventitem(.*)room=")(.|\n)*?(?="(.*)>)/g;
const titleRegex = /(?<=<eventitem(.*)title=")(.|\n)*?(?="(.*)>)/g;
let eventItems = [];
// Find how many eventItems there are here
while ((eventItems = eventItemRegex.exec(XML)) !== null) {
shortRegex.lastIndex = 0
abstractRegex.lastIndex = 0
dateRegex.lastIndex = 0;
timeRegex.lastIndex = 0;
roomRegex.lastIndex = 0;
titleRegex.lastIndex = 0;
shortRegex.lastIndex = 0;
abstractRegex.lastIndex = 0;
const eventItem = eventItems[0];
console.log(eventItem);
let dateStr = dateRegex.exec(eventItem);
let timeStr = timeRegex.exec(eventItem);
date = new Date(dateStr[0] + " " + timeStr[0]);
let room = roomRegex.exec(eventItem);
let title = titleRegex.exec(eventItem);
let short = shortRegex.exec(eventItem);
console.log(converter.makeMarkdown(short[0]));
let abstract = abstractRegex.exec(eventItem);
console.log(eventItem);
console.log(date);
console.log(room[0]);
console.log(title[0]);
console.log(converter.makeMarkdown(short[0]));
console.log(converter.makeMarkdown(abstract[0]));
}
};

View File

@ -1,4 +1,4 @@
<eventitem date="2021-05-24" time="7 PM" room="Online" title="CSC x SE Soc: Interview Prep">
<eventitem date="2021-05-24" time="07:00 PM" room="Online" title="CSC x SE Soc: Interview Prep">
<short>
<p>CSC and SE Soc are hosting an Interview Prep Workshop next week! Join Kristy Gao and Bimesh De Silva as they review the interview process, from behavioural to technical interviews. They'll finish off with live mock interviews, and the event will be held on Twitch (https://www.twitch.tv/uwcsclub).</p>
</short>