Do not use index: as metadata for OrganizedContent (#468)
continuous-integration/drone/push Build is passing Details

@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>
This commit is contained in:
Aditya Thakral 2022-06-18 23:07:04 -04:00
parent 0f0a25596d
commit 44af493832
54 changed files with 88 additions and 56 deletions

View File

@ -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"
]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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"
]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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"
]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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