Various fixes

mdx-conversion
Jared He 1 year ago
parent ad00cb8115
commit 86440c9635
  1. 4
      events.xml
  2. 19
      scripts/mdx-scripts/event-conversion.js
  3. 21
      scripts/mdx-scripts/example.event.mdx
  4. 14
      scripts/mdx-scripts/example.news.mdx
  5. 6
      scripts/mdx-scripts/news-conversion.js

@ -9877,14 +9877,14 @@ Remember: Monday, January 13, 6:00 PM, MC3001/Comfy Lounge.</p>
<short>The teeth of Free Software</short>
<abstract>
<div style="font-style: italic"><blockquote>
<div><blockquote>
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.
<br />
<div style="text-align:right">--- Excerpt from the GNU GPL</div>
<div>--- Excerpt from the GNU GPL</div>
</blockquote></div>
<p> The GNU General Public License is one of the most influential

@ -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(/<br>/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(/<br>/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) {

@ -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!

@ -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.

@ -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;

Loading…
Cancel
Save