extwee 2.3.10 → 2.3.12

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.
Files changed (180) hide show
  1. package/CHANGELOG.md +219 -0
  2. package/CONTRIBUTING.md +305 -0
  3. package/README.md +16 -0
  4. package/build/extwee.core.min.js +1 -1
  5. package/build/extwee.twine1html.min.js +1 -1
  6. package/build/extwee.twine2archive.min.js +1 -1
  7. package/build/extwee.tws.min.js +1 -1
  8. package/package.json +8 -5
  9. package/src/Passage.js +8 -9
  10. package/src/Story.js +2 -2
  11. package/types/src/Story.d.ts +1 -1
  12. package/.github/FUNDING.yml +0 -3
  13. package/.github/codeql-analysis.yml +0 -51
  14. package/.github/dependabot.yml +0 -11
  15. package/.github/workflows/dependabot-automerge.yml +0 -23
  16. package/.github/workflows/nodejs.yml +0 -28
  17. package/.travis.yml +0 -13
  18. package/babel.config.json +0 -18
  19. package/docs/.nojekyll +0 -0
  20. package/docs/README.md +0 -224
  21. package/docs/_sidebar.md +0 -19
  22. package/docs/build/extwee.core.min.js +0 -1
  23. package/docs/build/extwee.twine1html.min.js +0 -1
  24. package/docs/build/extwee.twine2archive.min.js +0 -1
  25. package/docs/build/extwee.tws.min.js +0 -1
  26. package/docs/demos/compiler/extwee.core.min.js +0 -1
  27. package/docs/demos/compiler/index.css +0 -105
  28. package/docs/demos/compiler/index.html +0 -359
  29. package/docs/demos/decompile/extwee.core.min.js +0 -1
  30. package/docs/demos/decompile/index.css +0 -584
  31. package/docs/demos/decompile/index.html +0 -468
  32. package/docs/examples/dynamicPassages.md +0 -28
  33. package/docs/examples/jsonToTwee.md +0 -23
  34. package/docs/examples/twsToTwee.md +0 -25
  35. package/docs/formats/json.md +0 -17
  36. package/docs/formats/twee.md +0 -13
  37. package/docs/formats/twine1HTML.md +0 -13
  38. package/docs/formats/twine2ArchiveHTML.md +0 -13
  39. package/docs/formats/twine2HTML.md +0 -13
  40. package/docs/formats/tws.md +0 -9
  41. package/docs/index.html +0 -26
  42. package/docs/install/npm.md +0 -16
  43. package/docs/install/npx.md +0 -79
  44. package/docs/objects/passage.md +0 -47
  45. package/docs/objects/story.md +0 -69
  46. package/docs/objects/storyformat.md +0 -27
  47. package/eslint.config.js +0 -28
  48. package/extwee.config.json +0 -6
  49. package/extwee.config.md +0 -67
  50. package/jest.config.json +0 -5
  51. package/test/CLI/CLI.test.js +0 -49
  52. package/test/CLI/files/example.json +0 -1
  53. package/test/CLI/files/example6.twee +0 -22
  54. package/test/CLI/files/harlowe.js +0 -3
  55. package/test/CLI/files/input.html +0 -47
  56. package/test/CLI/files/output/test.twee +0 -0
  57. package/test/CLI/files/test.twee +0 -18
  58. package/test/CLI/files/tweeExample.twee +0 -17
  59. package/test/CLI/files/twine1/LICENSE.txt +0 -32
  60. package/test/CLI/files/twine1/code.js +0 -5
  61. package/test/CLI/files/twine1/engine.js +0 -43
  62. package/test/CLI/files/twine1/header.html +0 -325
  63. package/test/CLI/files/twine1Test.html +0 -371
  64. package/test/CLI/files/twineExample.html +0 -16
  65. package/test/Config/Config.test.js +0 -76
  66. package/test/Config/files/empty.json +0 -3
  67. package/test/Config/files/full.json +0 -8
  68. package/test/Config/files/invalid.json +0 -1
  69. package/test/Config/files/valid.json +0 -6
  70. package/test/Config/isDirectory.test.js +0 -50
  71. package/test/Config/isFile.test.js +0 -53
  72. package/test/Config/loadStoryFormat.test.js +0 -117
  73. package/test/Config/readDirectories.test.js +0 -78
  74. package/test/IFID/IFID.Generate.test.js +0 -10
  75. package/test/JSON/JSON.Parse.test.js +0 -316
  76. package/test/Objects/Passage.test.js +0 -270
  77. package/test/Objects/SnowmanCompatibility.test.js +0 -125
  78. package/test/Objects/Story.test.js +0 -1075
  79. package/test/Objects/StoryFormat.test.js +0 -219
  80. package/test/Roundtrip/Files/Example1.html +0 -64
  81. package/test/Roundtrip/Files/LICENSE +0 -19
  82. package/test/Roundtrip/Files/example1.twee +0 -10
  83. package/test/Roundtrip/Files/example2.twee +0 -27
  84. package/test/Roundtrip/Files/example4.twee +0 -27
  85. package/test/Roundtrip/Files/harlowe.js +0 -3
  86. package/test/Roundtrip/Files/round.html +0 -49
  87. package/test/Roundtrip/Roundtrip.test.js +0 -54
  88. package/test/StoryFormat/StoryFormat.Parse.test.js +0 -479
  89. package/test/TWS/Parse.test.js +0 -56
  90. package/test/TWS/TWSParser/Example5.tws +0 -414
  91. package/test/TWS/TWSParser/noscale.tws +0 -0
  92. package/test/TWS/TWSParser/nostory.tws +0 -0
  93. package/test/Twee/Twee.Escaping.test.js +0 -200
  94. package/test/Twee/Twee.Parse.test.js +0 -108
  95. package/test/Twee/TweeParser/cursed.twee +0 -16
  96. package/test/Twee/TweeParser/cycling.twee +0 -75
  97. package/test/Twee/TweeParser/emptytags.twee +0 -2
  98. package/test/Twee/TweeParser/example.twee +0 -32
  99. package/test/Twee/TweeParser/malformed.twee +0 -2
  100. package/test/Twee/TweeParser/missing.twee +0 -19
  101. package/test/Twee/TweeParser/multipleScriptPassages.twee +0 -19
  102. package/test/Twee/TweeParser/multipleStyleTag.twee +0 -19
  103. package/test/Twee/TweeParser/multipletags.twee +0 -10
  104. package/test/Twee/TweeParser/noTitle.twee +0 -2
  105. package/test/Twee/TweeParser/notes.twee +0 -16
  106. package/test/Twee/TweeParser/pasagemetadataerror.twee +0 -2
  107. package/test/Twee/TweeParser/scriptPassage.twee +0 -16
  108. package/test/Twee/TweeParser/singletag.twee +0 -13
  109. package/test/Twee/TweeParser/start.twee +0 -2
  110. package/test/Twee/TweeParser/startMetadata.twee +0 -14
  111. package/test/Twee/TweeParser/storydataerror.twee +0 -25
  112. package/test/Twee/TweeParser/style.twee +0 -16
  113. package/test/Twee/TweeParser/stylePassage.twee +0 -16
  114. package/test/Twee/TweeParser/test.twee +0 -25
  115. package/test/Twine1HTML/Twine1HTML.Compile.test.js +0 -180
  116. package/test/Twine1HTML/Twine1HTML.Parse.Web.test.js +0 -484
  117. package/test/Twine1HTML/Twine1HTML.Parse.test.js +0 -183
  118. package/test/Twine1HTML/Twine1HTMLCompiler/Twine1/LICENSE +0 -674
  119. package/test/Twine1HTML/Twine1HTMLCompiler/Twine1/engine.js +0 -43
  120. package/test/Twine1HTML/Twine1HTMLCompiler/Twine1/jquery.js +0 -4
  121. package/test/Twine1HTML/Twine1HTMLCompiler/Twine1/modernizr.js +0 -4
  122. package/test/Twine1HTML/Twine1HTMLCompiler/engineTest.html +0 -1
  123. package/test/Twine1HTML/Twine1HTMLCompiler/jonah-1.4.2/LICENSE +0 -32
  124. package/test/Twine1HTML/Twine1HTMLCompiler/jonah-1.4.2/code.js +0 -4
  125. package/test/Twine1HTML/Twine1HTMLCompiler/jonah-1.4.2/header.html +0 -327
  126. package/test/Twine1HTML/Twine1HTMLCompiler/test.html +0 -0
  127. package/test/Twine1HTML/Twine1HTMLCompiler/test1.html +0 -6
  128. package/test/Twine1HTML/Twine1HTMLCompiler/test2.html +0 -6
  129. package/test/Twine1HTML/Twine1HTMLCompiler/test3.html +0 -43
  130. package/test/Twine1HTML/Twine1HTMLCompiler/test4.html +0 -372
  131. package/test/Twine1HTML/Twine1HTMLCompiler/test5.html +0 -372
  132. package/test/Twine2ArchiveHTML/Twine2ArchiveHTML.Compile.test.js +0 -35
  133. package/test/Twine2ArchiveHTML/Twine2ArchiveHTML.Parse.Web.test.js +0 -293
  134. package/test/Twine2ArchiveHTML/Twine2ArchiveHTML.Parse.test.js +0 -42
  135. package/test/Twine2ArchiveHTML/Twine2ArchiveHTMLCompiler/test1.html +0 -6
  136. package/test/Twine2ArchiveHTML/Twine2ArchiveHTMLParser/test1.html +0 -3
  137. package/test/Twine2HTML/Twine2HTML.Compile.test.js +0 -139
  138. package/test/Twine2HTML/Twine2HTML.Parse.Web.test.js +0 -329
  139. package/test/Twine2HTML/Twine2HTML.Parse.test.js +0 -192
  140. package/test/Twine2HTML/Twine2HTMLCompiler/TestTags.html +0 -42
  141. package/test/Twine2HTML/Twine2HTMLCompiler/creator.html +0 -50
  142. package/test/Twine2HTML/Twine2HTMLCompiler/example6.twee +0 -16
  143. package/test/Twine2HTML/Twine2HTMLCompiler/format.js +0 -9
  144. package/test/Twine2HTML/Twine2HTMLCompiler/missingStoryTitle.twee +0 -29
  145. package/test/Twine2HTML/Twine2HTMLCompiler/test11.html +0 -121
  146. package/test/Twine2HTML/Twine2HTMLCompiler/test2.html +0 -58
  147. package/test/Twine2HTML/Twine2HTMLCompiler/test3.html +0 -49
  148. package/test/Twine2HTML/Twine2HTMLCompiler/test4.html +0 -50
  149. package/test/Twine2HTML/Twine2HTMLCompiler/test6.html +0 -49
  150. package/test/Twine2HTML/Twine2HTMLParser/Example1.html +0 -53
  151. package/test/Twine2HTML/Twine2HTMLParser/Tags.html +0 -15
  152. package/test/Twine2HTML/Twine2HTMLParser/lyingStartnode.html +0 -15
  153. package/test/Twine2HTML/Twine2HTMLParser/lyingTagColors.html +0 -48
  154. package/test/Twine2HTML/Twine2HTMLParser/missingCreator.html +0 -11
  155. package/test/Twine2HTML/Twine2HTMLParser/missingCreatorVersion.html +0 -11
  156. package/test/Twine2HTML/Twine2HTMLParser/missingFormat.html +0 -11
  157. package/test/Twine2HTML/Twine2HTMLParser/missingFormatVersion.html +0 -11
  158. package/test/Twine2HTML/Twine2HTMLParser/missingIFID.html +0 -11
  159. package/test/Twine2HTML/Twine2HTMLParser/missingPassageTags.html +0 -15
  160. package/test/Twine2HTML/Twine2HTMLParser/missingPosition.html +0 -15
  161. package/test/Twine2HTML/Twine2HTMLParser/missingScript.html +0 -14
  162. package/test/Twine2HTML/Twine2HTMLParser/missingSize.html +0 -35
  163. package/test/Twine2HTML/Twine2HTMLParser/missingStartnode.html +0 -11
  164. package/test/Twine2HTML/Twine2HTMLParser/missingStyle.html +0 -14
  165. package/test/Twine2HTML/Twine2HTMLParser/missingZoom.html +0 -11
  166. package/test/Twine2HTML/Twine2HTMLParser/tagColors.html +0 -31
  167. package/test/Twine2HTML/Twine2HTMLParser/twineExample.html +0 -23
  168. package/test/Twine2HTML/Twine2HTMLParser/twineExample2.html +0 -15
  169. package/test/Twine2HTML/Twine2HTMLParser/twineExample3.html +0 -15
  170. package/test/Twine2HTML/Twine2HTMLParser/unescaping.html +0 -33
  171. package/test/Web/web-core-coverage.test.js +0 -175
  172. package/test/Web/web-core-global.test.js +0 -93
  173. package/test/Web/web-core.test.js +0 -156
  174. package/test/Web/web-exports.test.js +0 -136
  175. package/test/Web/web-twine1html.test.js +0 -105
  176. package/test/Web/web-twine2archive.test.js +0 -96
  177. package/test/Web/web-tws.test.js +0 -77
  178. package/test/Web/window.Extwee.test.js +0 -97
  179. package/tsconfig.json +0 -21
  180. package/webpack.config.js +0 -47
@@ -1,16 +0,0 @@
1
- # NPM
2
-
3
- While general compilation and de-compilation is possible using the CLI, more advanced usage patterns can be enabled through the API.
4
-
5
- By installing `extwee`, developers can directly access its objects, parsers, and compilation functionality.
6
-
7
- ## Example
8
-
9
- ```javascript
10
- import { Story, Passage } from 'extwee';
11
-
12
- // Create the story.
13
- const example = new Story( 'Example' );
14
- // Add a new passage.
15
- example.addPassage(new Passage( 'Test', 'Some Text') );
16
- ```
@@ -1,79 +0,0 @@
1
- # NPX
2
-
3
- Extwee can be used via NPX (node package execution) without being added to a local project. When used this way, precede all uses with "npx".
4
-
5
- ## NPX Example
6
-
7
- ```bash
8
- npx extwee -c -i <tweeFile> -s <storyFormat> -o <Twine2HTML>
9
- ```
10
-
11
- ## Config File Usage
12
-
13
- When used via NPX, Extwee will also look for a local file, `extwee.config.json`.
14
-
15
- The configuration file supports some, but not all, possible actions using command-line arguments.
16
-
17
- ### Defining `mode`
18
-
19
- The most important option is `mode`. This **MUST BE** either `compile` or `decompile`.
20
-
21
- ```json
22
- {
23
- "mode": "decompile"
24
- }
25
- ```
26
-
27
- ### Defining `input` and `output`
28
-
29
- To process files, the `input` and `output` properties **MUST BE** defined using either an absolute or relative path.
30
-
31
- ```json
32
- {
33
- "mode": "compile",
34
- "input": "index.twee",
35
- "output": "index.html"
36
- }
37
- ```
38
-
39
- ### Defining `story-format`
40
-
41
- If using the `"mode": "compile"` option, the `story-format` property **MUST BE** defined. This should be the name of a directory in the relative `./story-formats` directory.
42
-
43
- For example, if using Harlowe, the path would be `./story-formats/harlowe` and the key-value pair would be `"story-format": "harlowe"`.
44
-
45
- ```json
46
- {
47
- "mode": "compile",
48
- "input": "index.twee",
49
- "output": "index.html",
50
- "story-format": "harlowe"
51
- }
52
- ```
53
-
54
- #### Defining optional `story-format-version`
55
-
56
- The Story Format Archive retrieves story formats based on its version in a sub-directory structure:
57
-
58
- ```file
59
- story-formats/
60
- ├── harlowe/
61
- │ ├── 2.3.0/
62
- │ └── format.js
63
- │ ├── 2.4.0/
64
- │ └── format.js
65
- ```
66
-
67
- This can be specified, such as `3.2.0`, or the default `latest`, can be used.
68
-
69
- ```json
70
- {
71
- "mode": "compile",
72
- "input": "index.twee",
73
- "output": "index.html",
74
- "story-format": "harlowe",
75
- "story-format-version": "3.2.0"
76
- }
77
- ```
78
-
79
- If only the story format name is specified, and it can be found in the local `story-formats` directory, it will search for a corresponding `format.js` file.
@@ -1,47 +0,0 @@
1
- # Passage
2
-
3
- The smallest unit in Twine is a *passage*.
4
-
5
- ## Properties
6
-
7
- When using the Extwee API, a **Passage** object holds four properties:
8
-
9
- - name ( string ) Name of the passage.
10
- - text ( string ) Content of the passage.
11
- - tags ( array(string) ) Array of tags associated with the passage.
12
- - Metadata ( object ) Key-value pairs associated with the passage.
13
-
14
- ### Property Example
15
-
16
- ```javascript
17
- import { Passage } from 'extwee';
18
-
19
- // Create a single passage.
20
- const example = new Passage('Example', 'Some text');
21
-
22
- // Output current passage text.
23
- console.log( example.text );
24
- ```
25
-
26
- ## Methods
27
-
28
- Each passage is capable of producing multiple formats of its internal data:
29
-
30
- - `toTwee()`: Converts passage data into Twee 3.
31
- - `toJSON()`: Converts passage data into Twine 2 JSON.
32
- - `toTwine2HTML()`: Converts passage data into Twine 2 HTML.
33
- - `toTwine1HTML()`: Converts passage data into Twine 1 HTML.
34
-
35
- ### Method Example
36
-
37
- ```javascript
38
- import { Passage } from 'extwee';
39
-
40
- // Create a single passage.
41
- const example = new Passage('Example', 'Some text');
42
-
43
- // Convert to Twee 3.
44
- console.log( example.toTwee() );
45
- ```
46
-
47
- **Note:** While each passage can create different representations of its data, each conversion is considered partial without the corresponding story metadata or story format to create the playable form.
@@ -1,69 +0,0 @@
1
- # Story
2
-
3
- A *story* is a collection of [passages](/guide/passage.md) with its own metadata.
4
-
5
- ## Properties
6
-
7
- Depending on the incoming format or creation method, many possible properties can be populated.
8
-
9
- - name ( string ) Name of the story.
10
- - start ( string ) Starting passage for Twine 2 HTML or Twee 3.
11
- - IFID ( string ) When converting to multiple formats, a new IFID will be generated if it does not exist.
12
- - format ( string ) Name of the story format for Twine 2 HTML.
13
- - formatVersion ( string ) Semantic version of the named story format for Twine 2 HTML or Twee 3.
14
- - zoom ( float ) Zoom level for Twine 2 HTML or Twee 3.
15
- - passages ( array(Passage) ) Collection of internal passages.
16
- - creator ( string ) Name of story creation tool. (Defaults to "Extwee").
17
- - creatorVersion ( string ) Semantic version of named creation tool.
18
- - metadata ( object ) Key-value pairs of metadata values.
19
- - tagColors ( object ) Key-value pairs of tags and their named colors.
20
-
21
- ## Creation Example
22
-
23
- ```javascript
24
- import { Story } from 'extwee';
25
-
26
- // Create a story.
27
- const example = new Story('Example');
28
-
29
- // Show story name
30
- console.log ( example.name );
31
- ```
32
-
33
- **Note:** All properties have protections. Attempting to assign the wrong type will result in an error.
34
-
35
- ## Passage Methods
36
-
37
- As collections of passages, each **Story** has multiple methods for accessing and mutating its data:
38
-
39
- - `addPassage(Passage)`: Adds a new passage to the collection. (In Twine, passage names must be unique. Extwee will produce a console warning and ignore any repeating names.)
40
- - `removePassageByName(string)`: Looks for an removes a passage based on its name. If the passage does not exist, nothing happens.
41
- - `getPassagesByTags(string)`: Returns an array of any passages containing a particular tag value.
42
- - `getPassageByName(string)`: Returns either `null`` or the named passage.
43
- - `size()`: Returns the number of passages in the collection.
44
-
45
- ## Passage Creation Example
46
-
47
- ```javascript
48
- import { Story, Passage } from 'extwee';
49
-
50
- // Create the story.
51
- const example = new Story( 'Example' );
52
- // Add a new passage.
53
- example.addPassage(new Passage( 'Test', 'Some Text') );
54
-
55
- // Confirm size change.
56
- // (Should produce 1).
57
- console.log ( example.size() );
58
- ```
59
-
60
- **Note:** It is not possible to directly access and act on the *passages* property. All actions must take place through available methods.
61
-
62
- Like passages, each **Story** can generate multiple formats based on its data:
63
-
64
- - `toTwee()`: Convert the story, its properties, and all its passages into Twee 3.
65
- - `toJSON()`: Converts the story, its properties, and all its passages into Twine 2 JSON.
66
- - `toTwine1HTML()`: Converts the story, its properties, and all its passages into Twine 1 HTML.
67
- - `toTwine2HTML()`: Converts the story, its properties, and all its passages into Twine 2 HTML.
68
-
69
- **Note:** While stories can create different representations of its data, most conversions are considered partial without the corresponding story format to create the playable form.
@@ -1,27 +0,0 @@
1
- # Story Format
2
-
3
- For a story to be playable in Twine, it must be combined with a *story format*.
4
-
5
- In Twine 1, story formats can exist across multiple files:
6
-
7
- - `engine.js`: "engine" as included from Twine 1.
8
- - `header.html`: HTML "header" the Twine 1 HTML will be added into to create published file.
9
- - `code.js`: While technically optional, most story formats include extra code found in a `code.js` file.
10
-
11
- In Twine 2, story formats are single files generally named `format.js`. These are [JSONP files](https://en.wikipedia.org/wiki/JSONP) with JSON data of the story format included within a function call payload.
12
-
13
- ## Properties
14
-
15
- When working with Twine 2 story formats, the associated `parse()` function call be used to create a **StoryFormat** object with the following properties:
16
-
17
- - name ( string ) Name of the story format.
18
- - version ( string ) Semantic version.
19
- - author ( string ) Author of the story format.
20
- - description ( string ) Summary of the story format.
21
- - image ( string ) URL of an image (ideally SVG) acting as its icon in Twine.
22
- - url ( string ) URL of the directory containing the `format.js` file.
23
- - license ( string ) License acronym and sometimes version.
24
- - proofing ( boolean ) (defaults to false). True if the story format is a "proofing" format.
25
- - source ( string ) Full HTML output of the story format including the two placeholders {{STORY_NAME}} and {{STORY_DATA}}. (The placeholders are not themselves required.)
26
-
27
- **Note:** Generally, even when using the Extwee API, it is rare to work with story formats beyond parsing them as part of Twine 1 or Twine 2 HTML compilation.
package/eslint.config.js DELETED
@@ -1,28 +0,0 @@
1
- import globals from "globals";
2
- import pluginJs from "@eslint/js";
3
- import jest from "eslint-plugin-jest";
4
- import jsdoc from 'eslint-plugin-jsdoc';
5
-
6
- export default [
7
- jsdoc.configs['flat/recommended'],
8
- {
9
- languageOptions: {
10
- globals: {
11
- ...globals.browser,
12
- ...globals.node,
13
- ...globals.jest
14
- }
15
- },
16
- plugins: {
17
- jest: jest,
18
- jsdoc: jsdoc
19
- },
20
- rules: {
21
- 'jsdoc/require-description': 'warn',
22
- 'jsdoc/check-tag-names': ['error', {
23
- definedTags: ['jest-environment']
24
- }]
25
- }
26
- },
27
- pluginJs.configs.recommended,
28
- ];
@@ -1,6 +0,0 @@
1
- {
2
- "mode": "decompile",
3
- "input": "index.html",
4
- "output": "index.twee",
5
- "story-format": "harlowe"
6
- }
package/extwee.config.md DELETED
@@ -1,67 +0,0 @@
1
- # Extwee Config File Options
2
-
3
- The configuration file supports some, but not all, possible actions using command-line arguments.
4
-
5
- ## Defining `mode`
6
-
7
- The most important option is `mode`. This **MUST BE** either `compile` or `decompile`.
8
-
9
- ```json
10
- {
11
- "mode": "decompile"
12
- }
13
- ```
14
-
15
- ## Defining `input` and `output`
16
-
17
- To process files, the `input` and `output` properties **MUST BE** defined using either an absolute or relative path.
18
-
19
- ```json
20
- {
21
- "mode": "compile",
22
- "input": "index.twee",
23
- "output": "index.html"
24
- }
25
- ```
26
-
27
- ## Defining `story-format`
28
-
29
- If using the `"mode": "compile"` option, the `story-format` property **MUST BE** defined. This should be the name of a directory in the relative `./story-formats` directory.
30
-
31
- For example, if using Harlowe, the path would be `./story-formats/harlowe` and the key-value pair would be `"story-format": "harlowe"`.
32
-
33
- ```json
34
- {
35
- "mode": "compile",
36
- "input": "index.twee",
37
- "output": "index.html",
38
- "story-format": "harlowe"
39
- }
40
- ```
41
-
42
- ### Defining optional `story-format-version`
43
-
44
- The Story Format Archive retrieves story formats based on its version in a sub-directory structure:
45
-
46
- ```file
47
- story-formats/
48
- ├── harlowe/
49
- │ ├── 2.3.0/
50
- │ └── format.js
51
- │ ├── 2.4.0/
52
- │ └── format.js
53
- ```
54
-
55
- This can be specified, such as `3.2.0`, or the default `latest`, can be used.
56
-
57
- ```json
58
- {
59
- "mode": "compile",
60
- "input": "index.twee",
61
- "output": "index.html",
62
- "story-format": "harlowe",
63
- "story-format-version": "3.2.0"
64
- }
65
- ```
66
-
67
- If only the story format name is specified, and it can be found in the local `story-formats` directory, it will search for a corresponding `format.js` file.
package/jest.config.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "bail": 1,
3
- "verbose": true,
4
- "collectCoverage": true
5
- }
@@ -1,49 +0,0 @@
1
- import shell from 'shelljs';
2
-
3
- // We could get this from process,
4
- // but since we are using shelljs,
5
- // we ask for the pwd() instead of cwd().
6
- const currentPath = shell.pwd().stdout;
7
- const testFilePath = currentPath + '/test/CLI/files';
8
-
9
- describe('CLI', () => {
10
- // Remove the test files, if they exist.
11
- beforeAll(() => {
12
- // Test for files beginning with "test." in the output directory.
13
- if (shell.ls('-A', `${testFilePath}/output/`).length > 0) {
14
- // Remove the files.
15
- shell.rm(`${testFilePath}/output/*`);
16
- }
17
- });
18
-
19
- it('Twine 2 - de-compile: Twine 2 HTML into Twee 3', () => {
20
- shell.exec(`node ${currentPath}/src/extwee.js -d -i ${testFilePath}/input.html -o ${testFilePath}/output/test.twee`);
21
- expect(shell.test('-e', `${testFilePath}/output/test.twee`)).toBe(true);
22
- });
23
-
24
- it('Twine 2 - compile: Twee 3 + StoryFormat into Twine 2 HTML', () => {
25
- shell.exec(`node ${currentPath}/src/extwee.js -c -i ${testFilePath}/example6.twee -s ${testFilePath}/harlowe.js -o ${testFilePath}/output/test2.html`);
26
- expect(shell.test('-e', `${testFilePath}/output/test2.html`)).toBe(true);
27
- });
28
-
29
- it('Twine 1 - compile: Twee 3 + Twine 1 engine.js + Twine 1 code.js + Twine 1 header.html', () => {
30
- shell.exec(`node ${currentPath}/src/extwee.js --twine1 -c -i ${testFilePath}/example6.twee -o ${testFilePath}/output/test3.html --codejs ${testFilePath}/twine1/code.js --engine ${testFilePath}/twine1/engine.js --header ${testFilePath}/twine1/header.html --name Test`);
31
- expect(shell.test('-e', `${testFilePath}/output/test3.html`)).toBe(true);
32
- });
33
-
34
- it('Twine 1 - de-compile: Twine 1 HTML into Twee 3', () => {
35
- shell.exec(`node ${currentPath}/src/extwee.js --twine1 -d -i ${testFilePath}/twine1Test.html -o ${testFilePath}/output/test.twee`);
36
- expect(shell.test('-e', `${testFilePath}/output/test.twee`)).toBe(true);
37
- });
38
-
39
- // Remove the test files, if they exist.
40
- afterAll(() => {
41
- // Test for files in the output directory.
42
- if (shell.ls('-A', `${testFilePath}/output/`).length > 0) {
43
- // Remove the files.
44
- shell.rm(`${testFilePath}/output/*`);
45
- }
46
- // Create one file to prevent git from ignoring the folder.
47
- shell.touch(`${testFilePath}/output/test.twee`);
48
- });
49
- });
@@ -1 +0,0 @@
1
- {"name":"Test","tagColors":{"r":"red"},"ifid":"dd","start":"Start","formatVersion":"1.0","metadata":{"some":"thing"},"format":"Snowman","creator":"extwee","creatorVersion":"2.2.0","zoom":1,"passages":[{"name":"Start","tags":["tag1"],"metadata":{"s":"e"},"text":"Word"}]}
@@ -1,22 +0,0 @@
1
- :: StoryData
2
- {
3
- "ifid": "D674C58C-DEFA-4F70-B7A2-27742230C0FC",
4
- "format": "SugarCube",
5
- "format-version": "2.28.2",
6
- "start": "Start",
7
- "tag-colors": {
8
- "bar": "green",
9
- "foo": "red",
10
- "qaz": "blue"
11
- },
12
- "zoom": 0.25
13
- }
14
-
15
- :: StoryTitle
16
- twineExample
17
-
18
- :: Start [tag tags] {"position": "200,200", "size": "100,100"}
19
- Content
20
-
21
- :: Style1 [stylesheet]
22
- body {background-color: green;}