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
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const jsdom = require('jsdom');
|
|
2
|
+
const { JSDOM } = jsdom;
|
|
3
|
+
|
|
4
|
+
// Test in a DOM context
|
|
5
|
+
const dom = new JSDOM('<!DOCTYPE html><html><body></body></html>');
|
|
6
|
+
const doc = dom.window.document;
|
|
7
|
+
|
|
8
|
+
// Create elements with both encodings
|
|
9
|
+
const div1 = doc.createElement('div');
|
|
10
|
+
div1.setAttribute('data-test', 'test'value');
|
|
11
|
+
const div2 = doc.createElement('div');
|
|
12
|
+
div2.setAttribute('data-test', 'test'value');
|
|
13
|
+
|
|
14
|
+
console.log('div1 getAttribute:', div1.getAttribute('data-test'));
|
|
15
|
+
console.log('div2 getAttribute:', div2.getAttribute('data-test'));
|
|
16
|
+
console.log('Are they equal?', div1.getAttribute('data-test') === div2.getAttribute('data-test'));
|
|
17
|
+
|
|
18
|
+
// Test with innerHTML
|
|
19
|
+
div1.innerHTML = 'Text with 'quote'';
|
|
20
|
+
div2.innerHTML = 'Text with 'quote'';
|
|
21
|
+
console.log('div1 textContent:', div1.textContent);
|
|
22
|
+
console.log('div2 textContent:', div2.textContent);
|
|
23
|
+
console.log('Text content equal?', div1.textContent === div2.textContent);
|
|
24
|
+
|
|
25
|
+
// Test parsing HTML with both
|
|
26
|
+
const html1 = '<tw-passagedata name="Test" data-value="It's">Content</tw-passagedata>';
|
|
27
|
+
const html2 = '<tw-passagedata name="Test" data-value="It's">Content</tw-passagedata>';
|
|
28
|
+
|
|
29
|
+
const container1 = doc.createElement('div');
|
|
30
|
+
const container2 = doc.createElement('div');
|
|
31
|
+
container1.innerHTML = html1;
|
|
32
|
+
container2.innerHTML = html2;
|
|
33
|
+
|
|
34
|
+
const passage1 = container1.querySelector('tw-passagedata');
|
|
35
|
+
const passage2 = container2.querySelector('tw-passagedata');
|
|
36
|
+
|
|
37
|
+
console.log('\nParsing tw-passagedata:');
|
|
38
|
+
console.log('passage1 data-value:', passage1.getAttribute('data-value'));
|
|
39
|
+
console.log('passage2 data-value:', passage2.getAttribute('data-value'));
|
|
40
|
+
console.log('Attributes equal?', passage1.getAttribute('data-value') === passage2.getAttribute('data-value'));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "extwee",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.13",
|
|
4
4
|
"description": "A story compiler tool using Twine-compatible formats",
|
|
5
5
|
"author": "Dan Cox",
|
|
6
6
|
"main": "index.js",
|
|
@@ -36,33 +36,33 @@
|
|
|
36
36
|
"commander": "^14.0.2",
|
|
37
37
|
"graphemer": "^1.4.0",
|
|
38
38
|
"html-entities": "^2.6.0",
|
|
39
|
-
"node-html-parser": "^7.0.
|
|
39
|
+
"node-html-parser": "^7.0.2",
|
|
40
40
|
"pickleparser": "^0.2.1",
|
|
41
41
|
"semver": "^7.7.3",
|
|
42
42
|
"shelljs": "^0.10.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@babel/cli": "^7.28.
|
|
46
|
-
"@babel/core": "^7.28.
|
|
47
|
-
"@babel/preset-env": "^7.28.
|
|
48
|
-
"@eslint/js": "^9.39.
|
|
49
|
-
"@inquirer/prompts": "^8.0
|
|
50
|
-
"@types/node": "^
|
|
45
|
+
"@babel/cli": "^7.28.6",
|
|
46
|
+
"@babel/core": "^7.28.6",
|
|
47
|
+
"@babel/preset-env": "^7.28.6",
|
|
48
|
+
"@eslint/js": "^9.39.2",
|
|
49
|
+
"@inquirer/prompts": "^8.2.0",
|
|
50
|
+
"@types/node": "^25.0.9",
|
|
51
51
|
"@types/semver": "^7.7.1",
|
|
52
52
|
"babel-loader": "^10.0.0",
|
|
53
53
|
"clean-jsdoc-theme": "^4.3.0",
|
|
54
54
|
"core-js": "^3.47.0",
|
|
55
|
-
"eslint": "^9.39.
|
|
56
|
-
"eslint-plugin-jest": "^29.1
|
|
57
|
-
"eslint-plugin-jsdoc": "^
|
|
58
|
-
"globals": "^
|
|
55
|
+
"eslint": "^9.39.2",
|
|
56
|
+
"eslint-plugin-jest": "^29.12.1",
|
|
57
|
+
"eslint-plugin-jsdoc": "^62.3.0",
|
|
58
|
+
"globals": "^17.0.0",
|
|
59
59
|
"jest": "^30.2.0",
|
|
60
60
|
"jest-environment-jsdom": "^30.2.0",
|
|
61
61
|
"regenerator-runtime": "^0.14.1",
|
|
62
62
|
"typescript": "^5.9.3",
|
|
63
|
-
"typescript-eslint": "^8.
|
|
64
|
-
"webpack": "^5.
|
|
65
|
-
"webpack-bundle-analyzer": "^5.
|
|
63
|
+
"typescript-eslint": "^8.53.1",
|
|
64
|
+
"webpack": "^5.104.1",
|
|
65
|
+
"webpack-bundle-analyzer": "^5.1.1",
|
|
66
66
|
"webpack-cli": "^6.0.1"
|
|
67
67
|
},
|
|
68
68
|
"repository": {
|
|
@@ -73,5 +73,8 @@
|
|
|
73
73
|
"url": "https://github.com/videlais/extwee/issues"
|
|
74
74
|
},
|
|
75
75
|
"type": "module",
|
|
76
|
-
"types": "./types/index.d.ts"
|
|
76
|
+
"types": "./types/index.d.ts",
|
|
77
|
+
"engines": {
|
|
78
|
+
"node": ">=18.18.0"
|
|
79
|
+
}
|
|
77
80
|
}
|
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.
|
|
10
|
+
const creatorVersion = '2.3.13';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Story class.
|
|
@@ -436,7 +436,7 @@ class Story {
|
|
|
436
436
|
if (Object.prototype.hasOwnProperty.call(metadata, 'tag-colors')) {
|
|
437
437
|
this.tagColors = metadata['tag-colors'];
|
|
438
438
|
}
|
|
439
|
-
} catch
|
|
439
|
+
} catch {
|
|
440
440
|
// Ignore errors.
|
|
441
441
|
}
|
|
442
442
|
|
package/types/src/Story.d.ts
CHANGED
package/.github/FUNDING.yml
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
name: "CodeQL"
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ develop ]
|
|
6
|
-
paths-ignore:
|
|
7
|
-
- 'test/**'
|
|
8
|
-
pull_request:
|
|
9
|
-
branches: [ develop ]
|
|
10
|
-
paths-ignore:
|
|
11
|
-
- 'test/**'
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
analyze:
|
|
15
|
-
name: Analyze
|
|
16
|
-
runs-on: ubuntu-latest
|
|
17
|
-
|
|
18
|
-
strategy:
|
|
19
|
-
fail-fast: false
|
|
20
|
-
matrix:
|
|
21
|
-
language: [ 'javascript' ]
|
|
22
|
-
|
|
23
|
-
steps:
|
|
24
|
-
- name: Checkout repository
|
|
25
|
-
uses: actions/checkout@v3
|
|
26
|
-
|
|
27
|
-
- name: Initialize CodeQL
|
|
28
|
-
uses: github/codeql-action/init@v2
|
|
29
|
-
with:
|
|
30
|
-
languages: ${{ matrix.language }}
|
|
31
|
-
|
|
32
|
-
- name: Perform CodeQL Analysis
|
|
33
|
-
uses: github/codeql-action/analyze@v2
|
|
34
|
-
with:
|
|
35
|
-
upload: false # disable the upload here - we will upload in a different action
|
|
36
|
-
output: sarif-results
|
|
37
|
-
|
|
38
|
-
- name: filter-sarif
|
|
39
|
-
uses: advanced-security/filter-sarif@v1
|
|
40
|
-
with:
|
|
41
|
-
# filter out all test files unless they contain a sql-injection vulnerability
|
|
42
|
-
patterns:
|
|
43
|
-
-test/**/*
|
|
44
|
-
+test/**/*:js/sql-injection
|
|
45
|
-
input: sarif-results/${{ matrix.language }}.sarif
|
|
46
|
-
output: sarif-results/${{ matrix.language }}.sarif
|
|
47
|
-
|
|
48
|
-
- name: Upload SARIF
|
|
49
|
-
uses: github/codeql-action/upload-sarif@v2
|
|
50
|
-
with:
|
|
51
|
-
sarif_file: sarif-results/${{ matrix.language }}.sarif
|
package/.github/dependabot.yml
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
-
# package ecosystems to update and where the package manifests are located.
|
|
3
|
-
# Please see the documentation for all configuration options:
|
|
4
|
-
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
5
|
-
|
|
6
|
-
version: 2
|
|
7
|
-
updates:
|
|
8
|
-
- package-ecosystem: "npm" # See documentation for possible values
|
|
9
|
-
directory: "/" # Location of package manifests
|
|
10
|
-
schedule:
|
|
11
|
-
interval: "monthly"
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
name: Dependabot auto-merge
|
|
2
|
-
on: pull_request
|
|
3
|
-
|
|
4
|
-
permissions:
|
|
5
|
-
contents: write
|
|
6
|
-
pull-requests: write
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
dependabot:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'videlais/extwee'
|
|
12
|
-
steps:
|
|
13
|
-
- name: Dependabot metadata
|
|
14
|
-
id: metadata
|
|
15
|
-
uses: dependabot/fetch-metadata@d7267f607e9d3fb96fc2fbe83e0af444713e90b7
|
|
16
|
-
with:
|
|
17
|
-
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
|
18
|
-
- name: Enable auto-merge for Dependabot PRs
|
|
19
|
-
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
|
|
20
|
-
run: gh pr merge --auto --merge "$PR_URL"
|
|
21
|
-
env:
|
|
22
|
-
PR_URL: ${{github.event.pull_request.html_url}}
|
|
23
|
-
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
name: Node CI
|
|
2
|
-
|
|
3
|
-
on: [push]
|
|
4
|
-
|
|
5
|
-
permissions:
|
|
6
|
-
contents: read
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
build:
|
|
10
|
-
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
|
|
13
|
-
strategy:
|
|
14
|
-
matrix:
|
|
15
|
-
node-version: [23.x]
|
|
16
|
-
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v4
|
|
19
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
20
|
-
uses: actions/setup-node@v4
|
|
21
|
-
with:
|
|
22
|
-
node-version: ${{ matrix.node-version }}
|
|
23
|
-
- run: npm install
|
|
24
|
-
- run: npm run lint
|
|
25
|
-
- run: npm run lint:test
|
|
26
|
-
- run: npm run test
|
|
27
|
-
env:
|
|
28
|
-
CI: true
|
package/.travis.yml
DELETED
package/babel.config.json
DELETED
package/docs/.nojekyll
DELETED
|
File without changes
|
package/docs/README.md
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
<a name="readme-top"></a>
|
|
2
|
-
|
|
3
|
-
[](https://codecov.io/gh/videlais/extwee)
|
|
4
|
-
|
|
5
|
-
[](https://badge.fury.io/js/extwee)
|
|
6
|
-
|
|
7
|
-
[](https://opensource.org/licenses/MIT)
|
|
8
|
-
|
|
9
|
-
[](https://www.npmjs.com/package/extwee)
|
|
10
|
-
|
|
11
|
-
## Table of Contents
|
|
12
|
-
|
|
13
|
-
<ol>
|
|
14
|
-
<li><a href="#story-compilation">Story Compilation</a></li>
|
|
15
|
-
<li><a href="#format-support">Format Support</a></li>
|
|
16
|
-
<li><a href="#usage">Node and Web API</a></li>
|
|
17
|
-
<ol>
|
|
18
|
-
<li><a href="#objects">Objects</a></li>
|
|
19
|
-
<li><a href="#parsers">Parsers</a></li>
|
|
20
|
-
<li><a href="#compilers">Compilers</a></li>
|
|
21
|
-
</ol>
|
|
22
|
-
<li><a href="#web-build-imports">Web Build Imports</a></li>
|
|
23
|
-
<li><a href="#documentation">Documentation</a></li>
|
|
24
|
-
<li><a href="#command-line-usage">Command-Line Usage</a></li>
|
|
25
|
-
<li><a href="#config-file-usage">Config File Usage</a></li>
|
|
26
|
-
<li><a href="#escaping- meta-characters">Escaping Meta-Characters</a></li>
|
|
27
|
-
<li><a href="#license">License</a></li>
|
|
28
|
-
</ol>
|
|
29
|
-
|
|
30
|
-
## Story Compilation
|
|
31
|
-
|
|
32
|
-
The process of *story compilation* converts human-readable content, what is generally called a *story*, into a playable format such as HyperText Markup Language (HTML). The result is then presented as links or other visual, interactive elements for another party.
|
|
33
|
-
|
|
34
|
-
The term *compilation* is used because different parts of code are put together in a specific arrangement to enable later play. As part of Twine-compatible HTML, this means combining JavaScript code (generally a "story format") with story HTML data.
|
|
35
|
-
|
|
36
|
-
Extwee is **not** an authoring tool. It cannot be used to create story content. This data must be created using other tools or processes. Extwee can then *compile* the content with story format code to produce something playable.
|
|
37
|
-
|
|
38
|
-
Playable formats are the following and require external story formats[^1] to enable play:
|
|
39
|
-
|
|
40
|
-
- Twine 2 HTML
|
|
41
|
-
- Twine 1 HTML
|
|
42
|
-
|
|
43
|
-
More human-readable formats include:
|
|
44
|
-
|
|
45
|
-
- Twee 3[^2]
|
|
46
|
-
- Twine 2 JSON[^3]
|
|
47
|
-
|
|
48
|
-
From 2009 to 2015, Twine 1 supported a now [historical format named TWS](https://github.com/iftechfoundation/twine-specs/blob/master/twine-1-twsoutput.md). This was a binary format used for archival purposes. Extwee can read this format but does not support creating it because no other tools, including current versions of Twine, accept it as valid input.
|
|
49
|
-
|
|
50
|
-
Twine 2 supports exporting a collection of stories (known as a *library*) in the [Twine 2 Archive HTML format](https://github.com/iftechfoundation/twine-specs/blob/master/twine-2-archive-spec.md). Extwee can also read and write this format, creating either a collection of stories from the data or writing a collection of internal objects to a file.
|
|
51
|
-
|
|
52
|
-
[^1]: Extwee does not include or publish story formats. These can be found in the [Story Format Archive (SFA)](https://github.com/videlais/story-formats-archive).
|
|
53
|
-
|
|
54
|
-
[^2]: Twee exists in three versions. The first existed between 2006 to 2009 and was part of Twine 1. The move to Twine 2 in 2009 dropped support and the story compilation tools [Twee2](https://dan-q.github.io/twee2/) and [Tweego](https://www.motoslave.net/tweego/) adopted their own extensions and modifications. Beginning in 2017, work was done to unite the different projects. This resulted in [Twee 3](https://github.com/iftechfoundation/twine-specs/blob/master/twee-3-specification.md) in March 2021.
|
|
55
|
-
|
|
56
|
-
[^3]: In October 2023, JavaScript Object Notation (JSON) was added as a supported community format for story compilation tools. Extwee is the first tool to support this format.
|
|
57
|
-
|
|
58
|
-
## Format Support
|
|
59
|
-
|
|
60
|
-
Extwee supports multiple historical and current Twine-compatible formats.
|
|
61
|
-
|
|
62
|
-
| Format | Input | Output |
|
|
63
|
-
|----------------------------------------------------------------------------------------------------------------------------------|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
64
|
-
| [Twine 1 HTML (2006 - 2015)]( https://github.com/iftechfoundation/twine-specs/blob/master/twine-1-htmloutput-doc.md ) | Yes | Partial support. Twine 1 HTML can be produced, but the `StorySettings` optional passage introduced in Twine 1.4.0 requires external libraries like jQuery not included with Extwee. |
|
|
65
|
-
| [Twine 1 TWS (2009 - 2015)]( https://github.com/iftechfoundation/twine-specs/blob/master/twine-1-twsoutput.md ) | Yes | Extwee does not support TWS (Python pickle) output because no current version of Twine or other story compilation tool produces this historical format. |
|
|
66
|
-
| [Twine 2 HTML (2015 - Present)]( https://github.com/iftechfoundation/twine-specs/blob/master/twine-2-htmloutput-spec.md ) | Yes | Yes |
|
|
67
|
-
| [Twine 2 Archive HTML (2015 - Present)]( https://github.com/iftechfoundation/twine-specs/blob/master/twine-2-archive-spec.md ) | Yes | Yes |
|
|
68
|
-
| [Twee 3 (2021 - Present)]( https://github.com/iftechfoundation/twine-specs/blob/master/twee-3-specification.md ) | Yes | Yes |
|
|
69
|
-
| [Twine 2 JSON (2023 - Present)]( https://github.com/iftechfoundation/twine-specs/blob/master/twine-2-jsonoutput-doc.md ) | Yes | Yes |
|
|
70
|
-
| [Twine 2 Story Format (2015 - Present)]( https://github.com/iftechfoundation/twine-specs/blob/master/twine-2-storyformats-spec.md ) | Yes | Yes |
|
|
71
|
-
|
|
72
|
-
**Note:** Round-trip translations can present problems because of required fields and properties per format. Some metadata may be added or removed based on the specification being followed.
|
|
73
|
-
|
|
74
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
75
|
-
|
|
76
|
-
## Node and Web API
|
|
77
|
-
|
|
78
|
-
The following objects and methods are available in Node.js or browser contexts.
|
|
79
|
-
|
|
80
|
-
**Note:** When used in a browser context, all objects and methods are part of the `window.Extwee` global.
|
|
81
|
-
|
|
82
|
-
### Objects
|
|
83
|
-
|
|
84
|
-
An object must be created using either the `new` keyword in JavaScript or as the result of parsing data.
|
|
85
|
-
|
|
86
|
-
- `StoryFormat`
|
|
87
|
-
- `Passage`
|
|
88
|
-
- `Story`
|
|
89
|
-
|
|
90
|
-
Story and Passage objects can generate multiple output formats: `toTwee()`, `toTwine1HTML()`, `toTwine2HTML()`, and `toJSON()`. Stories cannot be played in a browser without the corresponding compiler combining it with story format data.
|
|
91
|
-
|
|
92
|
-
The StoryFormat object supports `toString()` method of producing a tab-separated JSON output and `toJSON()` method of generating JSON output matching the Twine 2 Story Format Specification.
|
|
93
|
-
|
|
94
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
95
|
-
|
|
96
|
-
### Parsers
|
|
97
|
-
|
|
98
|
-
Translates output formats such as HTML, Twee, JSON, or JSONP into objects.
|
|
99
|
-
|
|
100
|
-
**Note:** Twine 1 story formats exist across multiple files (`header.html` and optional `code.js`). They cannot be parsed into a `StoryFormat` object.
|
|
101
|
-
|
|
102
|
-
- `parseTwee()`
|
|
103
|
-
- `parseJSON()`
|
|
104
|
-
- `parseStoryFormat()`
|
|
105
|
-
- `parseTwine1HTML()`
|
|
106
|
-
- `parseTwine2HTML()`
|
|
107
|
-
- `parseTwine2ArchiveHTML()`
|
|
108
|
-
|
|
109
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
110
|
-
|
|
111
|
-
### Compilers
|
|
112
|
-
|
|
113
|
-
Compiles story, story formats, or other data into an archive or playable format.
|
|
114
|
-
|
|
115
|
-
- `compileTwine2HTML()`
|
|
116
|
-
- `compileTwine1HTML()`
|
|
117
|
-
- `compileTwine2ArchiveHTML()`
|
|
118
|
-
- `compileStoryFormat()`
|
|
119
|
-
|
|
120
|
-
To create playable Twine 1 HTML, an `engine.js` file must be supplied. (See [Story Format Archive](https://github.com/videlais/story-formats-archive/tree/main/official/twine1/engine/1.4.2) for available Twine 1 `engine.js` file.)
|
|
121
|
-
|
|
122
|
-
Compilation of a story format adds the necessary function wrapper to convert the JSON output, via `toJSON()`, to JSONP.
|
|
123
|
-
|
|
124
|
-
### Support Functionality
|
|
125
|
-
|
|
126
|
-
Multiple Twine formats support using [an IFID](https://ifdb.org/help-ifid) to identify one work from another.
|
|
127
|
-
|
|
128
|
-
As part of its API, the Extwee method `generateIFID()` can be used to create a new IFID for a `Story` object or as part of other processes.
|
|
129
|
-
|
|
130
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
131
|
-
|
|
132
|
-
## Web Build Imports
|
|
133
|
-
|
|
134
|
-
For users who want to use pre-built, minified versions optimized for browser environments, Extwee provides several web build exports:
|
|
135
|
-
|
|
136
|
-
### Available Web Builds
|
|
137
|
-
|
|
138
|
-
- **Core Build**: `import Extwee from 'extwee/web'` - Complete functionality including parsers, compilers, and core utilities
|
|
139
|
-
- **Twine 1 HTML**: `import Extwee from 'extwee/web/twine1html'` - Specialized for Twine 1 HTML parsing and compilation
|
|
140
|
-
- **Twine 2 Archive HTML**: `import Extwee from 'extwee/web/twine2archive'` - Specialized for Twine 2 Archive HTML parsing and compilation
|
|
141
|
-
- **TWS Format**: `import Extwee from 'extwee/web/tws'` - Specialized for TWS (Twine 1 workspace) parsing
|
|
142
|
-
|
|
143
|
-
### Usage Examples
|
|
144
|
-
|
|
145
|
-
```javascript
|
|
146
|
-
// Use the full core build
|
|
147
|
-
import Extwee from 'extwee/web';
|
|
148
|
-
const story = new Extwee.Story();
|
|
149
|
-
const ifid = Extwee.generateIFID();
|
|
150
|
-
|
|
151
|
-
// Use a specialized build for smaller bundle size
|
|
152
|
-
import Extwee from 'extwee/web/twine1html';
|
|
153
|
-
const story = Extwee.parseTwine1HTML(htmlContent);
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
These web builds are UMD-compatible and can be used with module bundlers like webpack, or loaded directly in browsers. They are optimized and minified for production use.
|
|
157
|
-
|
|
158
|
-
**Note:** Web builds include their dependencies bundled, making them suitable for browser environments but larger than the Node.js imports which rely on external dependencies.
|
|
159
|
-
|
|
160
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
161
|
-
|
|
162
|
-
## Documentation
|
|
163
|
-
|
|
164
|
-
Extwee has [documentation hosted on GitHub Pages](https://videlais.github.io/extwee/#/).
|
|
165
|
-
|
|
166
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
167
|
-
|
|
168
|
-
## Command-Line Usage
|
|
169
|
-
|
|
170
|
-
Extwee supports a command-line interface for four general scenarios.
|
|
171
|
-
|
|
172
|
-
**Notes:** As of Extwee 2.2.5, short and long command-line option flags are separated. Short options use one hyphen followed by one character and all long options begin with two hyphens and a name as word.
|
|
173
|
-
|
|
174
|
-
### Compiling Twee 3 + Twine 2 Story Format into Twine 2 HTML
|
|
175
|
-
|
|
176
|
-
Compile Twee 3 + StoryFormat into Twine 2 HTML:
|
|
177
|
-
|
|
178
|
-
`extwee -c -i <tweeFile> -s <storyFormat> -o <Twine2HTML>`
|
|
179
|
-
|
|
180
|
-
### De-compiling Twine 2 HTML into Twee 3
|
|
181
|
-
|
|
182
|
-
De-compile Twine 2 HTML into Twee 3:
|
|
183
|
-
|
|
184
|
-
`extwee -d -i <twine2HTML> -o <outputTwee>`
|
|
185
|
-
|
|
186
|
-
### Compiling Twee 3 into Twine 1 HTML
|
|
187
|
-
|
|
188
|
-
Enabling Twine 1 mode requires using the `--twine1` long flag.
|
|
189
|
-
|
|
190
|
-
Because Twine 1 story formats can be split across files, compilation requires the "engine" from Twine 1 named `engine.js`, the name of the story format, and then its `header.html` template code and the optional but often included `code.js` file.
|
|
191
|
-
|
|
192
|
-
(Refer to the [Story Formats Archive](https://github.com/videlais/story-formats-archive) for access to historic `engine.js` and other files.)
|
|
193
|
-
|
|
194
|
-
`extwee --twine1 -c -i <tweeFile> -o <Twine1HTML> --engine <engineJS> --name <storyFormatName> --codejs <CodeJS> --header <header>`
|
|
195
|
-
|
|
196
|
-
### De-compiling Twine 1 HTML into Twee 3
|
|
197
|
-
|
|
198
|
-
Enabling Twine 1 mode requires using the `--twine1` flag.
|
|
199
|
-
|
|
200
|
-
`extwee --twine1 -d -i <twine1HTML> -o <outputTwee>`
|
|
201
|
-
|
|
202
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
203
|
-
|
|
204
|
-
## Config File Usage
|
|
205
|
-
|
|
206
|
-
When invoked from its command-line interface using `npx extwee`, it will look for a `extwee.config.json` file in the local directory. If found, and its fields are valid, processing will use the values found in the file.
|
|
207
|
-
|
|
208
|
-
Consult the possible options in its [dedicated file](extwee.config.md).
|
|
209
|
-
|
|
210
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
211
|
-
|
|
212
|
-
## Tree Shaking Support
|
|
213
|
-
|
|
214
|
-
For [advanced tree shaking](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking) patterns, most formats are broke into `compile.js` and `parse.js` files exporting associated `compile()` and `parse()` functions.
|
|
215
|
-
|
|
216
|
-
When using the API, it is possible to only import a single function or object to produce smaller and potentially faster code in projects dependent on Extwee functionality.
|
|
217
|
-
|
|
218
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
219
|
-
|
|
220
|
-
## License
|
|
221
|
-
|
|
222
|
-
Distributed under the MIT License. See `LICENSE.txt` for more information.
|
|
223
|
-
|
|
224
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
package/docs/_sidebar.md
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
- Installation and General Usage
|
|
2
|
-
- [Using NPX (as part of workflow)](/install/npx.md)
|
|
3
|
-
- [Using NPM (via API)](/install/npm.md)
|
|
4
|
-
- Objects
|
|
5
|
-
- [Passage](/objects/passage.md)
|
|
6
|
-
- [Story](/objects/story.md)
|
|
7
|
-
- [Story Format](/objects/storyformat.md)
|
|
8
|
-
- Formats
|
|
9
|
-
- [Twee 3](/formats/twee.md)
|
|
10
|
-
- [Twine 2 HTML](/formats/twine2HTML.md)
|
|
11
|
-
- [Twine 2 JSON](/formats/json.md)
|
|
12
|
-
- [Twine 2 Archive HTML](/formats/twine2ArchiveHTML.md)
|
|
13
|
-
- [Twine 1 HTML](/formats/twine1HTML.md)
|
|
14
|
-
- [Twine 1 TWS](/formats/tws.md)
|
|
15
|
-
|
|
16
|
-
- Examples
|
|
17
|
-
- [Dynamically Generating Passages](/examples/dynamicPassages.md)
|
|
18
|
-
- [Converting Twine 2 JSON into Twee 3](/examples/jsonToTwee.md)
|
|
19
|
-
- [Converting Twine 1 TWS into Twee 3](/examples/twsToTwee.md)
|