Skip to content

Commit 9ec8a52

Browse files
committed
Update examples metadata to use new schema
1 parent 08fc758 commit 9ec8a52

File tree

51 files changed

+492
-137
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+492
-137
lines changed

docs/content_overview.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
- Stored in `/src/content/examples/`
1212
- All translations are stored and edited directly in this repo under the corresponding language folder in `/src/content/examples/`
1313

14+
All original examples (created new for p5.js) since 2024 are collectively attributed to p5.js Contributors under the CC-BY-NC-SA 4.0 license. However, examples that build on prior work (under a compatible license) can be attributed in more detail, to make sure that authorship is clear in citation, and code history is available to viewers.
15+
1416
To add attribution, you can use the following block in the headers, listing in chronological order all arrtibutions. Below is the example from `examples/animation-and-variables-conditions/`:
1517

1618
```yaml
@@ -21,17 +23,19 @@ remix:
2123
- name: Prof. WM Harris
2224
URL: https://people.rit.edu/wmhics/
2325

24-
codeURL: https://github.com/processing/p5.js-website-legacy/blob/main/src/data/examples/en/04_Control/05_Logical_Operators_2.js
25-
codeLabel: pre-2023 code
26+
code:
27+
- URL: https://github.com/processing/p5.js-website-legacy/blob/main/src/data/examples/en/04_Control/05_Logical_Operators_2.js
28+
- label: pre-2023 code
2629

2730
- description: Revised by
2831

2932
attribution:
3033
- name: Caleb Foss
3134
URL: https://github.com/calebfoss
3235

33-
codeURL: https://github.com/processing/p5.js-example/tree/main/examples/02_Animation_And_Variables/03_Conditions
34-
codeLabel: 2023 revision code
36+
code:
37+
- URL: https://github.com/processing/p5.js-example/tree/main/examples/02_Animation_And_Variables/03_Conditions
38+
label: 2023 revision code
3539

3640
- collectivelyAttributedSince: 2024
3741
```
@@ -40,11 +44,9 @@ This will result in a block that lists, in order, the initial inspiration; any r
4044
4145
A remix can be many things ([here is an example analysis of sketch remixing (PDF)](https://dl.acm.org/doi/pdf/10.1145/3563657.3595969)); the `description` will be by default "Remixed by", so a more specific description is recommended.
4246

43-
If the `collectivelyAttributedSince` information is missing, then no year will be included, but the collective attribution statement will still show: "Edited and maintained by p5.js Contributors and the Processing Foundation. Licensed under CC BY-NC-SA 4.0."
44-
45-
Each item in the remix history must have an original codeURL and/or at least one person listed in the attribution section. When multiple people are listed, their names will be shown in that order. For people, URLs are optional but recommended.
47+
If the `collectivelyAttributedSince` information is missing, then no year will be included, but the collective attribution statement will still show: "Edited and maintained by p5.js Contributors and the Processing Foundation. Licensed under CC BY-NC-SA 4.0." You'll see this in examples that were part of a major revision project with specific attribution, but have collective authorship before and after.
4648

47-
If no `codeLabel` is given but there is a `codeURL`, then the default label "code" will be used - however, for accessibility, it is strongly recommended to use short, descriptive labels.
49+
Each item in the remix history must have an at least one person listed in the attribution section. When multiple people are listed, their names will be shown in that order. For people, URLs are optional but recommended.
4850

4951
---
5052

src/content/examples/config.ts

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,26 @@ export const examplesCollection = defineCollection({
2222
// Optional list of remixes to add to license
2323
remix: z
2424
.array(
25-
z.union([
26-
z.string(),
27-
z.object({
28-
description: z.string().default("Remixed by"),
29-
codeURL: z.string().optional(),
30-
codeLabel: z.string().optional(),
31-
attribution: z
32-
.array(
33-
z.object({
34-
name: z.string(),
35-
URL: z.string().optional(),
36-
})
37-
)
38-
.optional(),
39-
collectivelyAttributedSince: z.number().optional(),
40-
}),
41-
])
25+
z.object({
26+
description: z.string().default("Remixed by"),
27+
attribution: z
28+
.array(
29+
z.object({
30+
name: z.string(),
31+
URL: z.string().optional(),
32+
})
33+
)
34+
.optional(),
35+
code: z
36+
.array(
37+
z.object({
38+
label: z.string(),
39+
URL: z.string(),
40+
})
41+
)
42+
.optional(),
43+
collectivelyAttributedSince: z.number().optional(),
44+
})
4245
)
4346
.optional()
4447
.default([]),

src/content/examples/en/01_Shapes_And_Color/01_Color/description.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,23 @@ featuredImage: "../../../images/featured/01_Shapes_And_Color-01_Color-thumbnail.
33
featuredImageAlt: A few basic shapes drawn in different colors over a blue background.
44
title: Color
55
oneLineDescription: Add color to your sketch.
6+
7+
8+
remix:
9+
- description: Created by
10+
11+
attribution:
12+
- name: Caleb Foss
13+
URL: https://github.com/calebfoss
14+
- name: Darren Kessner
15+
URL: https://github.com/dkessner
16+
17+
code:
18+
- label: 2023 code
19+
URL: https://github.com/processing/p5.js-example/tree/main/examples/02_Animation_And_Variables/03_Conditions
20+
21+
- collectivelyAttributedSince: 2024
22+
623
---
724

825
This expands on the Shape Primitives example by adding

src/content/examples/en/02_Animation_And_Variables/00_Drawing_Lines/description.mdx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,19 @@ title: Drawing Lines
55
oneLineDescription: Draw with the mouse.
66

77
remix:
8-
- revision-2023-dkessner
8+
9+
- description: Revised by
10+
11+
attribution:
12+
- name: Darren Kessner
13+
URL: https://github.com/dkessner
14+
15+
code:
16+
- label: pre-2023 code
17+
URL: https://github.com/processing/p5.js-website-legacy/blob/main/src/data/examples/en/17_Drawing/00_Continuous_Lines.js
18+
- label: 2023 revision code
19+
URL: https://github.com/processing/p5.js-example/tree/main/examples/02_Animation_And_Variables/00_Drawing_Lines
20+
921
---
1022

1123
Click and drag the mouse to draw a line.

src/content/examples/en/02_Animation_And_Variables/01_Animation_With_Events/description.mdx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ title: Animation with Events
55
oneLineDescription: Pause and resume animation.
66

77
remix:
8-
- revision-2023-dkessner
8+
- description: Revised by
9+
10+
attribution:
11+
- name: Darren Kessner
12+
URL: https://github.com/dkessner
13+
914
---
1015

1116
This example demonstrates the use of

src/content/examples/en/02_Animation_And_Variables/02_Mobile_Device_Movement/description.mdx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ featured: true
77

88

99
remix:
10-
- revision-2023-klich
10+
- description: Revised by
11+
12+
attribution:
13+
- name: Kasey Lichtlyter
14+
URL: https://www.klich.co/
15+
1116
---
1217

1318
The <a href="https://p5js.org/reference/p5/deviceMoved" target="_blank">deviceMoved()</a>

src/content/examples/en/02_Animation_And_Variables/03_Conditions/description.mdx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,19 @@ remix:
1111
- name: Prof. WM Harris
1212
URL: https://people.rit.edu/wmhics/
1313

14-
codeURL: https://github.com/processing/p5.js-website-legacy/blob/main/src/data/examples/en/04_Control/05_Logical_Operators_2.js
15-
codeLabel: pre-2023 code
14+
code:
15+
- URL: https://github.com/processing/p5.js-website-legacy/blob/main/src/data/examples/en/04_Control/05_Logical_Operators_2.js
16+
label: pre-2023 code
1617

1718
- description: Revised by
1819

19-
attribution:
20+
attribution:
2021
- name: Caleb Foss
2122
URL: https://github.com/calebfoss
2223

23-
codeURL: https://github.com/processing/p5.js-example/tree/main/examples/02_Animation_And_Variables/03_Conditions
24-
codeLabel: 2023 revision code
24+
code:
25+
- URL: https://github.com/processing/p5.js-example/tree/main/examples/02_Animation_And_Variables/03_Conditions
26+
label: 2023 revision code
2527

2628
- collectivelyAttributedSince: 2024
2729

src/content/examples/en/03_Imported_Media/00_Words/description.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ featuredImageAlt: Three columns of the words “ichi,” “ni,” “san,” an
44
title: Words
55
oneLineDescription: Load fonts and draw text.
66

7+
78
remix:
8-
- revision-2023-klich
9+
- description: Revised by
10+
11+
attribution:
12+
- name: Kasey Lichtlyter
13+
URL: https://www.klich.co/
14+
915
---
1016

1117
The <a href="https://p5js.org/reference/p5/text" target="_blank">text()</a> function is used for inserting text into the canvas.

src/content/examples/en/03_Imported_Media/01_Copy_Image_Data/description.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ featuredImageAlt: Black-and-white photograph of a parrot. A curvy line is drawn
44
title: Copy Image Data
55
oneLineDescription: Paint from an image file onto the canvas.
66

7+
78
remix:
8-
- revision-2023-klich
9+
- description: Revised by
10+
11+
attribution:
12+
- name: Kasey Lichtlyter
13+
URL: https://www.klich.co/
14+
915
---
1016

1117
Using the <a href="https://p5js.org/reference/p5/copy" target="_blank">copy()</a>

src/content/examples/en/03_Imported_Media/02_Alpha_Mask/description.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,16 @@ featuredImageAlt: Two leaf sprigs side by side on a white background. The right
44
title: Alpha Mask
55
oneLineDescription: Use one image to cut out a section of another image.
66

7+
78
remix:
8-
- revision-2023-klich
9+
- description: Revised by
10+
11+
attribution:
12+
- name: Malay Vasa
13+
URL: https://github.com/Malayvasa
14+
- name: Kasey Lichtlyter
15+
URL: https://www.klich.co/
16+
917
---
1018

1119
Using the

0 commit comments

Comments
 (0)