Skip to content

Commit d5ac8d1

Browse files
committed
fix: remove merge conflict vestiges
1 parent 3ca2bf4 commit d5ac8d1

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

SP22/nlp-series/workshop-2/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,7 @@ workshop-2
4545

4646
```
4747

48-
<<<<<<< HEAD
4948
## 3. Getting Started
50-
=======
51-
## 2. Getting Started
52-
>>>>>>> ab9b4c0 (chore: add numbers back to readme headings)
5349

5450
This workshop is about Recurrent Neural Networks for NLP for detecting emotions in a multi-class dataset. This workshop is self-contained from the first and covers RNNs from the ground up!
5551

website/src/layout/components/OpenElsewhereLinks/utils/github.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ export const REPO_OWNER = 'acmucsd'
22
export const REPO_NAME = 'acm-ai-workshops'
33
export const DEFAULT_BRANCH = 'main'
44

5-
export const getGithubSlug = (fsPath: string[]) => `${REPO_OWNER}/${REPO_NAME}/blob/${DEFAULT_BRANCH}/${fsPath.map(encodeURIComponent).join('/')}`
5+
export const getGithubSlug = (fsPath: string[]) => `${REPO_OWNER}/${REPO_NAME}/tree/${DEFAULT_BRANCH}/${fsPath.map(encodeURIComponent).join('/')}`

website/src/pages/workshops/[...slug].tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { join } from "path";
2-
import { join as joinPosix } from "path/posix"
1+
import { join, relative, sep } from "path";
32
import { readFile } from "fs/promises"
43

54
import { extractToc } from "@/lib/pipeline/toc";
@@ -15,6 +14,7 @@ import type { GetStaticPaths, GetStaticProps, NextPage } from "next";
1514
import type { CategoryIndexPageProps, CategoryPageProps, CategoryReadmePageProps, CommonPageProps, DocPageProps, PageProps } from "@/layout/pages/types";
1615
import remarkResolveRelativeLinks from "@/lib/unified/remark-resolve-relative-links";
1716
import { getGithubSlug } from "@/layout/components/OpenElsewhereLinks/utils/github";
17+
import { validateConfig } from "@/lib/pipeline/validate-config";
1818

1919
const Workshop: NextPage<PageProps> = ({ type, ...props }) => {
2020
switch (type) {
@@ -30,6 +30,7 @@ export default Workshop;
3030
export const getStaticProps: GetStaticProps = async ({ params }) => {
3131
const { slug } = params as { slug: string[] };
3232

33+
const config = validateConfig(workshopsConfig)
3334
const { entry, sidebar, fileToMd, dirToMd } = await createPipeline(workshopsConfig).getStaticProps(...slug);
3435

3536
const uniqueProps = await (async () => {
@@ -59,6 +60,7 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
5960

6061
// otherwise render the README markdown
6162
} else {
63+
const dirFileFsPath = relative(config.basePath, entry.fullPathToFile).split(sep)
6264
const contents = await readFile(entry.fullPathToFile, 'utf-8'); // `entry.fullPathToFile` should be the result of `dir.dirFileResolver()`
6365
const md = await dirToMd(contents)
6466
const toc = await extractToc(md)
@@ -69,7 +71,9 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
6971
slug: entry.slug,
7072
type: 'readme',
7173
remarkPlugins: [
72-
[remarkResolveRelativeLinks, { resolver: (url: string) => `https://github.com/${joinPosix(getGithubSlug(entry.fsPath), url)}` }],
74+
[remarkResolveRelativeLinks, {
75+
resolver: (url: string) => new URL(url, `https://github.com/${getGithubSlug(dirFileFsPath)}`).href,
76+
}],
7377
],
7478
})
7579

@@ -92,7 +96,9 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
9296
baseUrl: workshopsConfig.baseUrl ?? '/',
9397
slug: entry.slug,
9498
remarkPlugins: [
95-
[remarkResolveRelativeLinks, { resolver: (url: string) => `https://github.com/${joinPosix(getGithubSlug(entry.fsPath), url)}` }],
99+
[remarkResolveRelativeLinks, {
100+
resolver: (url: string) => `https://github.com/${join(getGithubSlug(entry.fsPath), url)}`,
101+
}],
96102
],
97103
})
98104
return {

0 commit comments

Comments
 (0)