Add events to a folder

This commit is contained in:
Jared He 2021-06-13 12:52:06 -05:00
parent c4a0e60760
commit 9dab10895e
3 changed files with 2 additions and 4 deletions

View File

@ -50,6 +50,7 @@ const parseXML = (XML) => {
let short = useShowdown( let short = useShowdown(
xmlJs.js2xml(js.elements[0].elements[i].elements[0]) xmlJs.js2xml(js.elements[0].elements[i].elements[0])
); );
// remove trailing newlines from short
short = short.replace(/\n+$/, ""); short = short.replace(/\n+$/, "");
const dateStr = js.elements[0].elements[i].attributes.date; const dateStr = js.elements[0].elements[i].attributes.date;
const timeStr = js.elements[0].elements[i].attributes.time; const timeStr = js.elements[0].elements[i].attributes.time;
@ -59,7 +60,6 @@ const parseXML = (XML) => {
const abstract = useShowdown( const abstract = useShowdown(
xmlJs.js2xml(js.elements[0].elements[i].elements[1]) xmlJs.js2xml(js.elements[0].elements[i].elements[1])
); );
let registerLink = ""; let registerLink = "";
// detects a link in markdown // detects a link in markdown
const markdownLinkDetectRegex = /(?<=\[(.*)\]\(<)(.*)(?=>\))/; const markdownLinkDetectRegex = /(?<=\[(.*)\]\(<)(.*)(?=>\))/;
@ -69,12 +69,10 @@ const parseXML = (XML) => {
registerLink = "no link"; registerLink = "no link";
} }
console.log(registerLink);
const mdx = `export const metadata = {\n name: "${title}",\n short: "${short}",\n date: "${date}",\n online: ${online},\n location: "${location}",\n registerLink: "${registerLink}"\n}\n\n${abstract}`; const mdx = `export const metadata = {\n name: "${title}",\n short: "${short}",\n date: "${date}",\n online: ${online},\n location: "${location}",\n registerLink: "${registerLink}"\n}\n\n${abstract}`;
const mdxTitle = title.replace(/(\s+|:+)/g, "-"); const mdxTitle = title.replace(/(\s+|:+)/g, "-");
fs.writeFile(`${mdxTitle}.mdx`, mdx, function (err) { fs.writeFile(`./markdown-events/${mdxTitle}.mdx`, mdx, function (err) {
if (err) return console.log(err); if (err) return console.log(err);
}); });
} }