Skip to content

Commit b724740

Browse files
Merge pull request #1 from processing/master
sync my fork with upstream repo
2 parents 44cbae5 + 686a37f commit b724740

File tree

159 files changed

+5333
-2954
lines changed

Some content is hidden

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

159 files changed

+5333
-2954
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"allowAfterThis": true,
4343
"allowAfterSuper": true
4444
}
45-
]
45+
],
4646
"no-unused-vars": ["error", { "args": "none" }],
4747
"no-empty": ["error", { "allowEmptyCatch": true }],
4848
"no-console": "off"

.github/issue_template.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
**Actual Behaviour**
2+
3+
<!--Please state here what is currently happening.-->
4+
5+
**Expected Behaviour**
6+
7+
<!--State here what the feature should enable the user to do.-->
8+
9+
**Steps to reproduce it**
10+
11+
<!--Add steps to reproduce bugs or add information on the place where the feature should be implemented. Add links to a sample deployment or code.-->
12+
13+
**Screenshots of the issue**
14+
15+
<!--Where-ever possible attach a screenshot of the issue.-->
16+
17+
**Would you like to work on the issue?**
18+
19+
<!--Please let us know if you can work on it or the issue should be assigned to someone else.-->

.github/pull_request_template.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Fixes #[Add issue number here]
2+
3+
Changes:
4+
<!-- Add here what changes were made in this pull request and if possible provide links showcasing the changes. -->
5+
6+
7+
Screenshots of the change:
8+
<!-- Add screenshots depicting the changes. -->

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ src/offline-reference
2929
dist/*
3030
!dist/git-pull.php
3131
!dist/download/release.php
32+
!dist/books/media.zip
33+
!dist/learn/books/media.zip

Gruntfile.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
// use this if you want to match all subfolders:
77
// '<%= config.src %>/templates/pages/**/*.hbs'
88

9+
const yaml = require('js-yaml');
10+
const fs = require('fs').promises;
911
const pkg = require('./package.json');
1012

1113
module.exports = function(grunt) {
@@ -286,6 +288,8 @@ module.exports = function(grunt) {
286288
'<%= config.dist %>/**/*.*',
287289
'!<%= config.dist %>/download/release.php',
288290
'!<%= config.dist %>/git-pull.php',
291+
'!<%= config.dist %>/books/media.zip',
292+
'!<%= config.dist %>/learn/books/media.zip',
289293
'<%= config.src %>/offline-reference/**/*.*'
290294
]
291295
},
@@ -315,6 +319,23 @@ module.exports = function(grunt) {
315319
}
316320
});
317321

322+
grunt.registerTask('update-version', function(){
323+
const done = this.async();
324+
325+
const version = require('./src/templates/pages/reference/data.json').project.version;
326+
327+
fs.readFile('./src/data/data.yml').then((str) => {
328+
const data = yaml.safeLoad(str);
329+
data.version = version;
330+
331+
const dump = yaml.safeDump(data);
332+
333+
return fs.writeFile('./src/data/data.yml', dump);
334+
}).then(() => {
335+
done();
336+
});
337+
});
338+
318339
grunt.loadNpmTasks('grunt-exec');
319340
grunt.loadNpmTasks('grunt-assemble');
320341
grunt.loadNpmTasks('grunt-file-append');
@@ -349,6 +370,7 @@ module.exports = function(grunt) {
349370

350371
// runs three tasks in order
351372
grunt.registerTask('build', [
373+
'update-version',
352374
'exec',
353375
'clean',
354376
'requirejs',

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ We recognize all types of contributions. This project follows the [all-contribut
1515
0. Install [node.js](https://nodejs.org/en/download/).
1616
1. Download this repo as a [zip file](https://github.com/processing/p5.js-website/archive/master.zip) or [clone this repository](https://help.github.com/articles/cloning-a-repository/).
1717
2. Navigate to the `p5.js-website` directory in the terminal and type `npm install`.
18-
3. Copy `dist\download\version-sample.json` to `dist\download\version.json`.
1918

2019
## Running
2120

@@ -32,7 +31,7 @@ Once you've setup the site, type `npm run watch` to run the website. This should
3231
* `layouts/` – default.hbs is main page template
3332
* `pages/` – Contains each of the pages of the p5 site, these get inserted in `{{> body }}` tag of default layout.
3433
* `partials/` – These are reusable pieces that can get added to any page or layout, they correspond to other `{{> filename }}` tags in the pages or default layout.
35-
* `dist/` – Where the rendered files are stored, this can be placed directly online.
34+
* `dist/` – Where the rendered files are stored, this gets generated via `grunt server` but does not get added to pull requests as it is auto-built online.
3635
* `Gruntfile.js` – This file contains all the tasks for using assemble and YAML to generate the final, static site. It uses the taskrunner [grunt](http://gruntjs.com/).
3736

3837
## Tools

contributor_docs/Adding_examples.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Adding examples
2+
3+
Examples help demonstrate different programming concepts and functionality of the library. They can be found on the [p5.js examples page](http://p5js.org/examples/), and run on the page, allowing people to edit and play with them. We are in the process of porting [examples](https://processing.org/examples/) from the Processing site, as well as creating new ones, and would love your help. Below are the steps below to add examples to p5js.org.
4+
5+
## Getting started
6+
7+
0. If you are not yet familiar with GitHub we recommend checking out this [tutorial](https://guides.github.com/activities/hello-world/).
8+
1. Install [node.js](https://nodejs.org/en/), which also automatically installs the npm package manager.
9+
2. [Fork](https://help.github.com/articles/fork-a-repo/) the [p5.js-website](https://github.com/processing/p5.js-website) repository into your own GitHub account.
10+
3. [Clone](https://help.github.com/articles/cloning-a-repository/) your new fork of the repository from GitHub onto your local computer.
11+
4. Using the command line, navigate to the `src/data/examples/build_examples` folder, and install all its necessary dependencies with npm.
12+
13+
```bash
14+
cd src/data/examples/build_examples
15+
npm install
16+
```
17+
18+
## Make an issue
19+
20+
1. Open a new issue on the [p5.js-website repository](https://github.com/processing/p5.js-website/issues) listing the examples you are creating with your name, so efforts aren't duplicated.
21+
22+
23+
## Create your example
24+
25+
1. First, build and test the example code using your own HTML file, linking to the most recent version of p5.js. You can find examples to port here.
26+
* Please use two spaces tabs and see this code style guide.
27+
* Examples should typically be 710px wide, and a recommended height is 400px. You can modify these dimensions (especially the height) as appropriate.
28+
29+
2. At the top of the JS file you create, add a heading using the template below.
30+
* The @name field determines the title of the example and the text of it's corresponding link on the examples page.
31+
* The @frame field determines the dimensions of the example frame on the page. If you leave this field out, your running example will default to the size you set with createCanvas(). If you'd like to specify an alternate size (maybe because you have elements outside the canvas, for example), include the @frame line with dimensions separated by comma.
32+
33+
```jsdoc
34+
/*
35+
* @name Your Example Name Here (This shows up on the examples page as well.)
36+
* @frame 710,400 (optional)
37+
* @description Write a description of your example here. This gets displayed
38+
* on the page underneath your example. You can use <br><br> to add a line
39+
* break. Please limit lines to 80 columns (total characters) long.
40+
*/
41+
```
42+
43+
## Add your example to p5js.org
44+
45+
1. Place the JS file with your code and heading (do not include the HTML or p5.js files) in `src/data/examples/en/` of your local repository.
46+
* The subfolder the file is placed in determines the topic heading the examples displays under on [p5js.org/examples](https://p5js.org/examples/). Add your file into the appropriate folder, or create a new one if necessary.
47+
* If you create a new folder, you will also need to add the folder name to the `examples` section in the `src/data/en.yml`, `src/data/es.yml`, and `src/data/zh-Hans.yml` files in order for the headings to show up properly.
48+
* The filename should follow the format: `XX_name_of_your_example.js`. The XX_ prefix (starting with 00) indicates the order that the files will show up on the page.
49+
50+
2. Place duplicate copies of the file in the corresponding folders in `src/data/examples/es/`, and `src/data/examples/zh-Hans/`. This allows us to build the Spanish and Chinese versions of the example. If you know either of these languages, feel free to translate the heading text and comments.
51+
52+
3. If you have any extra files that need to be included (images, JSON, etc), place them in the `src/data/examples/assets` folder. Try to keep these files small.
53+
54+
4. [Grunt](https://gruntjs.com/) should now be installed, and you can use it to build the website by navigating to the top level directory and typing:
55+
56+
```bash
57+
grunt server
58+
```
59+
60+
5. A local build of the p5js.org site should open in your web browser and you can navigate to the examples page to see your changes.
61+
62+
6. Once everything is ready, submit your changes as a [pull request](https://help.github.com/articles/creating-a-pull-request/).
63+
64+
## Notes about translating examples
65+
66+
* The [p5js.org/examples](https://p5js.org/examples/) page is built from the data in [src/data/](https://github.com/processing/p5.js-website/tree/master/src/data).
67+
* Within the examples folder, there is a folder for each of the three languages we currently support: `en/`, `es/`, and `zh-Hans/`.
68+
* Translations for the topic headers on the example index page are done in the YML files `src/data/*.yml`.
69+
70+
## To add examples
71+
72+
1. Locate the JS file within `src/data/examples` that corresponds to the example you want to add a translation for.
73+
2. Translate the heading and comments. Do not change variable or function names. Do not change the filename.
74+
3. To update a category heading on [p5js.org/examples](https://p5js.org/examples/), edit the YML files at `src/data/*.yml`.
75+
76+
## When adding a new example
77+
78+
1. First add an English version of the file to the `en/` folder, then make sure it is duplicated in the same place in all other languages, then translate for whichever languages you can.
79+
2. The folder, file, and numbering structure should match exactly between the different languages. Do not change the filenames. The text for the example name, description, and source code are all in the `.js` files in the folders.
80+
3. If you have created a new folder, add entries to the "Examples" section of each of the YML files `src/data/*.yml` with the foldername as the key.
81+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Chinese Translation Glossary Links
2+
3+
## Below are compiled glossary links to be followed when translating anything on the website into Chinese
4+
5+
## Simplified Chinese
6+
* Main Glossary - [https://docs.google.com/spreadsheets/d/1yowXBskrVbCCrKtCRel3LTta_t3oXJN_RkK4AOchLGM/edit?usp=sharing](https://docs.google.com/spreadsheets/d/1yowXBskrVbCCrKtCRel3LTta_t3oXJN_RkK4AOchLGM/edit#gid=0)
7+
* Secondary Glossaries:
8+
* [http://www.runoob.com/w3cnote/common-english-terminology-in-programming.html](http://www.runoob.com/w3cnote/common-english-terminology-in-programming.html)
9+
* [https://wenku.baidu.com/view/6f2fca22bcd126fff7050ba5.html](https://wenku.baidu.com/view/6f2fca22bcd126fff7050ba5.html)
10+
* [https://www.kancloud.cn/haixu926611/study-english/112097](https://www.kancloud.cn/haixu926611/study-english/112097)
11+
* Secondary source (MDN Simplified Chinese documentation) - [https://developer.mozilla.org/zh-CN/](https://developer.mozilla.org/zh-CN/)
12+
13+
Any terms relating to programming concepts or technical concepts must be referenced first with the Main Glossary to find the preferred translation for said term. If a term cannot be found in the Main Glossary and is a HTML/CSS/Javascript related term, it should be looked up on MDN Simplified Chinese documentation. Any other terms can be looked up from the secondary glossaries or by search engine, prioritizing commonly used translation in Simplified Chinese.
14+
15+
Open a new issue if the Main Glossary should be changed or added to.
16+
17+
## Traditional Chinese
18+
19+
Pending

0 commit comments

Comments
 (0)