Skip to content

Commit

Permalink
Change github source code links based on submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
rndexe committed Dec 5, 2024
1 parent d7a6eaa commit 70f70b2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/layouts/ReferenceItemLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type {
ReferenceParam,
} from "@/types/parsers.interface";
import { setJumpToState } from "../globals/state";
import { p5Version } from "../globals/p5-version";
import { p5Version, p5SoundVersion } from "../globals/p5-version";
import flask from "@src/content/ui/images/icons/flask.svg?raw";
const { entry, relatedEntries } = Astro.props;
Expand Down Expand Up @@ -76,6 +76,12 @@ const relatedReferences = [
const seenParams: Record<string, true> = {};
const isSoundModule = entry.data.module === "p5.sound"
const ghSourceRepo = isSoundModule ? "p5.sound.js" : "p5.js"
const ghVersion = isSoundModule ? p5SoundVersion : p5Version
const ghIssuesUrl = `https://github.com/processing/${ghSourceRepo}/issues`
const ghSourceCodeUrl = `https://github.com/processing/${ghSourceRepo}/blob/v${ghVersion}`
---

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

0 comments on commit 70f70b2

Please sign in to comment.