Skip to content

Commit bfb57eb

Browse files
committed
Merge branch 'main' into fix/show-param-type-return-reference
2 parents f69a6ec + d6a9b2e commit bfb57eb

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

src/content/libraries/en/rita.js.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: rita.js
2+
description: tools for natural language and generative writing
3+
category: language
4+
sourceUrl: https://github.com/dhowe/ritajs
5+
websiteUrl: https://rednoise.org/rita
6+
featuredImage: "../images/rita.jpg"
7+
author:
8+
name: Daniel C Howe
9+
url: https://rednoise.org/daniel
10+
featuredImageAlt: rita.js logo
11+
npm: rita
12+
npmFilePath: "dist/rita.min.js"
13+

src/content/libraries/images/rita.jpg

106 KB
Loading

src/content/tutorials/en/organizing-code-with-functions.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ It is helpful to think of this function like a cookie cutter. For example, you c
403403
  fill(20,130,5);
404404
  triangle(x-size*3,y,x,y-size*8,x+size*3,y)
405405
}
406-
```
406+
```
407407

408408
- Draw two trees in your `draw()` function using arguments.
409409

@@ -549,7 +549,7 @@ Here is an [example](https://editor.p5js.org/Msqcoding/sketches/l4Mq4a4HG).
549549

550550
Functions such as `random()` produce, or **return**, values that can be used elsewhere in your code. Here’s an example of a function that adds 5 to its parameter and returns the result:
551551

552-
[The syntax for function declaration that returns the value “ans” with labeled arrows pointing to its various parts. An arrow labeled “keyword ‘function’” points to the word “function”;  an arrow labeled “function name” points to “plus5”; an arrow labeled “parameter” points to the letter “n” within parentheses; the body of the function is labeled “block of code in curly braces” with the code “let ans = n + 5” and “return ans;” on separate lines.](../images/introduction/function-return.jpg)
552+
![The syntax for function declaration that returns the value “ans” with labeled arrows pointing to its various parts. An arrow labeled “keyword ‘function’” points to the word “function”;  an arrow labeled “function name” points to “plus5”; an arrow labeled “parameter” points to the letter “n” within parentheses; the body of the function is labeled “block of code in curly braces” with the code “let ans = n + 5” and “return ans;” on separate lines.](../images/introduction/function-return.jpg)
553553

554554
Similar to other function declarations, the keyword `function` is followed by the function name and a pair of parentheses. This function has one parameter, `n` within the parenthesis. The body of the function includes a numerical expression and **return statement**. The keyword `return` tells functions to finish executing the code block and provide a result as an output value.
555555

src/pages/_utils.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ export const generateJumpToState = async (
377377
category === getExampleCategory(currentEntrySlug)
378378
) {
379379
// Get all entries in the current category
380-
const currentCategoryEntries = localeEntries.filter(
380+
let currentCategoryEntries = localeEntries.filter(
381381
(entry) =>
382382
category ===
383383
(collectionType === "examples"
@@ -386,6 +386,14 @@ export const generateJumpToState = async (
386386
entry.data.category ?? ""),
387387
);
388388

389+
if (collectionType === "tutorials") {
390+
currentCategoryEntries = currentCategoryEntries.sort(
391+
(a, b) =>
392+
((a.data as any).categoryIndex ?? 1000) -
393+
((b.data as any).categoryIndex ?? 1000),
394+
);
395+
}
396+
389397
// Add the entries in the category to the jumpToLinks
390398
categoryLinks.push(
391399
...currentCategoryEntries.map(

0 commit comments

Comments
 (0)