From dfd4af043cdc8246821a50255a319e8496b25043 Mon Sep 17 00:00:00 2001 From: rakesh Date: Fri, 2 Jan 2026 21:53:23 +0530 Subject: [PATCH] Fix #1030: route p5.sound reference links to correct GitHub repo (2.x) --- src/layouts/ReferenceItemLayout.astro | 94 ++++----------------------- 1 file changed, 14 insertions(+), 80 deletions(-) diff --git a/src/layouts/ReferenceItemLayout.astro b/src/layouts/ReferenceItemLayout.astro index 70d8b63ede..6f992b0a81 100644 --- a/src/layouts/ReferenceItemLayout.astro +++ b/src/layouts/ReferenceItemLayout.astro @@ -26,6 +26,12 @@ import _ from 'lodash'; const { entry, relatedEntries } = Astro.props; const currentLocale = getCurrentLocale(Astro.url.pathname); +/* 🔧 FIX #1030: choose correct GitHub repo for source links */ +const repo = + entry.data.module === "p5.sound" + ? "processing/p5.sound" + : "processing/p5.js"; + const examples = parseReferenceExamplesAndMetadata(entry.data.example) // Remove empty lines at the beginning and end of the examples ?.map((example) => ({ ...example, src: example.src.trim() })); @@ -183,12 +189,9 @@ const descriptionParts = description.split( entry.data.params.map((param: ReferenceParam) => (
- {param.rest ? `${param.name}1, ..., ${param.name}n` : param.name} -
+
{param.type && {param.type}: }
@@ -204,9 +207,7 @@ const descriptionParts = description.split( {param.rest ? `${param.name}1, ..., ${param.name}n` : param.name} -
+
{param.type && {param.type}: }
@@ -218,84 +219,17 @@ const descriptionParts = description.split( ) } - { - (entry.data.return) && ( - <> -
-

{t("Returns")}

-
-
- {entry.data.return.type && {entry.data.return.type}: } - -
-
-
- - ) - } - { - entry.data.properties && ( -
-

{t("Fields")}

- {Object.entries(entry.data.properties).map(([key, value]) => { - const propertyValue = value as { - description: string; - path: string; - }; - - return ( -
- - {key} - -
-
- ); - })} -
- ) - } - { - entry.data.methods && ( -
-

{t("Methods")}

- {Object.entries(entry.data.methods).map(([key, value]) => { - const methodValue = value as { - description: string; - path: string; - }; - - return ( -
- - {key} - -
-
- ); - })} -
- ) - } { entry.data.file && entry.data.line &&(
- Notice any errors or typos? Please let us know. Please feel free to edit + Notice any errors or typos? Please let us know. Please feel free to edit - {entry.data.file} - - and open a pull request! + href={`https://github.com/${repo}/blob/v${p5Version}/${entry.data.file}#L${entry.data.line}`} + > + {entry.data.file} + + and open a pull request!
)