Browse Source

Do not use index: as metadata for OrganizedContent (#468)

@merenber recently merged this #462

It is a little annoying that we have to manually change the index in literally all the other unrelated files.

This PR introduces an ORDER.json file that orders the sections as an array.

Reviewed-on: #468
Reviewed-by: Shahan Neda <snedadah@csclub.uwaterloo.ca>
Reviewed-by: Amy <a258wang@csclub.uwaterloo.ca>
pull/470/head
Aditya Thakral 2 months ago
parent
commit
44af493832
  1. 14
      content/about/code-of-conduct/ORDER.json
  2. 1
      content/about/code-of-conduct/additional-information.md
  3. 1
      content/about/code-of-conduct/addressing-grievances.md
  4. 1
      content/about/code-of-conduct/confidentiality.md
  5. 1
      content/about/code-of-conduct/consequences-of-inappropriate-behaviour.md
  6. 1
      content/about/code-of-conduct/contact-information.md
  7. 1
      content/about/code-of-conduct/expected-behaviour.md
  8. 1
      content/about/code-of-conduct/experiencing-unacceptable-behaviour.md
  9. 1
      content/about/code-of-conduct/license-information-and-attribution.md
  10. 1
      content/about/code-of-conduct/purpose.md
  11. 1
      content/about/code-of-conduct/revision.md
  12. 1
      content/about/code-of-conduct/scope-and-spaces.md
  13. 1
      content/about/code-of-conduct/unacceptable-behaviour.md
  14. 16
      content/about/constitution/ORDER.json
  15. 1
      content/about/constitution/amendments-and-procedures.md
  16. 1
      content/about/constitution/code-of-conduct.md
  17. 1
      content/about/constitution/committees.md
  18. 1
      content/about/constitution/dissolution.md
  19. 1
      content/about/constitution/duties-of-officers.md
  20. 1
      content/about/constitution/executive-council.md
  21. 1
      content/about/constitution/finances.md
  22. 1
      content/about/constitution/meetings.md
  23. 1
      content/about/constitution/membership.md
  24. 1
      content/about/constitution/name.md
  25. 1
      content/about/constitution/officers.md
  26. 1
      content/about/constitution/purpose.md
  27. 1
      content/about/constitution/revision.md
  28. 1
      content/about/constitution/use-of-club-resources.md
  29. 11
      content/resources/machine-usage-agreement/ORDER.json
  30. 1
      content/resources/machine-usage-agreement/acceptable-and-unacceptable-use.md
  31. 1
      content/resources/machine-usage-agreement/club-accounts.md
  32. 1
      content/resources/machine-usage-agreement/definitions.md
  33. 1
      content/resources/machine-usage-agreement/rights-of-syscom-and-exec.md
  34. 1
      content/resources/machine-usage-agreement/security.md
  35. 1
      content/resources/machine-usage-agreement/summary.md
  36. 1
      content/resources/machine-usage-agreement/usage-policy.md
  37. 1
      content/resources/machine-usage-agreement/user-agreement.md
  38. 1
      content/resources/machine-usage-agreement/user-responsibilities.md
  39. 16
      content/resources/services/ORDER.json
  40. 1
      content/resources/services/cloud-accounts.md
  41. 1
      content/resources/services/club-web-hosting.md
  42. 1
      content/resources/services/cs-club-email.md
  43. 1
      content/resources/services/git-hosting.md
  44. 1
      content/resources/services/in-office-books.md
  45. 1
      content/resources/services/irc.md
  46. 1
      content/resources/services/live-streaming.md
  47. 1
      content/resources/services/machine-accounts.md
  48. 1
      content/resources/services/mailing-lists.md
  49. 1
      content/resources/services/mattermost.md
  50. 1
      content/resources/services/software-mirror.md
  51. 1
      content/resources/services/ssh-key-fingerprints.md
  52. 1
      content/resources/services/video-conferencing.md
  53. 1
      content/resources/services/web-hosting.md
  54. 38
      lib/organized-content.ts

14
content/about/code-of-conduct/ORDER.json

@ -0,0 +1,14 @@
[
"purpose",
"expected-behaviour",
"unacceptable-behaviour",
"experiencing-unacceptable-behaviour",
"consequences-of-inappropriate-behaviour",
"addressing-grievances",
"confidentiality",
"scope-and-spaces",
"contact-information",
"additional-information",
"license-information-and-attribution",
"revision"
]

1
content/about/code-of-conduct/additional-information.md

@ -1,6 +1,5 @@
---
title: Additional Information
index: 10
---
Additionally, the Executive Council are available to help Club members engage with local law enforcement or to otherwise help those experiencing unacceptable behaviour feel safe. In the context of in-person events, organizers will also provide escorts as desired by the person experiencing distress.

1
content/about/code-of-conduct/addressing-grievances.md

@ -1,6 +1,5 @@
---
title: Addressing Grievances
index: 6
---
If either the complainant or the subject disagree with the decision made by the Handling Officer, they can appeal to the Officers, who can overturn the decision with a majority vote of all the Officers.

1
content/about/code-of-conduct/confidentiality.md

@ -1,6 +1,5 @@
---
title: Confidentiality
index: 7
---
The Club recognizes that all members have a right to privacy, and will handle complaints confidentially.

1
content/about/code-of-conduct/consequences-of-inappropriate-behaviour.md

@ -1,6 +1,5 @@
---
title: Consequences of Inappropriate Behaviour
index: 5
---
After having done so, the Handling Officer shall use their best judgment to determine if the complaint is valid and, if so, determine with the relevant Officers the appropriate action to ensure that the complainant feels welcome in the Computer Science Club and to avoid a subsequent incident:

1
content/about/code-of-conduct/contact-information.md

@ -1,6 +1,5 @@
---
title: Contact Information
index: 9
---
- The Computer Science Club [Officers can be contacted as a whole](/about).

1
content/about/code-of-conduct/expected-behaviour.md

@ -1,6 +1,5 @@
---
title: Expected Behaviour
index: 2
---
- Participate in an authentic and active way. In doing so, you contribute to the health and longevity of this Club.

1
content/about/code-of-conduct/experiencing-unacceptable-behaviour.md

@ -1,6 +1,5 @@
---
title: Experiencing Unacceptable Behaviour
index: 4
---
_The Executive Council and Faculty Advisor are herein referred to as the Officers, or singularly as Officer._

1
content/about/code-of-conduct/license-information-and-attribution.md

@ -1,6 +1,5 @@
---
title: License Information and Attribution
index: 11
---
- The Code of Conduct is distributed under a [Creative Commons Attribution-ShareAlike License](http://creativecommons.org/licenses/by-sa/3.0/), derived from the [Women in Computer Science Code of Conduct](http://wics.uwaterloo.ca/deprecated/code-of-conduct/), the [UW Amateur Radio Club Code of Conduct](http://uwarc.uwaterloo.ca/policies-procedures/code-of-conduct/), and the [FASS Code of Conduct](http://fass.uwaterloo.ca/fassconstitution).

1
content/about/code-of-conduct/purpose.md

@ -1,6 +1,5 @@
---
title: Purpose
index: 1
---
One of the primary goals of the Computer Science Club of the University of Waterloo is the inclusion and support of all members of the University of Waterloo community who are interested in Computer Science. As such, we are committed to providing a friendly, safe and welcoming environment for all, regardless of gender, sex, sexual orientation, ability, ethnicity, socioeconomic status, age, and religion or lack thereof.

1
content/about/code-of-conduct/revision.md

@ -1,6 +1,5 @@
---
title: Revision
index: 12
---
Revision 1.3, adopted by the Computer Science Club of the University of Waterloo on 25 January 2018.

1
content/about/code-of-conduct/scope-and-spaces.md

@ -1,6 +1,5 @@
---
title: Scope and Spaces
index: 8
---
In cases where the Code of Conduct contradicts University policies, or applicable laws and bylaws, the Code of Conduct does not apply to the extent to which it conflicts.

1
content/about/code-of-conduct/unacceptable-behaviour.md

@ -1,6 +1,5 @@
---
title: Unacceptable Behaviour
index: 3
---
**Unacceptable behaviours include:**

16
content/about/constitution/ORDER.json

@ -0,0 +1,16 @@
[
"name",
"purpose",
"membership",
"officers",
"duties-of-officers",
"executive-council",
"committees",
"meetings",
"finances",
"amendments-and-procedures",
"dissolution",
"code-of-conduct",
"use-of-club-resources",
"revision"
]

1
content/about/constitution/amendments-and-procedures.md

@ -1,6 +1,5 @@
---
title: Amendments and Procedures
index: 10
---
1. A proposed constitutional amendment can be initiated by the Executive Council or any ten (10) members.

1
content/about/constitution/code-of-conduct.md

@ -1,6 +1,5 @@
---
title: Code of Conduct
index: 12
---
1. The Club has a [Code of Conduct](/about/code-of-conduct).

1
content/about/constitution/committees.md

@ -1,6 +1,5 @@
---
title: Committees
index: 7
---
## Programme Committee

1
content/about/constitution/dissolution.md

@ -1,6 +1,5 @@
---
title: Dissolution
index: 11
---
1. In the event of dissolution of the Club, all assets of the Club shall be transferred to the Mathematics Society of the University of Waterloo.

1
content/about/constitution/duties-of-officers.md

@ -1,6 +1,5 @@
---
title: Duties of Officers
index: 5
---
1. The duties of the President shall be:

1
content/about/constitution/executive-council.md

@ -1,6 +1,5 @@
---
title: Executive Council
index: 6
---
1. The Executive Council shall consist of the present officers of the Club and the Faculty Advisor (as a non-voting member) and has the power to run the affairs of this club within the limits of this constitution. This includes the power to overrule or issue directions to any officer.

1
content/about/constitution/finances.md

@ -1,6 +1,5 @@
---
title: Finances
index: 9
---
1. The Treasurer shall, each term, present to the Executive a financial statement for the previous term. They shall, before the end of the current term, ensure that the records are in a good condition to make this task as easy as possible for the next Treasurer.

1
content/about/constitution/meetings.md

@ -1,6 +1,5 @@
---
title: Meetings
index: 8
---
1. A regular meeting of the Club shall be held each term. This meeting shall be called by the CRO and shall be the election meeting for that term.

1
content/about/constitution/membership.md

@ -1,6 +1,5 @@
---
title: Membership
index: 3
---
1. In compliance with MathSoc regulations and in recognition of the club being primarily targeted at undergraduate students, full membership is open to all Social Members of the Mathematics Society and restricted to the same.

1
content/about/constitution/name.md

@ -1,6 +1,5 @@
---
title: Name
index: 1
---
The name of this organization shall be the "Computer Science Club of the University of Waterloo".

1
content/about/constitution/officers.md

@ -1,6 +1,5 @@
---
title: Officers
index: 4
---
1. The officers of the Club shall be:

1
content/about/constitution/purpose.md

@ -1,6 +1,5 @@
---
title: Purpose
index: 2
---
1. The Club is organized and will be operated exclusively for educational and scientific purposes in furtherance of:

1
content/about/constitution/revision.md

@ -1,6 +1,5 @@
---
title: Revision
index: 14
---
The constitution was last revised on 25 January 2018.

1
content/about/constitution/use-of-club-resources.md

@ -1,6 +1,5 @@
---
title: Use of Club Resources
index: 13
---
1. All resources under control of the Club are to be used in accordance with the aims of the Club.

11
content/resources/machine-usage-agreement/ORDER.json

@ -0,0 +1,11 @@
[
"summary",
"usage-policy",
"acceptable-and-unacceptable-use",
"user-responsibilities",
"security",
"rights-of-syscom-and-exec",
"club-accounts",
"definitions",
"user-agreement"
]

1
content/resources/machine-usage-agreement/acceptable-and-unacceptable-use.md

@ -1,6 +1,5 @@
---
title: Acceptable and Unacceptable Use
index: 3
---
The CSC machines are intended for research, personal projects, and general use in accordance with the aims of the CSC (see the [CSC Constitution](/about/constitution) for further details). Projects that are of interest to the CSC may be given special priority by the CSC Systems Committee.

1
content/resources/machine-usage-agreement/club-accounts.md

@ -1,6 +1,5 @@
---
title: Club Accounts
index: 7
---
The club accounts policy is divided into the following 2 sections:

1
content/resources/machine-usage-agreement/definitions.md

@ -1,6 +1,5 @@
---
title: Definitions
index: 8
---
CSC

1
content/resources/machine-usage-agreement/rights-of-syscom-and-exec.md

@ -1,6 +1,5 @@
---
title: Rights of the Systems Committee and the CSC Executive
index: 6
---
The Systems Committee may examine any files or programs believed to be out of control or in violation of the usage policies for the CSC network. Examination of a program includes examination of the running process and its binary. Files believed to be the data or source to the process may also be examined. The process may be killed, stopped or otherwise interrupted at the discretion of the Systems Committee. If the Systems Committee takes any of the above actions, the owner of the process will be notified.

1
content/resources/machine-usage-agreement/security.md

@ -1,6 +1,5 @@
---
title: Security
index: 5
---
Users may not attempt to gain access to accounts other than those which they have been permitted to use. Similarly, users may not attempt to access other users' private files, nor may they attempt to find out the password of any account.

1
content/resources/machine-usage-agreement/summary.md

@ -1,6 +1,5 @@
---
title: Summary
index: 1
---
This is a brief version of the usage policy. Everyone who receives an account on one of the CS Club machines must sign the full Machine Usage Agreement, and this summary lists the things that the users will agree to.

1
content/resources/machine-usage-agreement/usage-policy.md

@ -1,6 +1,5 @@
---
title: Usage Policy
index: 2
---
Everyone who receives an account on one of the CS Club machines must sign the agreement in the final section. This document does not state who will be allowed accounts on CS Club machines, the normal expiry period of accounts, nor any other similar matters. Further, this policy does not, in general, guarantee any rights to users.

1
content/resources/machine-usage-agreement/user-agreement.md

@ -1,6 +1,5 @@
---
title: User Agreement
index: 9
---
I have read and understood the usage policy of 29 August 2007, and I agree to use my account(s) on the CSC network in accordance with this policy. I am responsible for all actions taken by anyone using this account. Furthermore, I accept full legal responsibility for all of the actions that I commit using the CSC network according to any and all applicable laws.

1
content/resources/machine-usage-agreement/user-responsibilities.md

@ -1,6 +1,5 @@
---
title: User Responsibilities
index: 4
---
Users must be responsible for their behaviour. Users, and not the CSC, will be held accountable for any of their illegal, damaging or unethical actions. Such actions are obviously not permitted on CSC machines.

16
content/resources/services/ORDER.json

@ -0,0 +1,16 @@
[
"machine-accounts",
"cloud-accounts",
"cs-club-email",
"web-hosting",
"club-web-hosting",
"git-hosting",
"software-mirror",
"irc",
"mattermost",
"video-conferencing",
"live-streaming",
"in-office-books",
"mailing-lists",
"ssh-key-fingerprints"
]

1
content/resources/services/cloud-accounts.md

@ -1,6 +1,5 @@
---
title: Cloud Accounts
index: 2
---
With the CSC cloud, you can create your own virtual machines, host your Docker container images, and deploy your apps on Kubernetes.

1
content/resources/services/club-web-hosting.md

@ -1,6 +1,5 @@
---
title: Club Web Hosting
index: 5
---
If you're a club and looking for web space, the CS Club is the place go.

1
content/resources/services/cs-club-email.md

@ -1,6 +1,5 @@
---
title: CS Club Email
index: 3
---
Members also receive a **[username@csclub.uwaterloo.ca](#)** email address.

1
content/resources/services/git-hosting.md

@ -1,6 +1,5 @@
---
title: Git Hosting
index: 6
---
We host an instance of [Gitea](https://git.csclub.uwaterloo.ca/) for all of our members. The UI and workflow of Gitea are very similar to GitHub. Gitea is currently home to most CSC software projects, including the [code for this website](https://git.csclub.uwaterloo.ca/www/www-new).

1
content/resources/services/in-office-books.md

@ -1,6 +1,5 @@
---
title: In-Office Books
index: 12
---
The CS Club maintains an extensive collection of Computer Science-related books. Feel free to come by the office to take a look at our library.

1
content/resources/services/irc.md

@ -1,6 +1,5 @@
---
title: IRC
index: 8
---
We host an instance of [The Lounge](https://chat.csclub.uwaterloo.ca/) for all of our members. The Lounge is a web-based IRC client which is simple to setup and use. It also has a Progressive Web App available for mobile devices.

1
content/resources/services/live-streaming.md

@ -1,6 +1,5 @@
---
title: Live Streaming
index: 11
---
We host an instance of [Icecast](https://icy.csclub.uwaterloo.ca/), which can stream live audio and video. We have successfully streamed live events to Icecast using OBS Studio. Latency usually ranges between 5-10 sec.

1
content/resources/services/machine-accounts.md

@ -1,6 +1,5 @@
---
title: Machine Accounts
index: 1
---
The main benefit of becoming a CS Club member is to get access to our various machines.

1
content/resources/services/mailing-lists.md

@ -1,6 +1,5 @@
---
title: Mailing Lists
index: 13
---
Our [csc-general mailing list](https://mailman.csclub.uwaterloo.ca/postorius/lists/csc-general.csclub.uwaterloo.ca/) informs members about our current events.

1
content/resources/services/mattermost.md

@ -1,6 +1,5 @@
---
title: Mattermost
index: 9
---
We host an instance of [Mattermost](https://mattermost.csclub.uwaterloo.ca/) for all of our members. Mattermost is an open-source alternative to Slack. We currently bridge the `#csc` channel on libera.chat to Mattermost (if you are looking for a generic web-based IRC client, see [The Lounge](/resources/services/irc)). CSC executives currently use Mattermost for planning and logistics.

1
content/resources/services/software-mirror.md

@ -1,6 +1,5 @@
---
title: Software Mirror
index: 7
---
The CSC runs a mirror of popular open source software. The [mirror](http://mirror.csclub.uwaterloo.ca/) has a list of available software. More information is available on our [wiki article](http://wiki.csclub.uwaterloo.ca/Mirror).

1
content/resources/services/ssh-key-fingerprints.md

@ -1,6 +1,5 @@
---
title: SSH Key Fingerprints
index: 14
---
| Machine Name | Key Type | Fingerprint |

1
content/resources/services/video-conferencing.md

@ -1,6 +1,5 @@
---
title: Video Conferencing
index: 10
---
We host an instance of [BigBlueButton](https://bbb.csclub.uwaterloo.ca/), a free and open-source video conferencing platform. BigBlueButton offers many useful features such as a multi-user whiteboard, breakout rooms, shared notes, and more.

1
content/resources/services/web-hosting.md

@ -1,6 +1,5 @@
---
title: Web Hosting
index: 4
---
Many of members take advantage of our web hosting service. Our web server runs on Apache, and has PHP, Python, and Perl modules installed. We also have MySQL and PostgreSQL databases available upon request.

38
lib/organized-content.ts

@ -5,6 +5,7 @@ import matter from "gray-matter";
import { serialize } from "next-mdx-remote/serialize";
const BASE_PATH = "content";
const ORDER_FILE = "ORDER.json";
export async function getSectionNamesForPage(page: string) {
const sectionDir = path.join(BASE_PATH, page);
@ -15,17 +16,25 @@ export async function getSectionNamesForPage(page: string) {
export async function getSectionsForPage(page: string) {
const names = await getSectionNamesForPage(page);
const sections = await Promise.all(
names.map(async (name) => ({
const order = await getSectionOrder(page);
if (!isEquivalent(new Set(names), new Set(order))) {
throw new Error(
`${ORDER_FILE} must contain all sections defined for page ${page}`
);
}
const sections = names
.sort((a, b) => order.indexOf(a) - order.indexOf(b))
.map(async (name) => ({
name,
data: await getSectionForPage(page, name),
}))
);
}));
return sections.sort((a, b) => a.data.index - b.data.index);
return await Promise.all(sections);
}
export async function getSectionForPage(page: string, section: string) {
async function getSectionForPage(page: string, section: string) {
const raw = await fs.readFile(
path.join(BASE_PATH, page, `${section}.md`),
"utf-8"
@ -35,6 +44,21 @@ export async function getSectionForPage(page: string, section: string) {
return {
content: await serialize(content),
title: data.title as string,
index: data.index as number,
};
}
async function getSectionOrder(page: string) {
const raw = await fs.readFile(
path.join(BASE_PATH, page, ORDER_FILE),
"utf-8"
);
return JSON.parse(raw) as string[];
}
function isEquivalent<T>(setA: Set<T>, setB: Set<T>): boolean {
const aContainsB = [...setB].every((b) => setA.has(b));
const bContainsA = [...setA].every((a) => setB.has(a));
return aContainsB && bContainsA;
}

Loading…
Cancel
Save