Skip to content

Commit ce1b52c

Browse files
authored
Merge pull request #1275 from Gracia-zhang/teach
Teach
2 parents d991945 + dd48482 commit ce1b52c

29 files changed

+29391
-2290
lines changed

.gitattributes

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Set default behaviour to automatically normalize line endings.
2+
* text=auto
3+
4+
# prevents git from converting LF to CRLF, which causes issues
5+
# when assembling example pages on Windows
6+
data/examples/**/*.js eol=lf
7+
8+
# Denote all files that are truly binary and should not be modified.
9+
*.ai binary
10+
*.gif binary
11+
*.ico binary
12+
*.jpg binary
13+
*.mov binary
14+
*.mp3 binary
15+
*.mp4 binary
16+
*.ogg binary
17+
*.ogv binary
18+
*.otf binary
19+
*.pdf binary
20+
*.png binary
21+
*.ttf binary
22+
*.wav binary
23+
*.webm binary
24+
*.zip binary

.github/workflows/update-documentation.yml

+4-14
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ env:
1010

1111
jobs:
1212
build:
13-
name: Update p5.js documentation
13+
name: Update p5.js documentation and library files
1414
runs-on: ubuntu-latest
1515

1616
steps:
@@ -20,28 +20,18 @@ jobs:
2020
uses: actions/setup-node@v1
2121
with:
2222
node-version: 12.x
23-
- name: Extract documentation from the p5.js repo
23+
- name: Extract documentation and library files from the p5.js repo
2424
run: |
2525
npm install
26-
npm run grunt update-enJSON
26+
npm run grunt update-enJSON --target="${{ steps.p5js.outputs.VERSION }}"
2727
- name: Get p5.js release info
2828
id: p5js
2929
run: |
3030
echo ::set-output name=VERSION::${P5JS_REF/refs\/tags\//}
3131
echo ::set-output name=SHA::${P5JS_SHA}
32-
- name: Get latest p5.min.js build
33-
uses: suisei-cn/actions-download-file@v1
34-
with:
35-
url: https://github.com/processing/p5.js/releases/download/${{github.event.client_payload.ref}}/p5.min.js
36-
target: src/assets/js/
37-
- name: Get latest p5.sound.min.js build
38-
uses: suisei-cn/actions-download-file@v1
39-
with:
40-
url: https://github.com/processing/p5.js/releases/download/${{github.event.client_payload.ref}}/p5.sound.min.js
41-
target: src/assets/js/
4232
- name: Commit changes
4333
uses: EndBug/add-and-commit@v4
4434
with:
45-
message: 'Update Reference files for p5.js ${{ steps.p5js.outputs.VERSION }} release (${{ steps.p5js.outputs.SHA }})'
35+
message: 'Update files for p5.js ${{ steps.p5js.outputs.VERSION }} release (${{ steps.p5js.outputs.SHA }})'
4636
env:
4737
GITHUB_TOKEN: ${{ secrets.DOCS_COMMIT_TOKEN }}

Gruntfile.js

+33-19
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,22 @@ module.exports = function(grunt) {
342342
dest: 'p5-reference/'
343343
}
344344
},
345-
htmllint: {
346-
all: {
345+
346+
htmlhint: {
347+
html1: {
348+
options: {
349+
'attr-value-double-quotes': false,
350+
'alt-require': true,
351+
'doctype-first': true,
352+
'title-require': true,
353+
'attr-no-duplication': true,
354+
'input-requires-label': true,
355+
'tags-check': true,
356+
'tagname-lowercase': true,
357+
'tagname-specialchars': true,
358+
'empty-tag-not-self-closed': true,
359+
'id-unique': true
360+
},
347361
src: [
348362
'<%= config.dist %>/**/*.html',
349363
'!<%= config.dist %>/**/CHANGES.html',
@@ -352,20 +366,13 @@ module.exports = function(grunt) {
352366
'!<%= config.dist %>/**/learn/*.html',
353367
'!<%= config.dist %>/**/examples/*.html',
354368
'!<%= config.dist %>/**/reference/assets/index.html'
355-
],
356-
options: {
357-
ignore: [
358-
/^This document appears to be written in English/,
359-
/^Bad value https:/,
360-
/^Consider adding a lang attribute to the html/,
361-
/^Attribute paypalexpress not allowed on element script at this point./
362-
]
363-
}
369+
]
364370
}
365371
},
372+
366373
shell: {
367374
generate_dataJSON: {
368-
command: 'npm ci && npm run grunt yui',
375+
command: `git checkout ${grunt.option('target')} && npm ci && npm run grunt yui build`,
369376
options: {
370377
execOptions: {
371378
cwd: 'tmp/p5.js'
@@ -378,7 +385,7 @@ module.exports = function(grunt) {
378385
grunt.registerTask('update-version', function() {
379386
const done = this.async();
380387

381-
const version = require('./src/templates/pages/reference/data.json').project.version;
388+
const version = grunt.option('target').substring(1);
382389

383390
fs.readFile('./src/data/data.yml')
384391
.then(str => {
@@ -402,7 +409,7 @@ module.exports = function(grunt) {
402409
grunt.loadNpmTasks('grunt-file-append');
403410
grunt.loadNpmTasks('grunt-contrib-compress');
404411
grunt.loadNpmTasks('grunt-contrib-requirejs');
405-
grunt.loadNpmTasks('grunt-html');
412+
grunt.loadNpmTasks('grunt-htmlhint');
406413

407414
// i18n tracking task
408415
grunt.registerTask('i18n', function() {
@@ -436,6 +443,14 @@ module.exports = function(grunt) {
436443
// move the data.json files from the cloned p5.js repository to the p5.js-website repository
437444
fse.moveSync(dataJSON_p5js, dataJSON_p5jswebsite, { overwrite: true });
438445
fse.moveSync(dataJSONmin_p5js, dataJSONmin_p5jswebsite, { overwrite: true });
446+
447+
const p5min_src = 'tmp/p5.js/lib/p5.min.js';
448+
const p5min_dest = 'src/assets/js/p5.min.js';
449+
const p5Soundmin_src = 'tmp/p5.js/lib/addons/p5.sound.min.js';
450+
const p5Soundmin_dest = 'src/assets/js/p5.sound.min.js';
451+
fse.moveSync(p5min_src, p5min_dest, { overwrite: true });
452+
fse.moveSync(p5Soundmin_src, p5Soundmin_dest, { overwrite: true });
453+
439454
// delete the tmp folder that contained the p5.js repository
440455
fse.removeSync('tmp/');
441456
});
@@ -451,8 +466,8 @@ module.exports = function(grunt) {
451466
'clone_p5js_repo',
452467
'generate_dataJSON',
453468
'move_dataJSON',
454-
'generate_enJSON',
455-
// 'json-to-fluent'
469+
'update-version',
470+
'generate_enJSON'
456471
]);
457472

458473
// multi-tasks: collections of other tasks
@@ -476,19 +491,18 @@ module.exports = function(grunt) {
476491

477492
// runs tasks in order
478493
grunt.registerTask('build', [
479-
'update-version',
494+
// 'update-version',
480495
'exec',
481496
'clean',
482497
'requirejs:yuidoc_theme',
483498
'requirejs',
484-
// 'fluent-to-json',
485499
'copy',
486500
'optimize',
487501
'assemble',
488502
'file_append',
489503
'compress',
490504
'i18n',
491-
'htmllint'
505+
'htmlhint'
492506
]);
493507

494508
// runs with just grunt command

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Once added, a steward's username will remain in the [stewards section of the rea
3636
| Language | Steward(s) |
3737
| -------- | ------------------------- |
3838
| Overall |[@Qianqianye](https://github.com/Qianqianye), [@limzykenneth](https://github.com/limzykenneth) |
39-
| Spanish |[@Guirdo](https://github.com/Guirdo), [@Andreu-G](https://github.com/Andreu-G) |
39+
| Spanish |[@Guirdo](https://github.com/Guirdo), [@Andreu-G](https://github.com/Andreu-G), [@dnd-alv](https://github.com/dnd-alv) |
4040
| Chinese | [@unicar9](https://github.com/unicar9), [@Gracia-zhang](https://github.com/Gracia-zhang), [@pentalei](https://github.com/pentalei) |
4141
| Korean | [@yinhwa](https://github.com/yinhwa), [@almchung](https://github.com/almchung), [@jhongover9000](https://github.com/jhongover9000), [@sssueing](https://github.com/sssueing), [@GeryGeryGery](https://github.com/GeryGeryGery), [@sosunnyproject](https://github.com/sosunnyproject) |
4242
| Hindi | [@adarrssh](https://github.com/adarrssh), [@Divyansh013](https://github.com/Divyansh013), [@deepchauhan](https://github.com/deepchauhan), [@SarveshLimaye](https://github.com/SarveshLimaye)|
@@ -46,7 +46,6 @@ Other Language Steward(s):
4646

4747
## Setup
4848

49-
0. Ensure Java is installed. Not installed? Head over to [Java](https://www.oracle.com/java/technologies/downloads/) for installation.
5049
1. Install [node.js](https://nodejs.org/en/download/).
5150
2. Clone this repo by typing ```git clone https://github.com/processing/p5.js-website/``` in terminal.
5251
3. Navigate to the `p5.js-website` directory in the terminal and type `npm install`.

contributor_docs/i18n_contribution.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ The en.json is made up of three sections:
211211
- p5.js documentation, also extracted from the data.json file. This section contains a key for each p5.js Class (i.e., "p5.Color"), which holds information about the Class itself and its Methods and Fields.
212212
In this section, you might find HTML Anchor elements. You only need to translate the text between the two tags. For example, in `<a href=\"#/p5.Color\">p5.Color</a>`, you need to translate the second 'p5.Color' and leave the rest as is.
213213

214-
All the translation swaps of the Reference pages happen is [this function](https://github.com/processing/p5.js-website/blob/main/src/templates/pages/reference/index.hbs#L61).
214+
All the translation swaps of the Reference pages happen in [this function](https://github.com/processing/p5.js-website/blob/main/src/templates/pages/reference/index.hbs#L61).
215215
Any entries in the JSON object which are not filled in will be left in English when the page is loaded.
216216

217217
The translated versions of the JSON file need to be manually created and updated.

i18n-tracking.yml

+12-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
es:
22
src/data/en.yml:
3+
line 883: ' p5.utils'
4+
line 884: ' A set of utilities and additional features for my creative coding class aiming '
5+
line 885: ' to help students.'
36
line 1153: ' 2022-p5js-access-day-date'
47
line 1174: ' 2022-p5js-access-day-advisor'
58
line 1150: ' p5js-community-event-title'
@@ -30,7 +33,6 @@ es:
3033
line 1177: ' 2022-p5js-access-day-tech-support'
3134
line 1178: ' 2022-p5js-access-day-transcriber'
3235
line 1179: ' 2022-p5js-access-day-asl-support'
33-
line 883: ' p5.fab'
3436
line 875: ' no setup required.'
3537
line 871: ' p5.input'
3638
line 872: ' ui'
@@ -650,8 +652,6 @@ es:
650652
line 868: ' Put your p5 sketches in the /src/assets/learn folder of the site, in a'
651653
line 869: ' folder labelled with the name of your sketch as shown in the screenshot.'
652654
line 870: ' This is where all the images and p5 sketches linked by iframe should be'
653-
line 884: ' Styling for the iframe (this could directly into the post or in a'
654-
line 885: ' stylesheet)'
655655
line 886: ' writing-a-tutorial-iframe-7'
656656
line 887: ' writing-a-tutorial-iframe-8'
657657
line 888: ' writing-a-tutorial-iframe-9'
@@ -1839,8 +1839,8 @@ es:
18391839
line 84: ' copyright1'
18401840
hi:
18411841
src/data/en.yml:
1842+
line 883: ' p5.utils'
18421843
line 1153: ' 2022-p5js-access-day-date'
1843-
line 883: ' p5.fab'
18441844
line 26: footer6
18451845
line 25: footer2
18461846
line 27: footer4
@@ -1892,8 +1892,13 @@ hi:
18921892
line 1177: ' 2022-p5js-access-day-tech-support'
18931893
line 1178: ' 2022-p5js-access-day-transcriber'
18941894
line 1179: ' 2022-p5js-access-day-asl-support'
1895+
line 884: ' A set of utilities and additional features for my creative coding class aiming '
1896+
line 885: ' to help students.'
18951897
ko:
18961898
src/data/en.yml:
1899+
line 883: ' p5.utils'
1900+
line 884: ' A set of utilities and additional features for my creative coding class aiming '
1901+
line 885: ' to help students.'
18971902
line 1153: ' 2022-p5js-access-day-date'
18981903
line 1174: ' 2022-p5js-access-day-advisor'
18991904
line 1150: ' p5js-community-event-title'
@@ -1924,7 +1929,6 @@ ko:
19241929
line 1177: ' 2022-p5js-access-day-tech-support'
19251930
line 1178: ' 2022-p5js-access-day-transcriber'
19261931
line 1179: ' 2022-p5js-access-day-asl-support'
1927-
line 883: ' p5.fab'
19281932
line 875: ' no setup required.'
19291933
line 871: ' p5.input'
19301934
line 872: ' ui'
@@ -2544,8 +2548,6 @@ ko:
25442548
line 868: ' Put your p5 sketches in the /src/assets/learn folder of the site, in a'
25452549
line 869: ' folder labelled with the name of your sketch as shown in the screenshot.'
25462550
line 870: ' This is where all the images and p5 sketches linked by iframe should be'
2547-
line 884: ' Styling for the iframe (this could directly into the post or in a'
2548-
line 885: ' stylesheet)'
25492551
line 886: ' writing-a-tutorial-iframe-7'
25502552
line 887: ' writing-a-tutorial-iframe-8'
25512553
line 888: ' writing-a-tutorial-iframe-9'
@@ -3733,6 +3735,9 @@ ko:
37333735
line 84: ' copyright1'
37343736
zh-Hans:
37353737
src/data/en.yml:
3738+
line 883: ' p5.utils'
3739+
line 884: ' A set of utilities and additional features for my creative coding class aiming '
3740+
line 885: ' to help students.'
37363741
line 1153: ' 2022-p5js-access-day-date'
37373742
line 1174: ' 2022-p5js-access-day-advisor'
37383743
line 1150: ' p5js-community-event-title'
@@ -3763,7 +3768,6 @@ zh-Hans:
37633768
line 1177: ' 2022-p5js-access-day-tech-support'
37643769
line 1178: ' 2022-p5js-access-day-transcriber'
37653770
line 1179: ' 2022-p5js-access-day-asl-support'
3766-
line 883: ' p5.fab'
37673771
line 875: ' no setup required.'
37683772
line 871: ' p5.input'
37693773
line 872: ' ui'
@@ -4383,8 +4387,6 @@ zh-Hans:
43834387
line 868: ' Put your p5 sketches in the /src/assets/learn folder of the site, in a'
43844388
line 869: ' folder labelled with the name of your sketch as shown in the screenshot.'
43854389
line 870: ' This is where all the images and p5 sketches linked by iframe should be'
4386-
line 884: ' Styling for the iframe (this could directly into the post or in a'
4387-
line 885: ' stylesheet)'
43884390
line 886: ' writing-a-tutorial-iframe-7'
43894391
line 887: ' writing-a-tutorial-iframe-8'
43904392
line 888: ' writing-a-tutorial-iframe-9'

0 commit comments

Comments
 (0)