From 86440c96355fbbd18efd436a78afe25fda43432b Mon Sep 17 00:00:00 2001 From: Jared He Date: Tue, 17 Aug 2021 16:42:37 -0400 Subject: [PATCH] Various fixes --- events.xml | 4 ++-- scripts/mdx-scripts/event-conversion.js | 19 +++++++------------ scripts/mdx-scripts/example.event.mdx | 21 --------------------- scripts/mdx-scripts/example.news.mdx | 14 -------------- scripts/mdx-scripts/news-conversion.js | 6 +++--- 5 files changed, 12 insertions(+), 52 deletions(-) delete mode 100644 scripts/mdx-scripts/example.event.mdx delete mode 100644 scripts/mdx-scripts/example.news.mdx diff --git a/events.xml b/events.xml index b3b3483..6a20c9b 100644 --- a/events.xml +++ b/events.xml @@ -9877,14 +9877,14 @@ Remember: Monday, January 13, 6:00 PM, MC3001/Comfy Lounge.

The teeth of Free Software -
+
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software---to make sure the software is free for all its users.
-
--- Excerpt from the GNU GPL
+
--- Excerpt from the GNU GPL

The GNU General Public License is one of the most influential diff --git a/scripts/mdx-scripts/event-conversion.js b/scripts/mdx-scripts/event-conversion.js index 343f1bb..7df3456 100644 --- a/scripts/mdx-scripts/event-conversion.js +++ b/scripts/mdx-scripts/event-conversion.js @@ -59,15 +59,12 @@ const parseXML = (XML) => { const xmlDoc = libxmljs.parseHtml(XML); let eventdefsChildren = xmlDoc.get("//eventdefs").childNodes(); eventdefsChildren.forEach((eventItem) => { - ``; if (eventItem.type() === "element") { const title = eventItem.attr("title").value(); const shortNodes = eventItem.get(".//short").childNodes(); let short = converterShowdown.makeMarkdown( nodeChildrenToString(shortNodes) ); - // remove newlines from short - short = short.replace(/\n/g, ""); const dateStr = eventItem.attr("date").value(); const timeStr = eventItem.attr("time").value(); const date = parseTime(dateStr, timeStr); @@ -80,21 +77,19 @@ const parseXML = (XML) => { abstract = converterShowdown.makeMarkdown( nodeChildrenToString(abstractNodes) ); - abstract = abstract.replace(/
/g, "\n"); } const md = `--- -name: "${title.replace(/"/g, '\\"')}" -short: "${short.replace(/"/g, '\\"')}" -date: "${date.toString().replace(/"/g, '\\"')}" +name: '${title.replace(/'/g, "''")}' +short: '${short.replace(/\n/g, "").replace(/'/g, "''")}' +date: '${date.toString().replace(/'/g, "''")}' online: ${online} -location: "${location.replace(/"/g, '\\"')}" +location: '${location.replace(/'/g, "''")}' --- -${abstract}`; +${abstract.replace(/
/g, "\n")}`; // remove invalid characters from filenames - let mdTitle = title.replace(/[\\\\/:*?\"<>|]/g, ""); - mdTitle = mdTitle.replace(/(\s+)/g, "-"); + let mdTitle = title.replace(/[\\\\/:*?\"<>|]/g, "").replace(/(\s+)/g, "-"); fs.mkdirSync( `./markdown-events/${currentTerm.year}/${currentTerm.term}`, { recursive: true }, @@ -103,7 +98,7 @@ ${abstract}`; } ); fs.writeFileSync( - `./markdown-events/${currentTerm.year}/${currentTerm.term}/${mdTitle}.event.md`, + `./markdown-events/${currentTerm.year}/${currentTerm.term}/${mdTitle}.md`, md, (err) => { if (err) { diff --git a/scripts/mdx-scripts/example.event.mdx b/scripts/mdx-scripts/example.event.mdx deleted file mode 100644 index 7d227d6..0000000 --- a/scripts/mdx-scripts/example.event.mdx +++ /dev/null @@ -1,21 +0,0 @@ -export const metadata = { - name: "Afterhours: Personal Relationships", - short: "Learn how React works and make your own version!", - date: new Date("2021-03-02 2:00 PM"), - online: false, - location: "MC", - registerLink: "http://csclub.uwaterloo.ca/", -}; - -The past year has been tough for all of us, having to deal with the pandemic -while studying or working remotely. If you've felt that meeting new people and -sustaining relationships with others has never been more challenging, we feel -that too, and we want to talk about it. - -CSC brings you the third chapter of Afterhours, and this time we're discussing -Personal Relationships. Join us for a chat about how our relationships -(platonic and romantic) have been affected, whether that be due to co-op, -sequence changes, or COVID. We'll be sharing our own personal stories and we'd -love for you all to join in on the discussion. - -Registration is required for attendance, so don't miss out! diff --git a/scripts/mdx-scripts/example.news.mdx b/scripts/mdx-scripts/example.news.mdx deleted file mode 100644 index 74919ef..0000000 --- a/scripts/mdx-scripts/example.news.mdx +++ /dev/null @@ -1,14 +0,0 @@ -export const metadata = { - author: "merenber", - date: new Date("2021-03-19"), -} - -Computer Science Club systems and services will be unavailable on Saturday, Mar. 20 -due to a planned power outage in the Mathematics and Computer Building (MC) from 7am to 5pm. - -The CSC will begin shutting down machines at 6am in preparation of the outage. -Please prepare for the outage by: - -- Ensuring all running processes have their state saved (configuration, data, etc.) -- Any important files are backed up off-site from the CSC -- If you have any questions/concerns, please email the Systems Committee. \ No newline at end of file diff --git a/scripts/mdx-scripts/news-conversion.js b/scripts/mdx-scripts/news-conversion.js index f35b293..e36f747 100644 --- a/scripts/mdx-scripts/news-conversion.js +++ b/scripts/mdx-scripts/news-conversion.js @@ -48,8 +48,8 @@ const parseXML = (XML) => { ); const md = `--- -author: "${author.replace(/"/g, '\\"')}" -date: "${date.replace(/"/g, '\\"')}" +author: '${author.replace(/'/g, "''")}' +date: '${date.replace(/'/g, "''")}' --- ${content}`; @@ -62,7 +62,7 @@ ${content}`; } ); fs.writeFileSync( - `./markdown-news/${currentTerm.year}/${currentTerm.term}/${mdTitle}.news.md`, + `./markdown-news/${currentTerm.year}/${currentTerm.term}/${mdTitle}.md`, md, (err) => { if (err) throw err;