Skip to content

Commit b90e768

Browse files
authored
Merge pull request #5595 from Zearin/issue-5139/io
docs(src/io): Use `describe()` instead of `@alt`
2 parents 34e1f19 + a9bd481 commit b90e768

File tree

4 files changed

+67
-111
lines changed

4 files changed

+67
-111
lines changed

src/io/files.js

Lines changed: 27 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ import '../core/friendly_errors/fes_core';
6969
* ellipse(width / 2, height / 2, earthquakeMag * 10, earthquakeMag * 10);
7070
* textAlign(CENTER);
7171
* text(earthquakeName, 0, height - 30, width, 30);
72+
* describe(`50×50 ellipse that changes from black to white
73+
* depending on the current humidity`);
7274
* }
7375
* </code></div>
7476
*
@@ -85,6 +87,8 @@ import '../core/friendly_errors/fes_core';
8587
*
8688
* function draw() {
8789
* background(200);
90+
* describe(`50×50 ellipse that changes from black to white
91+
* depending on the current humidity`);
8892
* }
8993
*
9094
* function drawEarthquake(earthquakes) {
@@ -96,10 +100,6 @@ import '../core/friendly_errors/fes_core';
96100
* text(earthquakeName, 0, height - 30, width, 30);
97101
* }
98102
* </code></div>
99-
*
100-
* @alt
101-
* 50×50 ellipse that changes from black to white depending on the current humidity
102-
* 50×50 ellipse that changes from black to white depending on the current humidity
103103
*/
104104
/**
105105
* @method loadJSON
@@ -217,6 +217,8 @@ p5.prototype.loadJSON = function(...args) {
217217
* function setup() {
218218
* background(200);
219219
* text(random(result), 10, 10, 80, 80);
220+
* describe(`randomly generated text from a file,
221+
* for example "i smell like butter"`);
220222
* }
221223
* </code></div>
222224
*
@@ -226,17 +228,15 @@ p5.prototype.loadJSON = function(...args) {
226228
* <div><code>
227229
* function setup() {
228230
* loadStrings('assets/test.txt', pickString);
231+
* describe(`randomly generated text from a file,
232+
* for example "i have three feet"`);
229233
* }
230234
*
231235
* function pickString(result) {
232236
* background(200);
233237
* text(random(result), 10, 10, 80, 80);
234238
* }
235239
* </code></div>
236-
*
237-
* @alt
238-
* randomly generated text from a file, for example "i smell like butter"
239-
* randomly generated text from a file, for example "i have three feet"
240240
*/
241241
p5.prototype.loadStrings = function(...args) {
242242
p5._validateParameters('loadStrings', args);
@@ -364,13 +364,11 @@ p5.prototype.loadStrings = function(...args) {
364364
* for (let c = 0; c < table.getColumnCount(); c++) {
365365
* print(table.getString(r, c));
366366
* }
367+
* describe(`randomly generated text from a file,
368+
* for example "i smell like butter"`);
367369
* }
368370
* </code>
369371
* </div>
370-
*
371-
* @alt
372-
* randomly generated text from a file, for example "i smell like butter"
373-
* randomly generated text from a file, for example "i have three feet"
374372
*/
375373
p5.prototype.loadTable = function(path) {
376374
// p5._validateParameters('loadTable', arguments);
@@ -634,16 +632,14 @@ function makeObject(row, headers) {
634632
* let name = children[i].getContent();
635633
* print(id + ', ' + coloring + ', ' + name);
636634
* }
635+
* describe(`no image displayed`);
637636
* }
638637
*
639638
* // Sketch prints:
640639
* // 0, Capra hircus, Goat
641640
* // 1, Panthera pardus, Leopard
642641
* // 2, Equus zebra, Zebra
643642
* </code></div>
644-
*
645-
* @alt
646-
* no image displayed
647643
*/
648644
p5.prototype.loadXML = function(...args) {
649645
const ret = new p5.XML();
@@ -712,11 +708,9 @@ p5.prototype.loadXML = function(...args) {
712708
* for (let i = 0; i < 5; i++) {
713709
* console.log(data.bytes[i].toString(16));
714710
* }
711+
* describe(`no image displayed`);
715712
* }
716713
* </code></div>
717-
*
718-
* @alt
719-
* no image displayed
720714
*/
721715
p5.prototype.loadBytes = function(file, callback, errorCallback) {
722716
const ret = {};
@@ -1434,18 +1428,21 @@ p5.PrintWriter = function(filename, extension) {
14341428
*
14351429
* // Saves the canvas as an image by default
14361430
* save('myCanvas.jpg');
1431+
* describe(`An example for saving a canvas as an image.`);
14371432
* </code></div>
14381433
*
1439-
* <div class="norender"><code>
1434+
* <div class="norender"><code>
14401435
* // Saves p5.Image as an image
14411436
* img = createImage(10, 10);
14421437
* save(img, 'myImage.png');
1438+
* describe(`An example for saving a p5.Image element as an image.`);
14431439
* </code></div>
14441440
*
14451441
* <div class="norender"><code>
14461442
* // Saves p5.Renderer object as an image
14471443
* obj = createGraphics(100, 100);
14481444
* save(obj, 'myObject.png');
1445+
* describe(`An example for saving a p5.Renderer element.`);
14491446
* </code></div>
14501447
*
14511448
* <div class="norender"><code>
@@ -1458,6 +1455,9 @@ p5.PrintWriter = function(filename, extension) {
14581455
*
14591456
* // Tab Separated Values
14601457
* save(myTable, 'myTable.tsv');
1458+
*
1459+
* describe(`An example showing how to save a table in formats of
1460+
* HTML, CSV and TSV.`);
14611461
* </code></div>
14621462
*
14631463
* <div class="norender"><code>
@@ -1468,21 +1468,17 @@ p5.PrintWriter = function(filename, extension) {
14681468
*
14691469
* // Optimizes JSON filesize
14701470
* save(myJSON, 'my.json', true);
1471+
*
1472+
* describe(`An example for saving JSON to a txt file with some extra arguments.`);
14711473
* </code></div>
14721474
*
14731475
* <div class="norender"><code>
14741476
* // Saves array of strings to text file with line breaks after each item
14751477
* let arrayOfStrings = ['a', 'b'];
14761478
* save(arrayOfStrings, 'my.txt');
1479+
* describe(`An example for saving an array of strings to text file
1480+
* with line breaks.`);
14771481
* </code></div>
1478-
*
1479-
* @alt
1480-
* An example for saving a canvas as an image.
1481-
* An example for saving a p5.Image element as an image.
1482-
* An example for saving a p5.Renderer element.
1483-
* An example showing how to save a table in formats of HTML, CSV and TSV.
1484-
* An example for saving JSON to a txt file with some extra arguments.
1485-
* An example for saving an array of strings to text file with line breaks.
14861482
*/
14871483

14881484
p5.prototype.save = function(object, _filename, _options) {
@@ -1556,6 +1552,7 @@ p5.prototype.save = function(object, _filename, _options) {
15561552
* createCanvas(100, 100);
15571553
* background(200);
15581554
* text('click here to save', 10, 10, 70, 80);
1555+
* describe(`no image displayed`);
15591556
* }
15601557
*
15611558
* function mousePressed() {
@@ -1571,9 +1568,6 @@ p5.prototype.save = function(object, _filename, _options) {
15711568
* // "name": "Lion"
15721569
* // }
15731570
* </code></div>
1574-
*
1575-
* @alt
1576-
* no image displayed
15771571
*/
15781572
p5.prototype.saveJSON = function(json, filename, opt) {
15791573
p5._validateParameters('saveJSON', arguments);
@@ -1610,6 +1604,7 @@ p5.prototype.saveJSONArray = p5.prototype.saveJSON;
16101604
* createCanvas(100, 100);
16111605
* background(200);
16121606
* text('click here to save', 10, 10, 70, 80);
1607+
* describe(`no image displayed`);
16131608
* }
16141609
*
16151610
* function mousePressed() {
@@ -1625,9 +1620,6 @@ p5.prototype.saveJSONArray = p5.prototype.saveJSON;
16251620
* // cat
16261621
* // dog
16271622
* </code></div>
1628-
*
1629-
* @alt
1630-
* no image displayed
16311623
*/
16321624
p5.prototype.saveStrings = function(list, filename, extension, isCRLF) {
16331625
p5._validateParameters('saveStrings', arguments);
@@ -1682,15 +1674,14 @@ function escapeHelper(content) {
16821674
*
16831675
* // To save, un-comment next line then click 'run'
16841676
* // saveTable(table, 'new.csv');
1677+
*
1678+
* describe(`no image displayed`);
16851679
* }
16861680
*
16871681
* // Saves the following to a file called 'new.csv':
16881682
* // id,species,name
16891683
* // 0,Panthera leo,Lion
16901684
* </code></div>
1691-
*
1692-
* @alt
1693-
* no image displayed
16941685
*/
16951686
p5.prototype.saveTable = function(table, filename, options) {
16961687
p5._validateParameters('saveTable', arguments);

0 commit comments

Comments
 (0)