extwee 2.3.11 → 2.3.13
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 +219 -0
- package/CONTRIBUTING.md +305 -0
- package/README.md +16 -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 +19 -16
- package/src/Story.js +2 -2
- package/types/src/Story.d.ts +1 -1
- package/.github/FUNDING.yml +0 -3
- package/.github/codeql-analysis.yml +0 -51
- package/.github/dependabot.yml +0 -11
- package/.github/workflows/dependabot-automerge.yml +0 -23
- package/.github/workflows/nodejs.yml +0 -28
- package/.travis.yml +0 -13
- package/babel.config.json +0 -18
- package/docs/.nojekyll +0 -0
- package/docs/README.md +0 -224
- package/docs/_sidebar.md +0 -19
- package/docs/build/extwee.core.min.js +0 -1
- package/docs/build/extwee.twine1html.min.js +0 -1
- package/docs/build/extwee.twine2archive.min.js +0 -1
- package/docs/build/extwee.tws.min.js +0 -1
- package/docs/demos/compiler/extwee.core.min.js +0 -1
- package/docs/demos/compiler/index.css +0 -105
- package/docs/demos/compiler/index.html +0 -359
- package/docs/demos/decompile/extwee.core.min.js +0 -1
- package/docs/demos/decompile/index.css +0 -584
- package/docs/demos/decompile/index.html +0 -468
- package/docs/examples/dynamicPassages.md +0 -28
- package/docs/examples/jsonToTwee.md +0 -23
- package/docs/examples/twsToTwee.md +0 -25
- package/docs/formats/json.md +0 -17
- package/docs/formats/twee.md +0 -13
- package/docs/formats/twine1HTML.md +0 -13
- package/docs/formats/twine2ArchiveHTML.md +0 -13
- package/docs/formats/twine2HTML.md +0 -13
- package/docs/formats/tws.md +0 -9
- package/docs/index.html +0 -26
- package/docs/install/npm.md +0 -16
- package/docs/install/npx.md +0 -79
- package/docs/objects/passage.md +0 -47
- package/docs/objects/story.md +0 -69
- package/docs/objects/storyformat.md +0 -27
- package/eslint.config.js +0 -28
- package/extwee.config.json +0 -6
- package/extwee.config.md +0 -67
- package/jest.config.json +0 -5
- package/test/CLI/CLI.test.js +0 -49
- package/test/CLI/files/example.json +0 -1
- package/test/CLI/files/example6.twee +0 -22
- package/test/CLI/files/harlowe.js +0 -3
- package/test/CLI/files/input.html +0 -47
- package/test/CLI/files/output/test.twee +0 -0
- package/test/CLI/files/test.twee +0 -18
- package/test/CLI/files/tweeExample.twee +0 -17
- package/test/CLI/files/twine1/LICENSE.txt +0 -32
- package/test/CLI/files/twine1/code.js +0 -5
- package/test/CLI/files/twine1/engine.js +0 -43
- package/test/CLI/files/twine1/header.html +0 -325
- package/test/CLI/files/twine1Test.html +0 -371
- package/test/CLI/files/twineExample.html +0 -16
- package/test/Config/Config.test.js +0 -76
- package/test/Config/files/empty.json +0 -3
- package/test/Config/files/full.json +0 -8
- package/test/Config/files/invalid.json +0 -1
- package/test/Config/files/valid.json +0 -6
- package/test/Config/isDirectory.test.js +0 -50
- package/test/Config/isFile.test.js +0 -53
- package/test/Config/loadStoryFormat.test.js +0 -117
- package/test/Config/readDirectories.test.js +0 -78
- package/test/IFID/IFID.Generate.test.js +0 -10
- package/test/JSON/JSON.Parse.test.js +0 -316
- package/test/Objects/Passage.test.js +0 -274
- package/test/Objects/SnowmanCompatibility.test.js +0 -111
- package/test/Objects/Story.test.js +0 -1075
- package/test/Objects/StoryFormat.test.js +0 -219
- package/test/Roundtrip/Files/Example1.html +0 -64
- package/test/Roundtrip/Files/LICENSE +0 -19
- package/test/Roundtrip/Files/example1.twee +0 -10
- package/test/Roundtrip/Files/example2.twee +0 -27
- package/test/Roundtrip/Files/example4.twee +0 -27
- package/test/Roundtrip/Files/harlowe.js +0 -3
- package/test/Roundtrip/Files/round.html +0 -49
- package/test/Roundtrip/Roundtrip.test.js +0 -54
- package/test/StoryFormat/StoryFormat.Parse.test.js +0 -479
- package/test/TWS/Parse.test.js +0 -56
- package/test/TWS/TWSParser/Example5.tws +0 -414
- package/test/TWS/TWSParser/noscale.tws +0 -0
- package/test/TWS/TWSParser/nostory.tws +0 -0
- package/test/Twee/Twee.Escaping.test.js +0 -200
- package/test/Twee/Twee.Parse.test.js +0 -108
- package/test/Twee/TweeParser/cursed.twee +0 -16
- package/test/Twee/TweeParser/cycling.twee +0 -75
- package/test/Twee/TweeParser/emptytags.twee +0 -2
- package/test/Twee/TweeParser/example.twee +0 -32
- package/test/Twee/TweeParser/malformed.twee +0 -2
- package/test/Twee/TweeParser/missing.twee +0 -19
- package/test/Twee/TweeParser/multipleScriptPassages.twee +0 -19
- package/test/Twee/TweeParser/multipleStyleTag.twee +0 -19
- package/test/Twee/TweeParser/multipletags.twee +0 -10
- package/test/Twee/TweeParser/noTitle.twee +0 -2
- package/test/Twee/TweeParser/notes.twee +0 -16
- package/test/Twee/TweeParser/pasagemetadataerror.twee +0 -2
- package/test/Twee/TweeParser/scriptPassage.twee +0 -16
- package/test/Twee/TweeParser/singletag.twee +0 -13
- package/test/Twee/TweeParser/start.twee +0 -2
- package/test/Twee/TweeParser/startMetadata.twee +0 -14
- package/test/Twee/TweeParser/storydataerror.twee +0 -25
- package/test/Twee/TweeParser/style.twee +0 -16
- package/test/Twee/TweeParser/stylePassage.twee +0 -16
- package/test/Twee/TweeParser/test.twee +0 -25
- package/test/Twine1HTML/Twine1HTML.Compile.test.js +0 -180
- package/test/Twine1HTML/Twine1HTML.Parse.Web.test.js +0 -484
- package/test/Twine1HTML/Twine1HTML.Parse.test.js +0 -183
- package/test/Twine1HTML/Twine1HTMLCompiler/Twine1/LICENSE +0 -674
- package/test/Twine1HTML/Twine1HTMLCompiler/Twine1/engine.js +0 -43
- package/test/Twine1HTML/Twine1HTMLCompiler/Twine1/jquery.js +0 -4
- package/test/Twine1HTML/Twine1HTMLCompiler/Twine1/modernizr.js +0 -4
- package/test/Twine1HTML/Twine1HTMLCompiler/engineTest.html +0 -1
- package/test/Twine1HTML/Twine1HTMLCompiler/jonah-1.4.2/LICENSE +0 -32
- package/test/Twine1HTML/Twine1HTMLCompiler/jonah-1.4.2/code.js +0 -4
- package/test/Twine1HTML/Twine1HTMLCompiler/jonah-1.4.2/header.html +0 -327
- package/test/Twine1HTML/Twine1HTMLCompiler/test.html +0 -0
- package/test/Twine1HTML/Twine1HTMLCompiler/test1.html +0 -6
- package/test/Twine1HTML/Twine1HTMLCompiler/test2.html +0 -6
- package/test/Twine1HTML/Twine1HTMLCompiler/test3.html +0 -43
- package/test/Twine1HTML/Twine1HTMLCompiler/test4.html +0 -372
- package/test/Twine1HTML/Twine1HTMLCompiler/test5.html +0 -372
- package/test/Twine2ArchiveHTML/Twine2ArchiveHTML.Compile.test.js +0 -35
- package/test/Twine2ArchiveHTML/Twine2ArchiveHTML.Parse.Web.test.js +0 -293
- package/test/Twine2ArchiveHTML/Twine2ArchiveHTML.Parse.test.js +0 -42
- package/test/Twine2ArchiveHTML/Twine2ArchiveHTMLCompiler/test1.html +0 -6
- package/test/Twine2ArchiveHTML/Twine2ArchiveHTMLParser/test1.html +0 -3
- package/test/Twine2HTML/Twine2HTML.Compile.test.js +0 -139
- package/test/Twine2HTML/Twine2HTML.Parse.Web.test.js +0 -329
- package/test/Twine2HTML/Twine2HTML.Parse.test.js +0 -192
- package/test/Twine2HTML/Twine2HTMLCompiler/TestTags.html +0 -42
- package/test/Twine2HTML/Twine2HTMLCompiler/creator.html +0 -50
- package/test/Twine2HTML/Twine2HTMLCompiler/example6.twee +0 -16
- package/test/Twine2HTML/Twine2HTMLCompiler/format.js +0 -9
- package/test/Twine2HTML/Twine2HTMLCompiler/missingStoryTitle.twee +0 -29
- package/test/Twine2HTML/Twine2HTMLCompiler/test11.html +0 -121
- package/test/Twine2HTML/Twine2HTMLCompiler/test2.html +0 -58
- package/test/Twine2HTML/Twine2HTMLCompiler/test3.html +0 -49
- package/test/Twine2HTML/Twine2HTMLCompiler/test4.html +0 -50
- package/test/Twine2HTML/Twine2HTMLCompiler/test6.html +0 -49
- package/test/Twine2HTML/Twine2HTMLParser/Example1.html +0 -53
- package/test/Twine2HTML/Twine2HTMLParser/Tags.html +0 -15
- package/test/Twine2HTML/Twine2HTMLParser/lyingStartnode.html +0 -15
- package/test/Twine2HTML/Twine2HTMLParser/lyingTagColors.html +0 -48
- package/test/Twine2HTML/Twine2HTMLParser/missingCreator.html +0 -11
- package/test/Twine2HTML/Twine2HTMLParser/missingCreatorVersion.html +0 -11
- package/test/Twine2HTML/Twine2HTMLParser/missingFormat.html +0 -11
- package/test/Twine2HTML/Twine2HTMLParser/missingFormatVersion.html +0 -11
- package/test/Twine2HTML/Twine2HTMLParser/missingIFID.html +0 -11
- package/test/Twine2HTML/Twine2HTMLParser/missingPassageTags.html +0 -15
- package/test/Twine2HTML/Twine2HTMLParser/missingPosition.html +0 -15
- package/test/Twine2HTML/Twine2HTMLParser/missingScript.html +0 -14
- package/test/Twine2HTML/Twine2HTMLParser/missingSize.html +0 -35
- package/test/Twine2HTML/Twine2HTMLParser/missingStartnode.html +0 -11
- package/test/Twine2HTML/Twine2HTMLParser/missingStyle.html +0 -14
- package/test/Twine2HTML/Twine2HTMLParser/missingZoom.html +0 -11
- package/test/Twine2HTML/Twine2HTMLParser/tagColors.html +0 -31
- package/test/Twine2HTML/Twine2HTMLParser/twineExample.html +0 -23
- package/test/Twine2HTML/Twine2HTMLParser/twineExample2.html +0 -15
- package/test/Twine2HTML/Twine2HTMLParser/twineExample3.html +0 -15
- package/test/Twine2HTML/Twine2HTMLParser/unescaping.html +0 -33
- package/test/Web/web-core-coverage.test.js +0 -175
- package/test/Web/web-core-global.test.js +0 -93
- package/test/Web/web-core.test.js +0 -156
- package/test/Web/web-exports.test.js +0 -136
- package/test/Web/web-twine1html.test.js +0 -105
- package/test/Web/web-twine2archive.test.js +0 -96
- package/test/Web/web-tws.test.js +0 -77
- package/test/Web/window.Extwee.test.js +0 -97
- package/tsconfig.json +0 -21
- package/webpack.config.js +0 -47
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
:: StoryTitle
|
|
2
|
-
Cursed
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
:: StoryData
|
|
6
|
-
{
|
|
7
|
-
"ifid": "22F25A58-7062-4927-95B6-F424DDB2EC65",
|
|
8
|
-
"format": "Harlowe",
|
|
9
|
-
"format-version": "3.3.8",
|
|
10
|
-
"start": "[Hello] {world} \\\\",
|
|
11
|
-
"zoom": 1
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
:: \[Hello\] \{world\} \\\\ {"position":"400,200","size":"100,100"}
|
|
16
|
-
\:: Extra header
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
:: StoryTitle
|
|
2
|
-
Cycling Choices in Snowman
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
:: StoryData
|
|
6
|
-
{
|
|
7
|
-
"ifid": "2A4D6978-93A7-4FD3-96FB-94B995FCBE29"
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
:: UserScript[script]
|
|
12
|
-
$(function() {
|
|
13
|
-
|
|
14
|
-
// Create a global object
|
|
15
|
-
window.setup = window.setup || {};
|
|
16
|
-
|
|
17
|
-
// Iterate through all elements with the class 'cycle'
|
|
18
|
-
// For each, save the current 'choices' and 'selection'
|
|
19
|
-
// (This sets all the 'default' values.)
|
|
20
|
-
$('.cycle').each(function() {
|
|
21
|
-
|
|
22
|
-
// Create a global object for each 'id'
|
|
23
|
-
var id = $(this).attr('id');
|
|
24
|
-
setup[id] = {};
|
|
25
|
-
|
|
26
|
-
// Save the current 'choices' for each
|
|
27
|
-
var choices = JSON.parse($(this).attr("data-cycling-choices"));
|
|
28
|
-
setup[id].choices = choices;
|
|
29
|
-
|
|
30
|
-
// Save the current 'selection' for each
|
|
31
|
-
var selection = $(this).attr("data-cycling-selection");
|
|
32
|
-
setup[id].selection = selection;
|
|
33
|
-
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
$('.cycle').click(function(){
|
|
37
|
-
|
|
38
|
-
// Save the 'id'
|
|
39
|
-
var id = $(this).attr('id');
|
|
40
|
-
|
|
41
|
-
// Retrieve the global 'choices'
|
|
42
|
-
var choices = setup[id].choices;
|
|
43
|
-
|
|
44
|
-
// Retrieve the global 'selection'
|
|
45
|
-
var selection = setup[id].selection;
|
|
46
|
-
|
|
47
|
-
// Update the 'selection' number
|
|
48
|
-
selection++;
|
|
49
|
-
|
|
50
|
-
// Check if 'selection' is greater than length of choices
|
|
51
|
-
if(selection >= choices.length) {
|
|
52
|
-
selection = 0;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Update the 'selection' on the element
|
|
56
|
-
$(this).attr("data-cycling-selection", selection);
|
|
57
|
-
|
|
58
|
-
// Update the text of the element with the choice
|
|
59
|
-
$(this).text(choices[selection]);
|
|
60
|
-
|
|
61
|
-
// Update the global values of 'choices' and 'selection'
|
|
62
|
-
setup[id].choices = choices;
|
|
63
|
-
setup[id].selection = selection;
|
|
64
|
-
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
:: Start
|
|
70
|
-
<a href='javascript:void(0)' id='cycleOne' class='cycle' data-cycling-choices='["One", "Two", "Three"]' data-cycling-selection=0>One</a>
|
|
71
|
-
|
|
72
|
-
[[Submit|Results]]
|
|
73
|
-
|
|
74
|
-
:: Results
|
|
75
|
-
<%= setup["cycleOne"].choices[setup["cycleOne"].selection] %>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
:: StoryTitle
|
|
2
|
-
twineExample
|
|
3
|
-
|
|
4
|
-
:: StoryAuthor
|
|
5
|
-
Dan
|
|
6
|
-
|
|
7
|
-
:: Start {"position":"102,104","size":"100,100"}
|
|
8
|
-
[[Another passage]]
|
|
9
|
-
|
|
10
|
-
[[A third passage]]
|
|
11
|
-
|
|
12
|
-
:: Another passage {"position":"353,60","size":"100,100"}
|
|
13
|
-
[[A fourth passage]]
|
|
14
|
-
|
|
15
|
-
[[A third passage]]
|
|
16
|
-
|
|
17
|
-
:: A third passage {"position":"350,288","size":"100,100"}
|
|
18
|
-
[[Start]]
|
|
19
|
-
|
|
20
|
-
:: A fourth passage {"position":"587,197","size":"100,100"}
|
|
21
|
-
[[A fifth passage]]
|
|
22
|
-
|
|
23
|
-
:: A fifth passage {"position":"800,306","size":"100,100"}
|
|
24
|
-
Double-click this passage to edit it.
|
|
25
|
-
|
|
26
|
-
:: StoryData
|
|
27
|
-
{
|
|
28
|
-
"ifid": "2B68ECD6-348F-4CF5-96F8-549A512A8128",
|
|
29
|
-
"format": "Harlowe",
|
|
30
|
-
"formatVersion": "2.1.0",
|
|
31
|
-
"zoom": "1"
|
|
32
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
:: StoryTitle
|
|
2
|
-
twineExample
|
|
3
|
-
|
|
4
|
-
:: Start
|
|
5
|
-
This is the start passage
|
|
6
|
-
|
|
7
|
-
:: Another passage {"position":"353,60","size":"100,100"}
|
|
8
|
-
[[A fourth passage]]
|
|
9
|
-
|
|
10
|
-
[[A third passage]]
|
|
11
|
-
|
|
12
|
-
:: A third passage {"position":"350,288","size":"100,100"}
|
|
13
|
-
[[Start]]
|
|
14
|
-
|
|
15
|
-
:: A fourth passage {"position":"587,197","size":"100,100"}
|
|
16
|
-
[[A fifth passage]]
|
|
17
|
-
|
|
18
|
-
:: A fifth passage {"position":"800,306","size":"100,100"}
|
|
19
|
-
Double-click this passage to edit it.
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
:: Start
|
|
2
|
-
Content
|
|
3
|
-
|
|
4
|
-
:: StoryTitle
|
|
5
|
-
Title
|
|
6
|
-
|
|
7
|
-
:: UserScript [script]
|
|
8
|
-
1
|
|
9
|
-
|
|
10
|
-
:: UserScript2 [script]
|
|
11
|
-
2
|
|
12
|
-
|
|
13
|
-
:: StoryData
|
|
14
|
-
{
|
|
15
|
-
"ifid": "2B68ECD6-348F-4CF5-96F8-549A512A8128",
|
|
16
|
-
"format": "Harlowe",
|
|
17
|
-
"formatVersion": "2.1.0",
|
|
18
|
-
"zoom": "1"
|
|
19
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
:: Start
|
|
2
|
-
Content
|
|
3
|
-
|
|
4
|
-
:: StoryTitle
|
|
5
|
-
Title
|
|
6
|
-
|
|
7
|
-
:: UserStylesheet1 [stylesheet]
|
|
8
|
-
1
|
|
9
|
-
|
|
10
|
-
:: UserStylesheet2 [stylesheet]
|
|
11
|
-
2
|
|
12
|
-
|
|
13
|
-
:: StoryData
|
|
14
|
-
{
|
|
15
|
-
"ifid": "2B68ECD6-348F-4CF5-96F8-549A512A8128",
|
|
16
|
-
"format": "Harlowe",
|
|
17
|
-
"formatVersion": "2.1.0",
|
|
18
|
-
"zoom": "1"
|
|
19
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
These are some notes at the top of the file
|
|
3
|
-
*/
|
|
4
|
-
:: StoryTitle
|
|
5
|
-
twineExample
|
|
6
|
-
|
|
7
|
-
:: Start {"position":"102,104","size":"100,100"}
|
|
8
|
-
Start passage
|
|
9
|
-
|
|
10
|
-
:: StoryData
|
|
11
|
-
{
|
|
12
|
-
"ifid": "2B68ECD6-348F-4CF5-96F8-549A512A8128",
|
|
13
|
-
"format": "Harlowe",
|
|
14
|
-
"formatVersion": "2.1.0",
|
|
15
|
-
"zoom": "1"
|
|
16
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
:: StoryTitle
|
|
2
|
-
Example
|
|
3
|
-
|
|
4
|
-
:: StoryData
|
|
5
|
-
{
|
|
6
|
-
"ifid": "A74F654F-3F85-44DE-8A87-9845AECD04B0",
|
|
7
|
-
"format": "Harlowe",
|
|
8
|
-
"formatVersion": "3.2.1",
|
|
9
|
-
"zoom": "1",
|
|
10
|
-
"start": "Untitled Passage"
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
:: Untitled Passage {"position":"100,99","size":"100,100"}
|
|
14
|
-
Double-click this passage to edit it.
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
:: StoryTitle
|
|
2
|
-
twineExample
|
|
3
|
-
|
|
4
|
-
:: Start
|
|
5
|
-
Some content.
|
|
6
|
-
|
|
7
|
-
:: StoryData
|
|
8
|
-
{
|
|
9
|
-
"ifid": 2B68ECD6-348F-4CF5-96F8-549A512A8128",
|
|
10
|
-
"format": "Harlowe",
|
|
11
|
-
"formatVersion": "2.1.0",
|
|
12
|
-
"zoom": "1"
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
:: Script1 [script]
|
|
16
|
-
// Some code
|
|
17
|
-
|
|
18
|
-
:: Script2 [script]
|
|
19
|
-
//More code here!
|
|
20
|
-
|
|
21
|
-
:: Style1 [stylesheet]
|
|
22
|
-
body {font-size: 1.2em}
|
|
23
|
-
|
|
24
|
-
:: Style2 [stylesheet]
|
|
25
|
-
p {font-style: italic;}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
:: StoryTitle
|
|
2
|
-
twineExample
|
|
3
|
-
|
|
4
|
-
:: Start
|
|
5
|
-
Some content.
|
|
6
|
-
|
|
7
|
-
:: StoryData
|
|
8
|
-
{
|
|
9
|
-
"ifid": "2B68ECD6-348F-4CF5-96F8-549A512A8128",
|
|
10
|
-
"format": "Harlowe",
|
|
11
|
-
"formatVersion": "2.1.0",
|
|
12
|
-
"zoom": "1"
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
:: Script1 [script]
|
|
16
|
-
// Some code
|
|
17
|
-
|
|
18
|
-
:: Script2 [script]
|
|
19
|
-
//More code here!
|
|
20
|
-
|
|
21
|
-
:: Style1 [stylesheet]
|
|
22
|
-
body {font-size: 1.2em}
|
|
23
|
-
|
|
24
|
-
:: Style2 [stylesheet]
|
|
25
|
-
p {font-style: italic;}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { compile as compileTwine1HTML } from '../../src/Twine1HTML/compile.js';
|
|
2
|
-
import { Story } from '../../src/Story.js';
|
|
3
|
-
import { readFileSync } from 'fs';
|
|
4
|
-
import Passage from '../../src/Passage.js';
|
|
5
|
-
|
|
6
|
-
describe('Twine1HTMLCompiler', () => {
|
|
7
|
-
describe('compile()', () => {
|
|
8
|
-
it('story should be instanceof Story', () => {
|
|
9
|
-
expect(() => { compileTwine1HTML({}); }).toThrow();
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it('Should create an empty file without valid header.html', function () {
|
|
13
|
-
// Create story.
|
|
14
|
-
const s = new Story();
|
|
15
|
-
|
|
16
|
-
// Compile Twine 1.
|
|
17
|
-
const t1 = compileTwine1HTML(s);
|
|
18
|
-
|
|
19
|
-
// Test.
|
|
20
|
-
expect(t1.length).toBe(0);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('Should replace "VERSION" and "TIME" in mock header.html file', function () {
|
|
24
|
-
// Create story.
|
|
25
|
-
const s = new Story();
|
|
26
|
-
|
|
27
|
-
// Set creator.
|
|
28
|
-
s.creator = 'Test1';
|
|
29
|
-
|
|
30
|
-
// Read mock header.html
|
|
31
|
-
const header = readFileSync('test/Twine1HTML/Twine1HTMLCompiler/test1.html', 'utf-8');
|
|
32
|
-
|
|
33
|
-
// Read engine code.
|
|
34
|
-
const engine = readFileSync('test/Twine1HTML/Twine1HTMLCompiler/Twine1/engine.js', 'utf-8');
|
|
35
|
-
|
|
36
|
-
// Compile file.
|
|
37
|
-
const result = compileTwine1HTML(s, engine, header);
|
|
38
|
-
|
|
39
|
-
// Test for creator.
|
|
40
|
-
expect(result.includes('Test1')).toBe(true);
|
|
41
|
-
|
|
42
|
-
// Test for time.
|
|
43
|
-
expect(result.includes(new Date().getFullYear().toString())).toBe(true);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('Should include Twine engine code', function () {
|
|
47
|
-
// Create story.
|
|
48
|
-
const s = new Story();
|
|
49
|
-
|
|
50
|
-
// Read mock header.html
|
|
51
|
-
const header = readFileSync('test/Twine1HTML/Twine1HTMLCompiler/engineTest.html', 'utf-8');
|
|
52
|
-
|
|
53
|
-
// Read engine code.
|
|
54
|
-
const engine = readFileSync('test/Twine1HTML/Twine1HTMLCompiler/Twine1/engine.js', 'utf-8');
|
|
55
|
-
|
|
56
|
-
// Compile file.
|
|
57
|
-
compileTwine1HTML(s, engine, header);
|
|
58
|
-
|
|
59
|
-
// Read file.
|
|
60
|
-
const result = readFileSync('test/Twine1HTML/Twine1HTMLCompiler/test3.html', 'utf-8');
|
|
61
|
-
|
|
62
|
-
// Test for engine.
|
|
63
|
-
expect(result.includes('function clone(a)')).toBe(true);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it('Should include story format based on name', function () {
|
|
67
|
-
// Create story.
|
|
68
|
-
const s = new Story();
|
|
69
|
-
|
|
70
|
-
// Add passage.
|
|
71
|
-
s.addPassage(new Passage('Start', 'Work'));
|
|
72
|
-
|
|
73
|
-
// Set story start.
|
|
74
|
-
s.start = 'Start';
|
|
75
|
-
|
|
76
|
-
// Read header.html.
|
|
77
|
-
const header = readFileSync('test/Twine1HTML/Twine1HTMLCompiler/jonah-1.4.2/header.html', 'utf-8');
|
|
78
|
-
|
|
79
|
-
// Read code.js.
|
|
80
|
-
const codeJS = readFileSync('test/Twine1HTML/Twine1HTMLCompiler/jonah-1.4.2/code.js', 'utf-8');
|
|
81
|
-
|
|
82
|
-
// Read engine code.
|
|
83
|
-
const engine = readFileSync('test/Twine1HTML/Twine1HTMLCompiler/Twine1/engine.js', 'utf-8');
|
|
84
|
-
|
|
85
|
-
// Compile file.
|
|
86
|
-
const result = compileTwine1HTML(s, engine, header, 'jonah', codeJS);
|
|
87
|
-
|
|
88
|
-
// Test for code.js.
|
|
89
|
-
expect(result.includes('Tale.prototype.canBookmark')).toBe(true);
|
|
90
|
-
|
|
91
|
-
// Test for passage.
|
|
92
|
-
expect(result.includes('tiddler="Start"')).toBe(true);
|
|
93
|
-
|
|
94
|
-
// Test for story size.
|
|
95
|
-
expect(result.includes('data-size="1"')).toBe(true);
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it('Should include story format based on name with jQuery and Modernizr', function () {
|
|
99
|
-
// Create story.
|
|
100
|
-
const s = new Story();
|
|
101
|
-
|
|
102
|
-
// Add passage.
|
|
103
|
-
s.addPassage(new Passage('Start', 'Work'));
|
|
104
|
-
|
|
105
|
-
// Set story start.
|
|
106
|
-
s.start = 'Start';
|
|
107
|
-
|
|
108
|
-
// Read header.html.
|
|
109
|
-
const header = readFileSync('test/Twine1HTML/Twine1HTMLCompiler/jonah-1.4.2/header.html', 'utf-8');
|
|
110
|
-
|
|
111
|
-
// Read code.js.
|
|
112
|
-
const codeJS = readFileSync('test/Twine1HTML/Twine1HTMLCompiler/jonah-1.4.2/code.js', 'utf-8');
|
|
113
|
-
|
|
114
|
-
// Read engine code.
|
|
115
|
-
const engine = readFileSync('test/Twine1HTML/Twine1HTMLCompiler/Twine1/engine.js', 'utf-8');
|
|
116
|
-
|
|
117
|
-
// Read Modernizr.
|
|
118
|
-
const Modernizr = readFileSync('test/Twine1HTML/Twine1HTMLCompiler/Twine1/modernizr.js');
|
|
119
|
-
|
|
120
|
-
// Read jQuery.
|
|
121
|
-
const jQuery = readFileSync('test/Twine1HTML/Twine1HTMLCompiler/Twine1/jquery.js');
|
|
122
|
-
|
|
123
|
-
// Compile file.
|
|
124
|
-
const result = compileTwine1HTML(s, engine, header, 'jonah', codeJS, { jquery: jQuery, modernizr: Modernizr });
|
|
125
|
-
|
|
126
|
-
// Test for code.js.
|
|
127
|
-
expect(result.includes('Tale.prototype.canBookmark')).toBe(true);
|
|
128
|
-
|
|
129
|
-
// Test for passage.
|
|
130
|
-
expect(result.includes('tiddler="Start"')).toBe(true);
|
|
131
|
-
|
|
132
|
-
// Test for story size.
|
|
133
|
-
expect(result.includes('data-size="1"')).toBe(true);
|
|
134
|
-
|
|
135
|
-
// Test for jQuery.
|
|
136
|
-
expect(result.includes('jQuery v1.11.0')).toBe(true);
|
|
137
|
-
|
|
138
|
-
// Test for Modernizr.
|
|
139
|
-
expect(result.includes('Modernizr 2.6.2')).toBe(true);
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
it('Should include story format based on name without jQuery and Modernizr', function () {
|
|
143
|
-
// Create story.
|
|
144
|
-
const s = new Story();
|
|
145
|
-
|
|
146
|
-
// Add passage.
|
|
147
|
-
s.addPassage(new Passage('Start', 'Work'));
|
|
148
|
-
|
|
149
|
-
// Set story start.
|
|
150
|
-
s.start = 'Start';
|
|
151
|
-
|
|
152
|
-
// Read header.html.
|
|
153
|
-
const header = readFileSync('test/Twine1HTML/Twine1HTMLCompiler/jonah-1.4.2/header.html', 'utf-8');
|
|
154
|
-
|
|
155
|
-
// Read code.js.
|
|
156
|
-
const codeJS = readFileSync('test/Twine1HTML/Twine1HTMLCompiler/jonah-1.4.2/code.js', 'utf-8');
|
|
157
|
-
|
|
158
|
-
// Read engine code.
|
|
159
|
-
const engine = readFileSync('test/Twine1HTML/Twine1HTMLCompiler/Twine1/engine.js', 'utf-8');
|
|
160
|
-
|
|
161
|
-
// Compile file.
|
|
162
|
-
const result = compileTwine1HTML(s, engine, header, 'jonah', codeJS, {});
|
|
163
|
-
|
|
164
|
-
// Test for code.js.
|
|
165
|
-
expect(result.includes('Tale.prototype.canBookmark')).toBe(true);
|
|
166
|
-
|
|
167
|
-
// Test for passage.
|
|
168
|
-
expect(result.includes('tiddler="Start"')).toBe(true);
|
|
169
|
-
|
|
170
|
-
// Test for story size.
|
|
171
|
-
expect(result.includes('data-size="1"')).toBe(true);
|
|
172
|
-
|
|
173
|
-
// Test for jQuery
|
|
174
|
-
expect(result.includes('jQuery v1.11.0')).not.toBe(true);
|
|
175
|
-
|
|
176
|
-
// Test for Modernizr
|
|
177
|
-
expect(result.includes('Modernizr 2.6.2')).not.toBe(true);
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
});
|