extwee 2.3.14 → 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/CHANGELOG.md +8 -0
- package/build/extwee.core.min.js +1 -1
- package/build/extwee.twine1html.min.js +1 -1
- package/build/extwee.twine2archive.min.js +1 -1
- package/build/extwee.tws.min.js +1 -1
- package/logs/arrays.html +79 -0
- package/logs/arrays.twee +64 -0
- package/logs/example.html +47 -0
- package/logs/fixing.js +23 -0
- package/logs/format-fixed.js +8 -0
- package/logs/format.js +8 -0
- package/logs/test-entities.cjs +40 -0
- package/package.json +23 -23
- package/src/CLI/ProcessConfig/loadStoryFormat.js +8 -0
- package/src/CLI/ProcessConfig/readDirectories.js +1 -3
- package/src/Config/parser.js +6 -6
- package/src/Config/reader.js +2 -2
- package/src/JSON/parse.js +2 -2
- package/src/Passage.js +44 -41
- package/src/Story.js +40 -35
- package/src/StoryFormat/parse.js +2 -2
- package/src/StoryFormat.js +11 -4
- package/src/TWS/parse.js +2 -2
- package/src/Twee/parse.js +3 -3
- package/src/Twine1HTML/compile.js +9 -9
- package/types/src/Passage.d.ts +44 -41
- package/types/src/Story.d.ts +32 -24
- package/types/src/StoryFormat.d.ts +11 -4
package/src/StoryFormat.js
CHANGED
|
@@ -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
|
-
* @
|
|
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
|
-
* @
|
|
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
|
|
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.
|
package/types/src/Passage.d.ts
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
* @
|
|
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
|
-
* @
|
|
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
|
-
* @
|
|
115
|
+
* @function toTwine1HTML
|
|
113
116
|
* @returns {string} Twine 1 HTML string.
|
|
114
117
|
*/
|
|
115
118
|
toTwine1HTML(): string;
|
package/types/src/Story.d.ts
CHANGED
|
@@ -8,22 +8,22 @@
|
|
|
8
8
|
* @property {string} format - Story format of Story.
|
|
9
9
|
* @property {string} formatVersion - Story format version of Story.
|
|
10
10
|
* @property {number} zoom - Zoom level.
|
|
11
|
-
* @property {Array} passages - Array of Passage objects.
|
|
11
|
+
* @property {Array} passages - Array of Passage objects. See {@link Passage}.
|
|
12
12
|
* @property {string} creator - Program used to create Story.
|
|
13
13
|
* @property {string} creatorVersion - Version used to create Story.
|
|
14
14
|
* @property {object} metadata - Metadata of Story.
|
|
15
15
|
* @property {object} tagColors - Tag Colors
|
|
16
16
|
* @property {string} storyJavaScript - Story JavaScript
|
|
17
17
|
* @property {string} storyStylesheet - Story Stylesheet
|
|
18
|
-
* @
|
|
19
|
-
* @
|
|
20
|
-
* @
|
|
21
|
-
* @
|
|
22
|
-
* @
|
|
23
|
-
* @
|
|
24
|
-
* @
|
|
25
|
-
* @
|
|
26
|
-
* @
|
|
18
|
+
* @function addPassage - Add a passage to the story and returns the new length of the passages array.
|
|
19
|
+
* @function removePassageByName - Remove a passage from the story by name and returns the new length of the passages array.
|
|
20
|
+
* @function getPassagesByTag - Find passages by tag.
|
|
21
|
+
* @function getPassageByName - Find passage by name.
|
|
22
|
+
* @function size - Size (number of passages).
|
|
23
|
+
* @function toJSON - Export Story as JSON representation.
|
|
24
|
+
* @function toTwee - Return Twee representation.
|
|
25
|
+
* @function toTwine2HTML - Return Twine 2 HTML representation.
|
|
26
|
+
* @function toTwine1HTML - Return Twine 1 HTML representation.
|
|
27
27
|
* @example
|
|
28
28
|
* const story = new Story('My Story');
|
|
29
29
|
* story.IFID = '12345678-1234-5678-1234-567812345678';
|
|
@@ -41,6 +41,7 @@ export class Story {
|
|
|
41
41
|
*/
|
|
42
42
|
constructor(name?: string);
|
|
43
43
|
/**
|
|
44
|
+
* Set story name.
|
|
44
45
|
* @param {string} a - Replacement story name
|
|
45
46
|
*/
|
|
46
47
|
set name(a: string);
|
|
@@ -50,6 +51,7 @@ export class Story {
|
|
|
50
51
|
*/
|
|
51
52
|
get name(): string;
|
|
52
53
|
/**
|
|
54
|
+
* Set tag colors.
|
|
53
55
|
* @param {object} a - Replacement tag colors
|
|
54
56
|
*/
|
|
55
57
|
set tagColors(a: object);
|
|
@@ -59,6 +61,7 @@ export class Story {
|
|
|
59
61
|
*/
|
|
60
62
|
get tagColors(): object;
|
|
61
63
|
/**
|
|
64
|
+
* Set story IFID.
|
|
62
65
|
* @param {string} i - Replacement IFID.
|
|
63
66
|
*/
|
|
64
67
|
set IFID(i: string);
|
|
@@ -68,6 +71,7 @@ export class Story {
|
|
|
68
71
|
*/
|
|
69
72
|
get IFID(): string;
|
|
70
73
|
/**
|
|
74
|
+
* Set start passage name.
|
|
71
75
|
* @param {string} s - Replacement start
|
|
72
76
|
*/
|
|
73
77
|
set start(s: string);
|
|
@@ -77,6 +81,7 @@ export class Story {
|
|
|
77
81
|
*/
|
|
78
82
|
get start(): string;
|
|
79
83
|
/**
|
|
84
|
+
* Set story format version.
|
|
80
85
|
* @param {string} f - Replacement format version
|
|
81
86
|
*/
|
|
82
87
|
set formatVersion(f: string);
|
|
@@ -86,6 +91,7 @@ export class Story {
|
|
|
86
91
|
*/
|
|
87
92
|
get formatVersion(): string;
|
|
88
93
|
/**
|
|
94
|
+
* Set story metadata.
|
|
89
95
|
* @param {object} o - Replacement metadata
|
|
90
96
|
*/
|
|
91
97
|
set metadata(o: object);
|
|
@@ -95,6 +101,7 @@ export class Story {
|
|
|
95
101
|
*/
|
|
96
102
|
get metadata(): object;
|
|
97
103
|
/**
|
|
104
|
+
* Set story format.
|
|
98
105
|
* @param {string} f - Replacement format
|
|
99
106
|
*/
|
|
100
107
|
set format(f: string);
|
|
@@ -104,6 +111,7 @@ export class Story {
|
|
|
104
111
|
*/
|
|
105
112
|
get format(): string;
|
|
106
113
|
/**
|
|
114
|
+
* Set creator program.
|
|
107
115
|
* @param {string} c - Creator Program of Story
|
|
108
116
|
*/
|
|
109
117
|
set creator(c: string);
|
|
@@ -113,6 +121,7 @@ export class Story {
|
|
|
113
121
|
*/
|
|
114
122
|
get creator(): string;
|
|
115
123
|
/**
|
|
124
|
+
* Set creator version.
|
|
116
125
|
* @param {string} c - Version of creator program
|
|
117
126
|
*/
|
|
118
127
|
set creatorVersion(c: string);
|
|
@@ -122,6 +131,7 @@ export class Story {
|
|
|
122
131
|
*/
|
|
123
132
|
get creatorVersion(): string;
|
|
124
133
|
/**
|
|
134
|
+
* Set zoom level.
|
|
125
135
|
* @param {number} n - Replacement zoom level
|
|
126
136
|
*/
|
|
127
137
|
set zoom(n: number);
|
|
@@ -142,9 +152,10 @@ export class Story {
|
|
|
142
152
|
* Passages in Story.
|
|
143
153
|
* @returns {Array} Passages
|
|
144
154
|
* @property {Array} passages - Passages
|
|
145
|
-
|
|
155
|
+
*/
|
|
146
156
|
get passages(): any[];
|
|
147
157
|
/**
|
|
158
|
+
* Set story stylesheet.
|
|
148
159
|
* @param {string} s - Replacement story stylesheet
|
|
149
160
|
*/
|
|
150
161
|
set storyStylesheet(s: string);
|
|
@@ -166,41 +177,41 @@ export class Story {
|
|
|
166
177
|
/**
|
|
167
178
|
* Add a passage to the story.
|
|
168
179
|
* Passing `StoryData` will override story metadata and `StoryTitle` will override story name.
|
|
169
|
-
* @
|
|
180
|
+
* @function addPassage
|
|
170
181
|
* @param {Passage} p - Passage to add to Story.
|
|
171
182
|
* @returns {number} Return new length of passages array.
|
|
172
183
|
*/
|
|
173
184
|
addPassage(p: Passage): number;
|
|
174
185
|
/**
|
|
175
186
|
* Remove a passage from the story by name.
|
|
176
|
-
* @
|
|
187
|
+
* @function removePassageByName
|
|
177
188
|
* @param {string} name - Passage name to remove.
|
|
178
189
|
* @returns {number} Return new length of passages array.
|
|
179
190
|
*/
|
|
180
191
|
removePassageByName(name: string): number;
|
|
181
192
|
/**
|
|
182
193
|
* Find passages by tag.
|
|
183
|
-
* @
|
|
194
|
+
* @function getPassagesByTag
|
|
184
195
|
* @param {string} t - Passage name to search for
|
|
185
196
|
* @returns {Array} Return array of passages
|
|
186
197
|
*/
|
|
187
198
|
getPassagesByTag(t: string): any[];
|
|
188
199
|
/**
|
|
189
200
|
* Find passage by name.
|
|
190
|
-
* @
|
|
201
|
+
* @function getPassageByName
|
|
191
202
|
* @param {string} name - Passage name to search for
|
|
192
203
|
* @returns {Passage | null} Return passage or null
|
|
193
204
|
*/
|
|
194
205
|
getPassageByName(name: string): Passage | null;
|
|
195
206
|
/**
|
|
196
207
|
* Size (number of passages).
|
|
197
|
-
* @
|
|
208
|
+
* @function size
|
|
198
209
|
* @returns {number} Return number of passages
|
|
199
210
|
*/
|
|
200
211
|
size(): number;
|
|
201
212
|
/**
|
|
202
213
|
* Export Story as JSON representation.
|
|
203
|
-
* @
|
|
214
|
+
* @function toJSON
|
|
204
215
|
* @returns {string} JSON string.
|
|
205
216
|
*/
|
|
206
217
|
toJSON(): string;
|
|
@@ -209,8 +220,7 @@ export class Story {
|
|
|
209
220
|
*
|
|
210
221
|
* See: Twee 3 Specification
|
|
211
222
|
* (https://github.com/iftechfoundation/twine-specs/blob/master/twee-3-specification.md)
|
|
212
|
-
*
|
|
213
|
-
* @method toTwee
|
|
223
|
+
* @function toTwee
|
|
214
224
|
* @returns {string} Twee String
|
|
215
225
|
*/
|
|
216
226
|
toTwee(): string;
|
|
@@ -233,8 +243,7 @@ export class Story {
|
|
|
233
243
|
* Because story stylesheet data can be represented as a passage, property value, or both, all approaches are encoded.
|
|
234
244
|
*
|
|
235
245
|
* Because story JavaScript can be represented as a passage, property value, or both, all approaches are encoded.
|
|
236
|
-
*
|
|
237
|
-
* @method toTwine2HTML
|
|
246
|
+
* @function toTwine2HTML
|
|
238
247
|
* @returns {string} Twine 2 HTML string
|
|
239
248
|
*/
|
|
240
249
|
toTwine2HTML(): string;
|
|
@@ -243,13 +252,12 @@ export class Story {
|
|
|
243
252
|
*
|
|
244
253
|
* See: Twine 1 HTML Output
|
|
245
254
|
* (https://github.com/iftechfoundation/twine-specs/blob/master/twine-1-htmloutput-doc.md)
|
|
246
|
-
*
|
|
247
|
-
* @method toTwine1HTML
|
|
255
|
+
* @function toTwine1HTML
|
|
248
256
|
* @returns {string} Twine 1 HTML string.
|
|
249
257
|
*/
|
|
250
258
|
toTwine1HTML(): string;
|
|
251
259
|
#private;
|
|
252
260
|
}
|
|
253
261
|
export const creatorName: "extwee";
|
|
254
|
-
export const creatorVersion: "2.3.
|
|
262
|
+
export const creatorVersion: "2.3.15";
|
|
255
263
|
import Passage from './Passage.js';
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This class has type checking on all of its properties.
|
|
5
5
|
* If a property is set to a value of the wrong type, a TypeError will be thrown.
|
|
6
|
-
*
|
|
7
6
|
* @see {@link https://github.com/iftechfoundation/twine-specs/blob/master/twine-2-storyformats-spec.md Twine 2 Story Formats Specification}
|
|
8
|
-
*
|
|
9
7
|
* @class
|
|
10
8
|
* @classdesc A class representing a Twine 2 story format.
|
|
11
9
|
* @property {string} name - The name of the story format.
|
|
@@ -32,6 +30,7 @@
|
|
|
32
30
|
export default class StoryFormat {
|
|
33
31
|
constructor(name?: string, version?: string, description?: string, author?: string, image?: string, url?: string, license?: string, proofing?: boolean, source?: string);
|
|
34
32
|
/**
|
|
33
|
+
* Set name.
|
|
35
34
|
* @param {string} n - Replacement name.
|
|
36
35
|
*/
|
|
37
36
|
set name(n: string);
|
|
@@ -41,6 +40,7 @@ export default class StoryFormat {
|
|
|
41
40
|
*/
|
|
42
41
|
get name(): string;
|
|
43
42
|
/**
|
|
43
|
+
* Set version.
|
|
44
44
|
* @param {string} n - Replacement version.
|
|
45
45
|
*/
|
|
46
46
|
set version(n: string);
|
|
@@ -50,6 +50,7 @@ export default class StoryFormat {
|
|
|
50
50
|
*/
|
|
51
51
|
get version(): string;
|
|
52
52
|
/**
|
|
53
|
+
* Set description.
|
|
53
54
|
* @param {string} d - Replacement description.
|
|
54
55
|
*/
|
|
55
56
|
set description(d: string);
|
|
@@ -59,6 +60,7 @@ export default class StoryFormat {
|
|
|
59
60
|
*/
|
|
60
61
|
get description(): string;
|
|
61
62
|
/**
|
|
63
|
+
* Set author.
|
|
62
64
|
* @param {string} a - Replacement author.
|
|
63
65
|
*/
|
|
64
66
|
set author(a: string);
|
|
@@ -68,6 +70,7 @@ export default class StoryFormat {
|
|
|
68
70
|
*/
|
|
69
71
|
get author(): string;
|
|
70
72
|
/**
|
|
73
|
+
* Set image.
|
|
71
74
|
* @param {string} i - Replacement image.
|
|
72
75
|
*/
|
|
73
76
|
set image(i: string);
|
|
@@ -77,6 +80,7 @@ export default class StoryFormat {
|
|
|
77
80
|
*/
|
|
78
81
|
get image(): string;
|
|
79
82
|
/**
|
|
83
|
+
* Set URL.
|
|
80
84
|
* @param {string} u - Replacement URL.
|
|
81
85
|
*/
|
|
82
86
|
set url(u: string);
|
|
@@ -86,6 +90,7 @@ export default class StoryFormat {
|
|
|
86
90
|
*/
|
|
87
91
|
get url(): string;
|
|
88
92
|
/**
|
|
93
|
+
* Set license.
|
|
89
94
|
* @param {string} l - Replacement license.
|
|
90
95
|
*/
|
|
91
96
|
set license(l: string);
|
|
@@ -95,6 +100,7 @@ export default class StoryFormat {
|
|
|
95
100
|
*/
|
|
96
101
|
get license(): string;
|
|
97
102
|
/**
|
|
103
|
+
* Set proofing.
|
|
98
104
|
* @param {boolean} p - Replacement proofing.
|
|
99
105
|
*/
|
|
100
106
|
set proofing(p: boolean);
|
|
@@ -104,6 +110,7 @@ export default class StoryFormat {
|
|
|
104
110
|
*/
|
|
105
111
|
get proofing(): boolean;
|
|
106
112
|
/**
|
|
113
|
+
* Set source.
|
|
107
114
|
* @param {string} s - Replacement source.
|
|
108
115
|
*/
|
|
109
116
|
set source(s: string);
|
|
@@ -114,13 +121,13 @@ export default class StoryFormat {
|
|
|
114
121
|
get source(): string;
|
|
115
122
|
/**
|
|
116
123
|
* Produces a string representation of the story format object.
|
|
117
|
-
* @
|
|
124
|
+
* @function toString
|
|
118
125
|
* @returns {string} - A string representation of the story format.
|
|
119
126
|
*/
|
|
120
127
|
toString(): string;
|
|
121
128
|
/**
|
|
122
129
|
* Produces a JSON representation of the story format object.
|
|
123
|
-
* @
|
|
130
|
+
* @function toJSON
|
|
124
131
|
* @returns {object} - A JSON representation of the story format.
|
|
125
132
|
*/
|
|
126
133
|
toJSON(): object;
|