extwee 2.3.13 → 2.3.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/Story.js CHANGED
@@ -7,7 +7,7 @@ import { encode } from 'html-entities';
7
7
  const creatorName = 'extwee';
8
8
 
9
9
  // Set the creator version.
10
- const creatorVersion = '2.3.13';
10
+ const creatorVersion = '2.3.15';
11
11
 
12
12
  /**
13
13
  * Story class.
@@ -19,22 +19,22 @@ const creatorVersion = '2.3.13';
19
19
  * @property {string} format - Story format of Story.
20
20
  * @property {string} formatVersion - Story format version of Story.
21
21
  * @property {number} zoom - Zoom level.
22
- * @property {Array} passages - Array of Passage objects. @see {@link Passage}
22
+ * @property {Array} passages - Array of Passage objects. See {@link Passage}.
23
23
  * @property {string} creator - Program used to create Story.
24
24
  * @property {string} creatorVersion - Version used to create Story.
25
25
  * @property {object} metadata - Metadata of Story.
26
26
  * @property {object} tagColors - Tag Colors
27
27
  * @property {string} storyJavaScript - Story JavaScript
28
28
  * @property {string} storyStylesheet - Story Stylesheet
29
- * @method {number} addPassage - Add a passage to the story and returns the new length of the passages array.
30
- * @method {number} removePassageByName - Remove a passage from the story by name and returns the new length of the passages array.
31
- * @method {Array} getPassagesByTag - Find passages by tag.
32
- * @method {Array} getPassageByName - Find passage by name.
33
- * @method {number} size - Size (number of passages).
34
- * @method {string} toJSON - Export Story as JSON representation.
35
- * @method {string} toTwee - Return Twee representation.
36
- * @method {string} toTwine2HTML - Return Twine 2 HTML representation.
37
- * @method {string} toTwine1HTML - Return Twine 1 HTML representation.
29
+ * @function addPassage - Add a passage to the story and returns the new length of the passages array.
30
+ * @function removePassageByName - Remove a passage from the story by name and returns the new length of the passages array.
31
+ * @function getPassagesByTag - Find passages by tag.
32
+ * @function getPassageByName - Find passage by name.
33
+ * @function size - Size (number of passages).
34
+ * @function toJSON - Export Story as JSON representation.
35
+ * @function toTwee - Return Twee representation.
36
+ * @function toTwine2HTML - Return Twine 2 HTML representation.
37
+ * @function toTwine1HTML - Return Twine 1 HTML representation.
38
38
  * @example
39
39
  * const story = new Story('My Story');
40
40
  * story.IFID = '12345678-1234-5678-1234-567812345678';
@@ -148,6 +148,7 @@ class Story {
148
148
  get name () { return this.#_name; }
149
149
 
150
150
  /**
151
+ * Set story name.
151
152
  * @param {string} a - Replacement story name
152
153
  */
153
154
  set name (a) {
@@ -165,13 +166,14 @@ class Story {
165
166
  get tagColors () { return this.#_tagColors; }
166
167
 
167
168
  /**
169
+ * Set tag colors.
168
170
  * @param {object} a - Replacement tag colors
169
171
  */
170
172
  set tagColors (a) {
171
- if (a instanceof Object) {
173
+ if (a !== null && typeof a === 'object' && !Array.isArray(a)) {
172
174
  this.#_tagColors = a;
173
175
  } else {
174
- throw new Error('Tag colors must be an object!');
176
+ throw new Error('Tag colors must be a plain object!');
175
177
  }
176
178
  }
177
179
 
@@ -182,6 +184,7 @@ class Story {
182
184
  get IFID () { return this.#_IFID; }
183
185
 
184
186
  /**
187
+ * Set story IFID.
185
188
  * @param {string} i - Replacement IFID.
186
189
  */
187
190
  set IFID (i) {
@@ -199,6 +202,7 @@ class Story {
199
202
  get start () { return this.#_start; }
200
203
 
201
204
  /**
205
+ * Set start passage name.
202
206
  * @param {string} s - Replacement start
203
207
  */
204
208
  set start (s) {
@@ -216,6 +220,7 @@ class Story {
216
220
  get formatVersion () { return this.#_formatVersion; }
217
221
 
218
222
  /**
223
+ * Set story format version.
219
224
  * @param {string} f - Replacement format version
220
225
  */
221
226
  set formatVersion (f) {
@@ -233,13 +238,14 @@ class Story {
233
238
  get metadata () { return this.#_metadata; }
234
239
 
235
240
  /**
241
+ * Set story metadata.
236
242
  * @param {object} o - Replacement metadata
237
243
  */
238
244
  set metadata (o) {
239
- if (typeof o === 'object') {
245
+ if (o !== null && typeof o === 'object') {
240
246
  this.#_metadata = o;
241
247
  } else {
242
- throw new Error('Story metadata must be Object!');
248
+ throw new Error('Story metadata must be a non-null Object!');
243
249
  }
244
250
  }
245
251
 
@@ -250,6 +256,7 @@ class Story {
250
256
  get format () { return this.#_format; }
251
257
 
252
258
  /**
259
+ * Set story format.
253
260
  * @param {string} f - Replacement format
254
261
  */
255
262
  set format (f) {
@@ -267,6 +274,7 @@ class Story {
267
274
  get creator () { return this.#_creator; }
268
275
 
269
276
  /**
277
+ * Set creator program.
270
278
  * @param {string} c - Creator Program of Story
271
279
  */
272
280
  set creator (c) {
@@ -284,6 +292,7 @@ class Story {
284
292
  get creatorVersion () { return this.#_creatorVersion; }
285
293
 
286
294
  /**
295
+ * Set creator version.
287
296
  * @param {string} c - Version of creator program
288
297
  */
289
298
  set creatorVersion (c) {
@@ -301,14 +310,15 @@ class Story {
301
310
  get zoom () { return this.#_zoom; }
302
311
 
303
312
  /**
313
+ * Set zoom level.
304
314
  * @param {number} n - Replacement zoom level
305
315
  */
306
316
  set zoom (n) {
307
- if (typeof n === 'number') {
317
+ if (typeof n === 'number' && Number.isFinite(n)) {
308
318
  // Parse float with a fixed length and then force into Number
309
319
  this.#_zoom = Number(Number.parseFloat(n).toFixed(2));
310
320
  } else {
311
- throw new Error('Zoom level must be a Number!');
321
+ throw new Error('Zoom level must be a finite Number!');
312
322
  }
313
323
  }
314
324
 
@@ -316,7 +326,7 @@ class Story {
316
326
  * Passages in Story.
317
327
  * @returns {Array} Passages
318
328
  * @property {Array} passages - Passages
319
- */
329
+ */
320
330
  get passages () { return this.#_passages; }
321
331
 
322
332
  /**
@@ -347,6 +357,7 @@ class Story {
347
357
  }
348
358
 
349
359
  /**
360
+ * Set story stylesheet.
350
361
  * @param {string} s - Replacement story stylesheet
351
362
  */
352
363
  set storyStylesheet (s) {
@@ -380,7 +391,7 @@ class Story {
380
391
  /**
381
392
  * Add a passage to the story.
382
393
  * Passing `StoryData` will override story metadata and `StoryTitle` will override story name.
383
- * @method addPassage
394
+ * @function addPassage
384
395
  * @param {Passage} p - Passage to add to Story.
385
396
  * @returns {number} Return new length of passages array.
386
397
  */
@@ -492,7 +503,7 @@ class Story {
492
503
 
493
504
  /**
494
505
  * Remove a passage from the story by name.
495
- * @method removePassageByName
506
+ * @function removePassageByName
496
507
  * @param {string} name - Passage name to remove.
497
508
  * @returns {number} Return new length of passages array.
498
509
  */
@@ -503,7 +514,7 @@ class Story {
503
514
 
504
515
  /**
505
516
  * Find passages by tag.
506
- * @method getPassagesByTag
517
+ * @function getPassagesByTag
507
518
  * @param {string} t - Passage name to search for
508
519
  * @returns {Array} Return array of passages
509
520
  */
@@ -517,7 +528,7 @@ class Story {
517
528
 
518
529
  /**
519
530
  * Find passage by name.
520
- * @method getPassageByName
531
+ * @function getPassageByName
521
532
  * @param {string} name - Passage name to search for
522
533
  * @returns {Passage | null} Return passage or null
523
534
  */
@@ -530,7 +541,7 @@ class Story {
530
541
 
531
542
  /**
532
543
  * Size (number of passages).
533
- * @method size
544
+ * @function size
534
545
  * @returns {number} Return number of passages
535
546
  */
536
547
  size () {
@@ -539,7 +550,7 @@ class Story {
539
550
 
540
551
  /**
541
552
  * Export Story as JSON representation.
542
- * @method toJSON
553
+ * @function toJSON
543
554
  * @returns {string} JSON string.
544
555
  */
545
556
  toJSON () {
@@ -579,8 +590,7 @@ class Story {
579
590
  *
580
591
  * See: Twee 3 Specification
581
592
  * (https://github.com/iftechfoundation/twine-specs/blob/master/twee-3-specification.md)
582
- *
583
- * @method toTwee
593
+ * @function toTwee
584
594
  * @returns {string} Twee String
585
595
  */
586
596
  toTwee () {
@@ -607,7 +617,7 @@ class Story {
607
617
 
608
618
  /**
609
619
  * format: (string) Optional. Maps to <tw-storydata format>.
610
- */
620
+ */
611
621
  // Does format exist?
612
622
  if (this.format !== '') {
613
623
  // Write the existing format.
@@ -706,8 +716,7 @@ class Story {
706
716
  * Because story stylesheet data can be represented as a passage, property value, or both, all approaches are encoded.
707
717
  *
708
718
  * Because story JavaScript can be represented as a passage, property value, or both, all approaches are encoded.
709
- *
710
- * @method toTwine2HTML
719
+ * @function toTwine2HTML
711
720
  * @returns {string} Twine 2 HTML string
712
721
  */
713
722
  toTwine2HTML () {
@@ -852,9 +861,6 @@ class Story {
852
861
  // Filter out passages with tag of 'script'.
853
862
  const scriptPassages = passages.filter((passage) => passage.tags.includes('script'));
854
863
 
855
- // Remove script passages from the main array.
856
- passages = passages.filter(p => !p.tags.includes('script'));
857
-
858
864
  // Were there any script passages?
859
865
  if (scriptPassages.length > 0) {
860
866
  // Start the SCRIPT.
@@ -894,7 +900,7 @@ class Story {
894
900
  // For each tag, generate a <tw-tag> element.
895
901
  tagList.forEach((tag) => {
896
902
  // Add the <tw-tag> element.
897
- storyData += `\t<tw-tag name="${tag}" color="${this.tagColors[tag]}"></tw-tag>\n`;
903
+ storyData += `\t<tw-tag name="${encode(tag)}" color="${encode(String(this.tagColors[tag]))}"></tw-tag>\n`;
898
904
  });
899
905
 
900
906
  // Close the HTML element.
@@ -909,8 +915,7 @@ class Story {
909
915
  *
910
916
  * See: Twine 1 HTML Output
911
917
  * (https://github.com/iftechfoundation/twine-specs/blob/master/twine-1-htmloutput-doc.md)
912
- *
913
- * @method toTwine1HTML
918
+ * @function toTwine1HTML
914
919
  * @returns {string} Twine 1 HTML string.
915
920
  */
916
921
  toTwine1HTML () {
@@ -85,13 +85,13 @@ function parse (contents) {
85
85
  }
86
86
 
87
87
  // Create an object literal
88
- let jsonContent = {};
88
+ let jsonContent;
89
89
 
90
90
  // Attempt to parse the JSON.
91
91
  try {
92
92
  jsonContent = JSON.parse(contents);
93
93
  } catch (error) {
94
- throw new Error(`Error: Unable to parse Twine 2 JSON chunk! ${error.message}`);
94
+ throw new Error(`Error: Unable to parse Twine 2 JSON chunk! ${error.message}`, { cause: error });
95
95
  }
96
96
 
97
97
  /**
@@ -5,9 +5,7 @@ import { valid } from 'semver';
5
5
  *
6
6
  * This class has type checking on all of its properties.
7
7
  * If a property is set to a value of the wrong type, a TypeError will be thrown.
8
- *
9
8
  * @see {@link https://github.com/iftechfoundation/twine-specs/blob/master/twine-2-storyformats-spec.md Twine 2 Story Formats Specification}
10
- *
11
9
  * @class
12
10
  * @classdesc A class representing a Twine 2 story format.
13
11
  * @property {string} name - The name of the story format.
@@ -107,6 +105,7 @@ export default class StoryFormat {
107
105
  get name () { return this.#_name; }
108
106
 
109
107
  /**
108
+ * Set name.
110
109
  * @param {string} n - Replacement name.
111
110
  */
112
111
  set name (n) {
@@ -124,6 +123,7 @@ export default class StoryFormat {
124
123
  get version () { return this.#_version; }
125
124
 
126
125
  /**
126
+ * Set version.
127
127
  * @param {string} n - Replacement version.
128
128
  */
129
129
  set version (n) {
@@ -141,6 +141,7 @@ export default class StoryFormat {
141
141
  get description () { return this.#_description; }
142
142
 
143
143
  /**
144
+ * Set description.
144
145
  * @param {string} d - Replacement description.
145
146
  */
146
147
  set description (d) {
@@ -158,6 +159,7 @@ export default class StoryFormat {
158
159
  get author () { return this.#_author; }
159
160
 
160
161
  /**
162
+ * Set author.
161
163
  * @param {string} a - Replacement author.
162
164
  */
163
165
  set author (a) {
@@ -175,6 +177,7 @@ export default class StoryFormat {
175
177
  get image () { return this.#_image; }
176
178
 
177
179
  /**
180
+ * Set image.
178
181
  * @param {string} i - Replacement image.
179
182
  */
180
183
  set image (i) {
@@ -192,6 +195,7 @@ export default class StoryFormat {
192
195
  get url () { return this.#_url; }
193
196
 
194
197
  /**
198
+ * Set URL.
195
199
  * @param {string} u - Replacement URL.
196
200
  */
197
201
  set url (u) {
@@ -209,6 +213,7 @@ export default class StoryFormat {
209
213
  get license () { return this.#_license; }
210
214
 
211
215
  /**
216
+ * Set license.
212
217
  * @param {string} l - Replacement license.
213
218
  */
214
219
  set license (l) {
@@ -226,6 +231,7 @@ export default class StoryFormat {
226
231
  get proofing () { return this.#_proofing; }
227
232
 
228
233
  /**
234
+ * Set proofing.
229
235
  * @param {boolean} p - Replacement proofing.
230
236
  */
231
237
  set proofing (p) {
@@ -243,6 +249,7 @@ export default class StoryFormat {
243
249
  get source () { return this.#_source; }
244
250
 
245
251
  /**
252
+ * Set source.
246
253
  * @param {string} s - Replacement source.
247
254
  */
248
255
  set source (s) {
@@ -255,7 +262,7 @@ export default class StoryFormat {
255
262
 
256
263
  /**
257
264
  * Produces a string representation of the story format object.
258
- * @method toString
265
+ * @function toString
259
266
  * @returns {string} - A string representation of the story format.
260
267
  */
261
268
  toString() {
@@ -264,7 +271,7 @@ export default class StoryFormat {
264
271
 
265
272
  /**
266
273
  * Produces a JSON representation of the story format object.
267
- * @method toJSON
274
+ * @function toJSON
268
275
  * @returns {object} - A JSON representation of the story format.
269
276
  */
270
277
  toJSON() {
package/src/TWS/parse.js CHANGED
@@ -21,7 +21,7 @@ function parse (binaryFileContents) {
21
21
  const parser = new Parser();
22
22
 
23
23
  // Set default value.
24
- let pythonObject = null;
24
+ let pythonObject;
25
25
 
26
26
  // Does the Buffer contain pickle data?
27
27
  try {
@@ -29,7 +29,7 @@ function parse (binaryFileContents) {
29
29
  pythonObject = parser.parse(binaryFileContents);
30
30
  } catch (error) {
31
31
  // This is a Buffer, but not pickle data.
32
- throw new TypeError(`Error: Buffer does not contain Python pickle data! ${error}`);
32
+ throw new TypeError(`Error: Buffer does not contain Python pickle data! ${error}`, { cause: error });
33
33
  }
34
34
 
35
35
  // Create Story object.
package/src/Twee/parse.js CHANGED
@@ -119,7 +119,7 @@ function parse (fileContents) {
119
119
  throw new Error('Contents not a String');
120
120
  }
121
121
 
122
- let adjusted = '';
122
+ let adjusted;
123
123
 
124
124
  // Check if there are extra content in the files
125
125
  // If so, cut it all out for the parser
@@ -143,8 +143,8 @@ function parse (fileContents) {
143
143
  // Set default values
144
144
  let tags = '';
145
145
  let metadata = '';
146
- let text = '';
147
- let name = '';
146
+ let text;
147
+ let name;
148
148
 
149
149
  // Header is everything to the first newline
150
150
  let header = passage.slice(0, passage.indexOf('\n'));
@@ -21,36 +21,36 @@ function compile (story, engine = '', header = '', name = '', codeJS = '', confi
21
21
  }
22
22
 
23
23
  // Replace the "VERSION" with story.creator.
24
- header = header.replaceAll(/"VERSION"/gm, story.creator);
24
+ header = header.replaceAll(/"VERSION"/gm, () => story.creator);
25
25
 
26
26
  // Replace the "TIME" with new Date().
27
- header = header.replaceAll(/"TIME"/gm, new Date());
27
+ header = header.replaceAll(/"TIME"/gm, () => String(new Date()));
28
28
 
29
29
  // Replace the ENGINE with `engine.js` code.
30
- header = header.replaceAll(/"ENGINE"/gm, engine);
30
+ header = header.replaceAll(/"ENGINE"/gm, () => engine);
31
31
 
32
32
  // Replace the NAME (e.g. "JONAH") with `engine.js` code.
33
- header = header.replaceAll(`"${name.toUpperCase()}"`, codeJS);
33
+ header = header.replaceAll(`"${name.toUpperCase()}"`, () => codeJS);
34
34
 
35
35
  // Replace "STORY_SIZE".
36
- header = header.replaceAll(/"STORY_SIZE"/gm, `"${story.size()}"`);
36
+ header = header.replaceAll(/"STORY_SIZE"/gm, () => `"${story.size()}"`);
37
37
 
38
38
  // Replace "STORY" with Twine 1 HTML.
39
- header = header.replaceAll(/"STORY"/gm, story.toTwine1HTML());
39
+ header = header.replaceAll(/"STORY"/gm, () => story.toTwine1HTML());
40
40
 
41
41
  // Replace START_AT with ''.
42
- header = header.replaceAll(/"START_AT"/gm, '\'\'');
42
+ header = header.replaceAll(/"START_AT"/gm, () => '\'\'');
43
43
 
44
44
  // Does 'jquery' exist?
45
45
  if (Object.prototype.hasOwnProperty.call(config, 'jquery')) {
46
46
  // Replace JQUERY with jQuery.
47
- header = header.replaceAll(/"JQUERY"/gm, config.jquery);
47
+ header = header.replaceAll(/"JQUERY"/gm, () => config.jquery);
48
48
  }
49
49
 
50
50
  // Does 'modernizr' exist?
51
51
  if (Object.prototype.hasOwnProperty.call(config, 'modernizr')) {
52
52
  // Replace "MODERNIZR" with Modernizr.
53
- header = header.replaceAll(/"MODERNIZR"/gm, config.modernizr);
53
+ header = header.replaceAll(/"MODERNIZR"/gm, () => config.modernizr);
54
54
  }
55
55
 
56
56
  // Return code.
@@ -1,40 +1,40 @@
1
1
  /**
2
- * Passage class.
3
- * @class
4
- * @classdesc Represents a passage in a Twine story.
5
- * @property {string} name - Name of the passage.
6
- * @property {Array} tags - Tags for the passage.
7
- * @property {object} metadata - Metadata for the passage.
8
- * @property {string} text - Text content of the passage.
9
- * @method {string} toTwee - Return a Twee representation.
10
- * @method {string} toJSON - Return JSON representation.
11
- * @method {string} toTwine2HTML - Return Twine 2 HTML representation.
12
- * @method {string} toTwine1HTML - Return Twine 1 HTML representation.
13
- * @example
14
- * const p = new Passage('Start', 'This is the start of the story.');
15
- * console.log(p.toTwee());
16
- * // :: Start
17
- * // This is the start of the story.
18
- * //
19
- * console.log(p.toJSON());
20
- * // {"name":"Start","tags":[],"metadata":{},"text":"This is the start of the story."}
21
- * console.log(p.toTwine2HTML());
22
- * // <tw-passagedata pid="1" name="Start" tags="" >This is the start of the story.</tw-passagedata>
23
- * console.log(p.toTwine1HTML());
24
- * // <div tiddler="Start" tags="" modifier="extwee" twine-position="10,10">This is the start of the story.</div>
25
- * @example
26
- * const p = new Passage('Start', 'This is the start of the story.', ['start', 'beginning'], {position: '10,10', size: '100,100'});
27
- * console.log(p.toTwee());
28
- * // :: Start [start beginning] {"position":"10,10","size":"100,100"}
29
- * // This is the start of the story.
30
- * //
31
- * console.log(p.toJSON());
32
- * // {"name":"Start","tags":["start","beginning"],"metadata":{"position":"10,10","size":"100,100"},"text":"This is the start of the story."}
33
- * console.log(p.toTwine2HTML());
34
- * // <tw-passagedata pid="1" name="Start" tags="start beginning" position="10,10" size="100,100">This is the start of the story.</tw-passagedata>
35
- * console.log(p.toTwine1HTML());
36
- * // <div tiddler="Start" tags="start beginning" modifier="extwee" twine-position="10,10">This is the start of the story.</div>
37
- */
2
+ * Passage class.
3
+ * @class
4
+ * @classdesc Represents a passage in a Twine story.
5
+ * @property {string} name - Name of the passage.
6
+ * @property {Array} tags - Tags for the passage.
7
+ * @property {object} metadata - Metadata for the passage.
8
+ * @property {string} text - Text content of the passage.
9
+ * @function toTwee - Return a Twee representation.
10
+ * @function toJSON - Return JSON representation.
11
+ * @function toTwine2HTML - Return Twine 2 HTML representation.
12
+ * @function toTwine1HTML - Return Twine 1 HTML representation.
13
+ * @example
14
+ * const p = new Passage('Start', 'This is the start of the story.');
15
+ * console.log(p.toTwee());
16
+ * // :: Start
17
+ * // This is the start of the story.
18
+ * //
19
+ * console.log(p.toJSON());
20
+ * // {"name":"Start","tags":[],"metadata":{},"text":"This is the start of the story."}
21
+ * console.log(p.toTwine2HTML());
22
+ * // <tw-passagedata pid="1" name="Start" tags="" >This is the start of the story.</tw-passagedata>
23
+ * console.log(p.toTwine1HTML());
24
+ * // <div tiddler="Start" tags="" modifier="extwee" twine-position="10,10">This is the start of the story.</div>
25
+ * @example
26
+ * const p = new Passage('Start', 'This is the start of the story.', ['start', 'beginning'], {position: '10,10', size: '100,100'});
27
+ * console.log(p.toTwee());
28
+ * // :: Start [start beginning] {"position":"10,10","size":"100,100"}
29
+ * // This is the start of the story.
30
+ * //
31
+ * console.log(p.toJSON());
32
+ * // {"name":"Start","tags":["start","beginning"],"metadata":{"position":"10,10","size":"100,100"},"text":"This is the start of the story."}
33
+ * console.log(p.toTwine2HTML());
34
+ * // <tw-passagedata pid="1" name="Start" tags="start beginning" position="10,10" size="100,100">This is the start of the story.</tw-passagedata>
35
+ * console.log(p.toTwine1HTML());
36
+ * // <div tiddler="Start" tags="start beginning" modifier="extwee" twine-position="10,10">This is the start of the story.</div>
37
+ */
38
38
  export default class Passage {
39
39
  /**
40
40
  * Create a passage.
@@ -45,6 +45,7 @@ export default class Passage {
45
45
  */
46
46
  constructor(name?: string, text?: string, tags?: any[], metadata?: object);
47
47
  /**
48
+ * Set passage name.
48
49
  * @param {string} s - Name to replace
49
50
  * @throws {Error} Name must be a String!
50
51
  */
@@ -55,6 +56,7 @@ export default class Passage {
55
56
  */
56
57
  get name(): string;
57
58
  /**
59
+ * Set passage tags.
58
60
  * @param {Array} t - Replacement array
59
61
  * @throws {Error} Tags must be an array!
60
62
  */
@@ -65,6 +67,7 @@ export default class Passage {
65
67
  */
66
68
  get tags(): any[];
67
69
  /**
70
+ * Set passage metadata.
68
71
  * @param {object} m - Replacement object
69
72
  * @throws {Error} Metadata must be an object literal!
70
73
  */
@@ -75,6 +78,7 @@ export default class Passage {
75
78
  */
76
79
  get metadata(): object;
77
80
  /**
81
+ * Set passage text.
78
82
  * @param {string} t - Replacement text
79
83
  * @throws {Error} Text should be a String!
80
84
  */
@@ -88,28 +92,27 @@ export default class Passage {
88
92
  * Return a Twee representation.
89
93
  *
90
94
  * See: https://github.com/iftechfoundation/twine-specs/blob/master/twee-3-specification.md
91
- *
92
- * @method toTwee
95
+ * @function toTwee
93
96
  * @returns {string} String form of passage.
94
97
  */
95
98
  toTwee(): string;
96
99
  /**
97
100
  * Return JSON representation.
98
- * @method toJSON
101
+ * @function toJSON
99
102
  * @returns {string} JSON string.
100
103
  */
101
104
  toJSON(): string;
102
105
  /**
103
106
  * Return Twine 2 HTML representation.
104
107
  * (Default Passage ID is 1.)
105
- * @method toTwine2HTML
108
+ * @function toTwine2HTML
106
109
  * @param {number} pid - Passage ID (PID) to record in HTML.
107
110
  * @returns {string} Twine 2 HTML string.
108
111
  */
109
112
  toTwine2HTML(pid?: number): string;
110
113
  /**
111
114
  * Return Twine 1 HTML representation.
112
- * @method toTwine1HTML
115
+ * @function toTwine1HTML
113
116
  * @returns {string} Twine 1 HTML string.
114
117
  */
115
118
  toTwine1HTML(): string;