Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change github source code links based on submodule for p5.sound #654

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading