Skip to content

Commit 70f70b2

Browse files
committed
Change github source code links based on submodule
1 parent d7a6eaa commit 70f70b2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Diff for: src/layouts/ReferenceItemLayout.astro

+9-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import type {
1818
ReferenceParam,
1919
} from "@/types/parsers.interface";
2020
import { setJumpToState } from "../globals/state";
21-
import { p5Version } from "../globals/p5-version";
21+
import { p5Version, p5SoundVersion } from "../globals/p5-version";
2222
import flask from "@src/content/ui/images/icons/flask.svg?raw";
2323
2424
const { entry, relatedEntries } = Astro.props;
@@ -76,6 +76,12 @@ const relatedReferences = [
7676
7777
const seenParams: Record<string, true> = {};
7878
79+
const isSoundModule = entry.data.module === "p5.sound"
80+
const ghSourceRepo = isSoundModule ? "p5.sound.js" : "p5.js"
81+
const ghVersion = isSoundModule ? p5SoundVersion : p5Version
82+
const ghIssuesUrl = `https://github.com/processing/${ghSourceRepo}/issues`
83+
const ghSourceCodeUrl = `https://github.com/processing/${ghSourceRepo}/blob/v${ghVersion}`
84+
7985
---
8086

8187
<Head title={entry.data.title} locale={currentLocale} />
@@ -243,9 +249,9 @@ const seenParams: Record<string, true> = {};
243249
entry.data.file && entry.data.line &&(
244250
<div class="my-xl">
245251
<div class="text-body [&_a]:text-type-magenta-dark [&_a]:!decoration-type-magenta-dark my-lg">
246-
Notice any errors or typos? <a href ="https://github.com/processing/p5.js/issues">Please let us know</a>. Please feel free to edit
252+
Notice any errors or typos? <a href ={ghIssuesUrl}>Please let us know</a>. Please feel free to edit
247253
<a
248-
href={`https://github.com/processing/p5.js/blob/v${p5Version}/${entry.data.file}#L${entry.data.line}`}
254+
href={`${ghSourceCodeUrl}/${entry.data.file}#L${entry.data.line}`}
249255
>
250256
{entry.data.file}
251257
</a>

0 commit comments

Comments
 (0)