diff --git a/docs/extwee/2.2.0/JSONParser.js.html b/docs/extwee/2.2.0/JSONParser.js.html index b2f445be..9e5a8be0 100644 --- a/docs/extwee/2.2.0/JSONParser.js.html +++ b/docs/extwee/2.2.0/JSONParser.js.html @@ -1,6 +1,6 @@ Source: JSONParser.js
On this page

JSONParser.js

import Story from './Story.js';
+    
On this page

JSONParser.js

import Story from './Story.js';
 import Passage from './Passage.js';
 
 export default class JSONParser {
@@ -127,4 +127,4 @@
     return s;
   }
 }
-
\ No newline at end of file +
Home
\ No newline at end of file diff --git a/docs/extwee/2.2.0/Passage.js.html b/docs/extwee/2.2.0/Passage.js.html index ecdbf5c9..2362d81d 100644 --- a/docs/extwee/2.2.0/Passage.js.html +++ b/docs/extwee/2.2.0/Passage.js.html @@ -1,6 +1,6 @@ Source: Passage.js
On this page

Passage.js

/**
+    
On this page

Passage.js

/**
  * A passage is the smallest unit of a Twine story.
  */
 export default class Passage {
@@ -298,4 +298,4 @@
     return passageData;
   }
 }
-
\ No newline at end of file +
Home
\ No newline at end of file diff --git a/docs/extwee/2.2.0/Story.js.html b/docs/extwee/2.2.0/Story.js.html index dcd10d7c..b21fb334 100644 --- a/docs/extwee/2.2.0/Story.js.html +++ b/docs/extwee/2.2.0/Story.js.html @@ -1,6 +1,6 @@ Source: Story.js
On this page

Story.js

import Passage from './Passage.js';
+    
On this page

Story.js

import Passage from './Passage.js';
 import { v4 as uuidv4 } from 'uuid';
 
 const creatorName = 'extwee';
@@ -650,4 +650,4 @@
     return outputContents;
   }
 }
-
\ No newline at end of file +
Home
\ No newline at end of file diff --git a/docs/extwee/2.2.0/StoryFormat.js.html b/docs/extwee/2.2.0/StoryFormat.js.html index 49b5faf7..3e5613c2 100644 --- a/docs/extwee/2.2.0/StoryFormat.js.html +++ b/docs/extwee/2.2.0/StoryFormat.js.html @@ -1,6 +1,6 @@ Source: StoryFormat.js
On this page

StoryFormat.js

export default class StoryFormat {
+    
On this page

StoryFormat.js

export default class StoryFormat {
   /**
    * Internal name.
    * @private
@@ -281,4 +281,4 @@
     return JSON.stringify(s);
   }
 }
-
\ No newline at end of file +
Home
\ No newline at end of file diff --git a/docs/extwee/2.2.0/StoryFormatParser.js.html b/docs/extwee/2.2.0/StoryFormatParser.js.html index 249143c3..eb317fff 100644 --- a/docs/extwee/2.2.0/StoryFormatParser.js.html +++ b/docs/extwee/2.2.0/StoryFormatParser.js.html @@ -1,6 +1,6 @@ Source: StoryFormatParser.js
On this page

StoryFormatParser.js

import StoryFormat from './StoryFormat.js';
+    
On this page

StoryFormatParser.js

import StoryFormat from './StoryFormat.js';
 import semver from 'semver';
 
 export default class StoryFormatParser {
@@ -134,4 +134,4 @@
     );
   }
 }
-
\ No newline at end of file +
Home
\ No newline at end of file diff --git a/docs/extwee/2.2.0/TWSParser.js.html b/docs/extwee/2.2.0/TWSParser.js.html index 4f45c580..b336e1f8 100644 --- a/docs/extwee/2.2.0/TWSParser.js.html +++ b/docs/extwee/2.2.0/TWSParser.js.html @@ -1,6 +1,6 @@ Source: TWSParser.js
On this page

TWSParser.js

import Story from './Story.js';
+    
On this page

TWSParser.js

import Story from './Story.js';
 import Passage from './Passage.js';
 import { Parser } from 'pickleparser';
 
@@ -86,4 +86,4 @@
     return result;
   }
 }
-
\ No newline at end of file +
Home
\ No newline at end of file diff --git a/docs/extwee/2.2.0/TweeParser.js.html b/docs/extwee/2.2.0/TweeParser.js.html index de063cfd..623de7ab 100644 --- a/docs/extwee/2.2.0/TweeParser.js.html +++ b/docs/extwee/2.2.0/TweeParser.js.html @@ -1,6 +1,6 @@ Source: TweeParser.js
On this page

TweeParser.js

import Passage from './Passage.js';
+    
On this page

TweeParser.js

import Passage from './Passage.js';
 import Story from './Story.js';
 
 export default class TweeParser {
@@ -157,4 +157,4 @@
     return story;
   }
 }
-
\ No newline at end of file +
Home
\ No newline at end of file diff --git a/docs/extwee/2.2.0/Twine1HTMLCompiler.js.html b/docs/extwee/2.2.0/Twine1HTMLCompiler.js.html index f4768453..6ae0ccdd 100644 --- a/docs/extwee/2.2.0/Twine1HTMLCompiler.js.html +++ b/docs/extwee/2.2.0/Twine1HTMLCompiler.js.html @@ -1,6 +1,6 @@ Source: Twine1HTMLCompiler.js
On this page

Twine1HTMLCompiler.js

import Story from './Story.js';
+    
On this page

Twine1HTMLCompiler.js

import Story from './Story.js';
 
 export default class Twine1HTMLCompiler {
   /**
@@ -58,4 +58,4 @@
     return header;
   }
 }
-
\ No newline at end of file +
Home
\ No newline at end of file diff --git a/docs/extwee/2.2.0/Twine1HTMLParser.js.html b/docs/extwee/2.2.0/Twine1HTMLParser.js.html index ed53cd53..00d7c40c 100644 --- a/docs/extwee/2.2.0/Twine1HTMLParser.js.html +++ b/docs/extwee/2.2.0/Twine1HTMLParser.js.html @@ -1,6 +1,6 @@ Source: Twine1HTMLParser.js
On this page

Twine1HTMLParser.js

import { parse as HtmlParser } from 'node-html-parser';
+    
On this page

Twine1HTMLParser.js

import { parse as HtmlParser } from 'node-html-parser';
 import Passage from './Passage.js';
 import Story from './Story.js';
 
@@ -134,4 +134,4 @@
     return s;
   }
 }
-
\ No newline at end of file +
Home
\ No newline at end of file diff --git a/docs/extwee/2.2.0/Twine2ArchiveHTMLCompiler.js.html b/docs/extwee/2.2.0/Twine2ArchiveHTMLCompiler.js.html index e75bbff9..9ff7c342 100644 --- a/docs/extwee/2.2.0/Twine2ArchiveHTMLCompiler.js.html +++ b/docs/extwee/2.2.0/Twine2ArchiveHTMLCompiler.js.html @@ -1,6 +1,6 @@ Source: Twine2ArchiveHTMLCompiler.js
On this page

Twine2ArchiveHTMLCompiler.js

import Story from './Story.js';
+    
On this page

Twine2ArchiveHTMLCompiler.js

import Story from './Story.js';
 
 export default class Twine2ArchiveHTMLCompiler {
   /**
@@ -36,4 +36,4 @@
     return outputContents;
   }
 }
-
\ No newline at end of file +
Home
\ No newline at end of file diff --git a/docs/extwee/2.2.0/Twine2ArchiveHTMLParser.js.html b/docs/extwee/2.2.0/Twine2ArchiveHTMLParser.js.html index 4e7a2cf7..35369c75 100644 --- a/docs/extwee/2.2.0/Twine2ArchiveHTMLParser.js.html +++ b/docs/extwee/2.2.0/Twine2ArchiveHTMLParser.js.html @@ -1,6 +1,6 @@ Source: Twine2ArchiveHTMLParser.js
On this page

Twine2ArchiveHTMLParser.js

import { parse as HtmlParser } from 'node-html-parser';
+    
On this page

Twine2ArchiveHTMLParser.js

import { parse as HtmlParser } from 'node-html-parser';
 import Twine2HTMLParser from './Twine2HTMLParser.js';
 
 export default class Twine2ArchiveHTMLParser {
@@ -49,4 +49,4 @@
     return outputArray;
   }
 }
-
\ No newline at end of file +
Home
\ No newline at end of file diff --git a/docs/extwee/2.2.0/Twine2HTMLCompiler.js.html b/docs/extwee/2.2.0/Twine2HTMLCompiler.js.html index 44067d6b..1ada3434 100644 --- a/docs/extwee/2.2.0/Twine2HTMLCompiler.js.html +++ b/docs/extwee/2.2.0/Twine2HTMLCompiler.js.html @@ -1,6 +1,6 @@ Source: Twine2HTMLCompiler.js
On this page

Twine2HTMLCompiler.js

import Story from './Story.js';
+    
On this page

Twine2HTMLCompiler.js

import Story from './Story.js';
 import StoryFormat from './StoryFormat.js';
 
 export default class Twine2HTMLCompiler {
@@ -35,4 +35,4 @@
     return outputContents;
   }
 }
-
\ No newline at end of file +
Home
\ No newline at end of file diff --git a/docs/extwee/2.2.0/Twine2HTMLParser.js.html b/docs/extwee/2.2.0/Twine2HTMLParser.js.html index 8bb87230..41128928 100644 --- a/docs/extwee/2.2.0/Twine2HTMLParser.js.html +++ b/docs/extwee/2.2.0/Twine2HTMLParser.js.html @@ -1,6 +1,6 @@ Source: Twine2HTMLParser.js
On this page

Twine2HTMLParser.js

import { parse as HtmlParser } from 'node-html-parser';
+    
On this page

Twine2HTMLParser.js

import { parse as HtmlParser } from 'node-html-parser';
 import Story from './Story.js';
 import Passage from './Passage.js';
 
@@ -347,4 +347,4 @@
     return result;
   }
 }
-
\ No newline at end of file +
Home
\ No newline at end of file diff --git a/docs/extwee/2.2.0/global.html b/docs/extwee/2.2.0/global.html index 2c5c6564..4615cae2 100644 --- a/docs/extwee/2.2.0/global.html +++ b/docs/extwee/2.2.0/global.html @@ -1,3 +1,3 @@ Global
On this page

Members

IFID

Interactive Fiction ID (IFID) of Story

IFID

author

Author

author

creator

Program used to create Story.

creator

creatorVersion

Version used to create Story.

creatorVersion

description

Description

description

format

Story format of Story.

format

formatVersion

Story format version of Story.

formatVersion

image

Image

image

license

License

license

metadata

Metadata

metadata

metadata

Metadata of Story.

metadata

name

Name

name

name

Each story has a name

name

name

Name

name

proofing

Proofing

proofing

source

Source

source

start

Name of start passage.

start

tagColors

Tag Colors object (each property is a tag and its color)

tagColors

tags

Tags

tags

text

Text

text

url

URL

url

version

Version

version

zoom

Zoom level.

zoom

Methods

addPassage(p)

Add a passage to the story. `StoryData` will override story metadata and `StoryTitle` will override story name.
Parameters:
NameTypeDescription
pPassagePassage to add to Story.

compile(story, engine, header, name, codeJS, config) → {string}

Write a combination of Story object, `engine.js` (from Twine 1), `header.html`, and optional `code.js`.
Parameters:
NameTypeDescription
storyStoryStory object to write.
enginestringSource of `engine.js` file from Twine 1.
headerstring`header.html` content for Twine 1 story format.
namestringName of the story format (needed for `code.js` inclusion).
codeJSstring`code.js` content with additional JavaScript.
configobjectLimited configuration object acting in place of `StorySettings`.
Properties
NameTypeDescription
jquerystringjQuery source.
modernizrstringModernizr source.
Returns:
Twine 1 HTML.
Type: 
string

compile(stories) → {string}

Write array of Story objects into Twine 2 Archive HTML.
Parameters:
NameTypeDescription
storiesArrayArray of Story objects.
Returns:
Twine 2 Archive HTML.
Type: 
string

compile(story, storyFormat) → {string}

Write a combination of Story + StoryFormat into Twine 2 HTML file.
Parameters:
NameTypeDescription
storyStoryStory object to write.
storyFormatStoryFormatStoryFormat to write.
Returns:
Twine 2 HTML.
Type: 
string

escapeMetacharacters(result) → {string}

Try to escape Twine 2 meta-characters.
Parameters:
NameTypeDescription
resultstringText to parse
Returns:
Escaped characters
Type: 
string

forEachPassage(callback)

forEach-style iterator of passages in Story.
Parameters:
NameTypeDescription
callbackfunctionCallback function

getPassageByName(name) → {Passage|null}

Find passage by name.
Parameters:
NameTypeDescription
namestringPassage name to search for
Returns:
Return passage or null
Type: 
Passage | null

getPassagesByTag(t) → {Array}

Find passages by tag.
Parameters:
NameTypeDescription
tstringPassage name to search for
Returns:
Return array of passages
Type: 
Array

parse(jsonString) → {Story}

Parse JSON representation into Story.
Parameters:
NameTypeDescription
jsonStringstringJSON string to convert to Story.
Returns:
Story object.
Type: 
Story

parse(contents) → {StoryFormat}

Parse a Story Format file.
Parameters:
NameTypeDescription
contentsstringContent
Returns:
StoryFormat object
Type: 
StoryFormat

parse(binaryFileContents) → {Story}

Parse TWS file (as Buffer) into Story. Unless it throws an error, it will return a Story object. See: Twine 1 TWS Documentation [Approval Pending]
Parameters:
NameTypeDescription
binaryFileContentsBufferFile contents to parse as Buffer.
Returns:
Story object.
Type: 
Story

parse(fileContents) → {Story}

Parses Twee 3 text into a Story object. See: Twee 3 Specification (https://github.com/iftechfoundation/twine-specs/blob/master/twee-3-specification.md)
Parameters:
NameTypeDescription
fileContentsstringFile contents to parse
Returns:
story
Type: 
Story

parse(content) → {Story}

Parses Twine 1 HTML into a Story object. See: Twine 1 HTML Output Documentation (https://github.com/iftechfoundation/twine-specs/blob/master/twine-1-htmloutput-doc.md)
Parameters:
NameTypeDescription
contentstringTwine 1 HTML content to parse.
Returns:
Story object
Type: 
Story

parse(content) → {Array}

Parse HTML for one or more Twine 2 HTML elements and return array of story objects.
Parameters:
NameTypeDescription
contentstringContent to parse for Twine 2 HTML elements.
Returns:
Array of stories found in content.
Type: 
Array

parse(content) → {Story}

Parse Twine 2 HTML into Story object. See: Twine 2 HTML Output Specification (https://github.com/iftechfoundation/twine-specs/blob/master/twine-2-htmloutput-spec.md)
Parameters:
NameTypeDescription
contentstringTwine 2 HTML content to parse.
Returns:
Story
Type: 
Story

removePassageByName(name)

Remove a passage from the story by name.
Parameters:
NameTypeDescription
namestringPassage name to remove

size() → {number}

Size (number of passages).
Returns:
Return number of passages
Type: 
number

toJSON() → {string}

Return JSON representation.
Returns:
JSON string.
Type: 
string

toJSON() → {string}

Export Story as JSON representation.
Returns:
JSON string.
Type: 
string

toJSON() → {string}

Export as JSON representation.
Returns:
JSON string.
Type: 
string

toTwee() → {string}

Return a Twee representation.
Returns:
String form of passage.
Type: 
string

toTwee() → {string}

Return Twee representation. See: Twee 3 Specification (https://github.com/iftechfoundation/twine-specs/blob/master/twee-3-specification.md)
Returns:
Twee String
Type: 
string

toTwine1HTML() → {string}

Return Twine 1 HTML representation.
Returns:
Twine 1 HTML string.
Type: 
string

toTwine1HTML() → {string}

Return Twine 1 HTML. See: Twine 1 HTML Output (https://github.com/iftechfoundation/twine-specs/blob/master/twine-1-htmloutput-doc.md)
Returns:
Twine 1 HTML string.
Type: 
string

toTwine2HTML(pid) → {string}

Return Twine 2 HTML representation. (Default Passage ID is 1.)
Parameters:
NameTypeDefaultDescription
pidnumber1Passage ID (PID) to record in HTML.
Returns:
Twine 2 HTML string.
Type: 
string

toTwine2HTML() → {string}

Return Twine 2 HTML. See: Twine 2 HTML Output (https://github.com/iftechfoundation/twine-specs/blob/master/twine-2-htmloutput-spec.md)
Returns:
Twine 2 HTML string
Type: 
string
Home
\ No newline at end of file +
On this page

Members

IFID

Interactive Fiction ID (IFID) of Story

IFID

author

Author

author

creator

Program used to create Story.

creator

creatorVersion

Version used to create Story.

creatorVersion

description

Description

description

format

Story format of Story.

format

formatVersion

Story format version of Story.

formatVersion

image

Image

image

license

License

license

metadata

Metadata

metadata

metadata

Metadata of Story.

metadata

name

Name

name

name

Each story has a name

name

name

Name

name

proofing

Proofing

proofing

source

Source

source

start

Name of start passage.

start

tagColors

Tag Colors object (each property is a tag and its color)

tagColors

tags

Tags

tags

text

Text

text

url

URL

url

version

Version

version

zoom

Zoom level.

zoom

Methods

addPassage(p)

Add a passage to the story. `StoryData` will override story metadata and `StoryTitle` will override story name.
Parameters:
NameTypeDescription
pPassagePassage to add to Story.

compile(story, engine, header, name, codeJS, config) → {string}

Write a combination of Story object, `engine.js` (from Twine 1), `header.html`, and optional `code.js`.
Parameters:
NameTypeDescription
storyStoryStory object to write.
enginestringSource of `engine.js` file from Twine 1.
headerstring`header.html` content for Twine 1 story format.
namestringName of the story format (needed for `code.js` inclusion).
codeJSstring`code.js` content with additional JavaScript.
configobjectLimited configuration object acting in place of `StorySettings`.
Properties
NameTypeDescription
jquerystringjQuery source.
modernizrstringModernizr source.
Returns:
Twine 1 HTML.
Type: 
string

compile(stories) → {string}

Write array of Story objects into Twine 2 Archive HTML.
Parameters:
NameTypeDescription
storiesArrayArray of Story objects.
Returns:
Twine 2 Archive HTML.
Type: 
string

compile(story, storyFormat) → {string}

Write a combination of Story + StoryFormat into Twine 2 HTML file.
Parameters:
NameTypeDescription
storyStoryStory object to write.
storyFormatStoryFormatStoryFormat to write.
Returns:
Twine 2 HTML.
Type: 
string

escapeMetacharacters(result) → {string}

Try to escape Twine 2 meta-characters.
Parameters:
NameTypeDescription
resultstringText to parse
Returns:
Escaped characters
Type: 
string

forEachPassage(callback)

forEach-style iterator of passages in Story.
Parameters:
NameTypeDescription
callbackfunctionCallback function

getPassageByName(name) → {Passage|null}

Find passage by name.
Parameters:
NameTypeDescription
namestringPassage name to search for
Returns:
Return passage or null
Type: 
Passage | null

getPassagesByTag(t) → {Array}

Find passages by tag.
Parameters:
NameTypeDescription
tstringPassage name to search for
Returns:
Return array of passages
Type: 
Array

parse(jsonString) → {Story}

Parse JSON representation into Story.
Parameters:
NameTypeDescription
jsonStringstringJSON string to convert to Story.
Returns:
Story object.
Type: 
Story

parse(contents) → {StoryFormat}

Parse a Story Format file.
Parameters:
NameTypeDescription
contentsstringContent
Returns:
StoryFormat object
Type: 
StoryFormat

parse(binaryFileContents) → {Story}

Parse TWS file (as Buffer) into Story. Unless it throws an error, it will return a Story object. See: Twine 1 TWS Documentation [Approval Pending]
Parameters:
NameTypeDescription
binaryFileContentsBufferFile contents to parse as Buffer.
Returns:
Story object.
Type: 
Story

parse(fileContents) → {Story}

Parses Twee 3 text into a Story object. See: Twee 3 Specification (https://github.com/iftechfoundation/twine-specs/blob/master/twee-3-specification.md)
Parameters:
NameTypeDescription
fileContentsstringFile contents to parse
Returns:
story
Type: 
Story

parse(content) → {Story}

Parses Twine 1 HTML into a Story object. See: Twine 1 HTML Output Documentation (https://github.com/iftechfoundation/twine-specs/blob/master/twine-1-htmloutput-doc.md)
Parameters:
NameTypeDescription
contentstringTwine 1 HTML content to parse.
Returns:
Story object
Type: 
Story

parse(content) → {Array}

Parse HTML for one or more Twine 2 HTML elements and return array of story objects.
Parameters:
NameTypeDescription
contentstringContent to parse for Twine 2 HTML elements.
Returns:
Array of stories found in content.
Type: 
Array

parse(content) → {Story}

Parse Twine 2 HTML into Story object. See: Twine 2 HTML Output Specification (https://github.com/iftechfoundation/twine-specs/blob/master/twine-2-htmloutput-spec.md)
Parameters:
NameTypeDescription
contentstringTwine 2 HTML content to parse.
Returns:
Story
Type: 
Story

removePassageByName(name)

Remove a passage from the story by name.
Parameters:
NameTypeDescription
namestringPassage name to remove

size() → {number}

Size (number of passages).
Returns:
Return number of passages
Type: 
number

toJSON() → {string}

Return JSON representation.
Returns:
JSON string.
Type: 
string

toJSON() → {string}

Export Story as JSON representation.
Returns:
JSON string.
Type: 
string

toJSON() → {string}

Export as JSON representation.
Returns:
JSON string.
Type: 
string

toTwee() → {string}

Return a Twee representation.
Returns:
String form of passage.
Type: 
string

toTwee() → {string}

Return Twee representation. See: Twee 3 Specification (https://github.com/iftechfoundation/twine-specs/blob/master/twee-3-specification.md)
Returns:
Twee String
Type: 
string

toTwine1HTML() → {string}

Return Twine 1 HTML representation.
Returns:
Twine 1 HTML string.
Type: 
string

toTwine1HTML() → {string}

Return Twine 1 HTML. See: Twine 1 HTML Output (https://github.com/iftechfoundation/twine-specs/blob/master/twine-1-htmloutput-doc.md)
Returns:
Twine 1 HTML string.
Type: 
string

toTwine2HTML(pid) → {string}

Return Twine 2 HTML representation. (Default Passage ID is 1.)
Parameters:
NameTypeDefaultDescription
pidnumber1Passage ID (PID) to record in HTML.
Returns:
Twine 2 HTML string.
Type: 
string

toTwine2HTML() → {string}

Return Twine 2 HTML. See: Twine 2 HTML Output (https://github.com/iftechfoundation/twine-specs/blob/master/twine-2-htmloutput-spec.md)
Returns:
Twine 2 HTML string
Type: 
string
Home
\ No newline at end of file diff --git a/docs/extwee/2.2.0/index.html b/docs/extwee/2.2.0/index.html index 559661bf..7a64150c 100644 --- a/docs/extwee/2.2.0/index.html +++ b/docs/extwee/2.2.0/index.html @@ -1,3 +1,3 @@ Home
On this page

Status

codecov

npm version

License: MIT

NPM Badge

Summary

Extwee is a story compilation tool supporting multiple historical and current Twine-compatible formats.

Format SupportInputOutput
Twine 1 HTML (2009 - 2015)YesPartial StorySettings support
Twine 1 TWS (2009 - 2015)YesNo
Twine 2 HTML (2015 - Present)YesYes
Twine 2 Archive HTML (2015 - Present)YesYes
Twee 3 (2021 - Present)YesYes
JSON (2023 - Present)YesYes

Node and Web API

The following objects and methods are available in Node.js or web contexts.

Note: When used in a web context, all objects and methods are part of the window.extwee global.

Objects

An object must be created using either the new keyword in JavaScript or as the result of parsing data.

  • StoryFormat
  • Passage
  • Story

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.

Parsers

Translates formats HTML, Twee, JSON, or JSONP into objects.

Note: Twine 1 story formats exist across multiple files (header.html and optional code.js). They cannot be parsed into a StoryFormat object.

  • parseTwee()
  • parseJSON()
  • parseStoryFormat()
  • parseTwine1HTML()
  • parseTwine2HTML()
  • parseTwine2ArchiveHTML()

Compilers

Compiles story, story formats, or other data into a combination or playable format.

  • compileTwine2HTML()
  • compileTwine1HTML()
  • compileTwine2ArchiveHTML()

Note: In order to create playable Twine 1 HTML, an engine.js file must be supplied.

Documentation

Extwee has documentation on individual source files hosted on GitHub Pages.

Command-Line Usage

Extwee supports a CLI interface:

[TBD]

Escaping Meta-Characters

Extwee will attempt to escape the meta-characters of {, }, [, and ] when moving to and from Twee notation.

It is highly recommended to avoid these characters in passage name and tags to avoid confusion and potential issues.

Installation

Extwee can be installed via NPM.

npm i extwee

Home
\ No newline at end of file +
On this page

Status

codecov

npm version

License: MIT

NPM Badge

Summary

Extwee is a story compilation tool supporting multiple historical and current Twine-compatible formats.

Format SupportInputOutput
Twine 1 HTML (2009 - 2015)YesPartial StorySettings support
Twine 1 TWS (2009 - 2015)YesNo
Twine 2 HTML (2015 - Present)YesYes
Twine 2 Archive HTML (2015 - Present)YesYes
Twee 3 (2021 - Present)YesYes
JSON (2023 - Present)YesYes

Node and Web API

The following objects and methods are available in Node.js or web contexts.

Note: When used in a web context, all objects and methods are part of the window.extwee global.

Objects

An object must be created using either the new keyword in JavaScript or as the result of parsing data.

  • StoryFormat
  • Passage
  • Story

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.

Parsers

Translates formats HTML, Twee, JSON, or JSONP into objects.

Note: Twine 1 story formats exist across multiple files (header.html and optional code.js). They cannot be parsed into a StoryFormat object.

  • parseTwee()
  • parseJSON()
  • parseStoryFormat()
  • parseTwine1HTML()
  • parseTwine2HTML()
  • parseTwine2ArchiveHTML()

Compilers

Compiles story, story formats, or other data into a combination or playable format.

  • compileTwine2HTML()
  • compileTwine1HTML()
  • compileTwine2ArchiveHTML()

Note: In order to create playable Twine 1 HTML, an engine.js file must be supplied.

Documentation

Extwee has documentation on individual source files hosted on GitHub Pages.

Command-Line Usage

Extwee supports a CLI interface:

[TBD]

Escaping Meta-Characters

Extwee will attempt to escape the meta-characters of {, }, [, and ] when moving to and from Twee notation.

It is highly recommended to avoid these characters in passage name and tags to avoid confusion and potential issues.

Installation

Extwee can be installed via NPM.

npm i extwee

Home
\ No newline at end of file diff --git a/docs/extwee/2.2.0/module.exports.html b/docs/extwee/2.2.0/module.exports.html index ccb4e3d5..9e60f374 100644 --- a/docs/extwee/2.2.0/module.exports.html +++ b/docs/extwee/2.2.0/module.exports.html @@ -1,3 +1,3 @@ Class: exports
On this page

exports

A passage is the smallest unit of a Twine story.

Constructor

new exports(name, text, tags, metadata)

Create a passage.
Parameters:
NameTypeDescription
namestringName
textstringContent
tagsArrayTags
metadataobjectMetadata
Home
\ No newline at end of file +
On this page

exports

A passage is the smallest unit of a Twine story.

Constructor

new exports(name, text, tags, metadata)

Create a passage.
Parameters:
NameTypeDescription
namestringName
textstringContent
tagsArrayTags
metadataobjectMetadata
Home
\ No newline at end of file diff --git a/docs/extwee/2.2.0/module.exports_module.exports.html b/docs/extwee/2.2.0/module.exports_module.exports.html index 12143b31..a02190e2 100644 --- a/docs/extwee/2.2.0/module.exports_module.exports.html +++ b/docs/extwee/2.2.0/module.exports_module.exports.html @@ -1,3 +1,3 @@ Class: exports
On this page

exports

new exports(name)

Creates a story.
Parameters:
NameTypeDescription
namestringName of the story.

exports

new exports(name, version, description, author, image, url, license, proofing, source)

Create a story format.
Parameters:
NameTypeDefaultDescription
namestringName
versionstringVersion
descriptionstringDescription
authorstringAuthor
imagestringImage
urlstringURL
licensestringLicense
proofingbooleanfalseIf proofing or not
sourcestringSource
Home
\ No newline at end of file +
On this page

exports

new exports(name)

Creates a story.
Parameters:
NameTypeDescription
namestringName of the story.

exports

new exports(name, version, description, author, image, url, license, proofing, source)

Create a story format.
Parameters:
NameTypeDefaultDescription
namestringName
versionstringVersion
descriptionstringDescription
authorstringAuthor
imagestringImage
urlstringURL
licensestringLicense
proofingbooleanfalseIf proofing or not
sourcestringSource
Home
\ No newline at end of file diff --git a/package-lock.json b/package-lock.json index dbb223be..dde34bd3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,11 +26,11 @@ "@babel/preset-env": "^7.23.2", "babel-loader": "^9.1.3", "clean-jsdoc-theme": "^4.2.14", - "core-js": "^3.33.1", + "core-js": "^3.33.2", "eslint": "^8.52.0", "eslint-config-standard": "^17.1.0", "eslint-plugin-import": "^2.29.0", - "eslint-plugin-jest": "^27.5.0", + "eslint-plugin-jest": "^27.6.0", "eslint-plugin-jsdoc": "^46.8.2", "eslint-plugin-node": "^11.0.0", "eslint-plugin-promise": "^6.1.1", @@ -4496,9 +4496,9 @@ } }, "node_modules/core-js": { - "version": "3.33.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.33.1.tgz", - "integrity": "sha512-qVSq3s+d4+GsqN0teRCJtM6tdEEXyWxjzbhVrCHmBS5ZTM0FS2MOS0D13dUXAWDUN6a+lHI/N1hF9Ytz6iLl9Q==", + "version": "3.33.2", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.33.2.tgz", + "integrity": "sha512-XeBzWI6QL3nJQiHmdzbAOiMYqjrb7hwU7A39Qhvd/POSa/t9E1AeZyEZx3fNvp/vtM8zXwhoL0FsiS0hD0pruQ==", "dev": true, "hasInstallScript": true, "funding": { @@ -5218,9 +5218,9 @@ } }, "node_modules/eslint-plugin-jest": { - "version": "27.5.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.5.0.tgz", - "integrity": "sha512-ed+254pKIJa0vHUxzHODwwrdrxnRxkViFq1FaRR7A4PTn1hMFRrk+IEe08UzkqzO6jhXUxsWIsClR1bBNtsc5w==", + "version": "27.6.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.6.0.tgz", + "integrity": "sha512-MTlusnnDMChbElsszJvrwD1dN3x6nZl//s4JD23BxB6MgR66TZlL064su24xEIS3VACfAoHV1vgyMgPw8nkdng==", "dev": true, "dependencies": { "@typescript-eslint/utils": "^5.10.0" @@ -14446,9 +14446,9 @@ } }, "core-js": { - "version": "3.33.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.33.1.tgz", - "integrity": "sha512-qVSq3s+d4+GsqN0teRCJtM6tdEEXyWxjzbhVrCHmBS5ZTM0FS2MOS0D13dUXAWDUN6a+lHI/N1hF9Ytz6iLl9Q==", + "version": "3.33.2", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.33.2.tgz", + "integrity": "sha512-XeBzWI6QL3nJQiHmdzbAOiMYqjrb7hwU7A39Qhvd/POSa/t9E1AeZyEZx3fNvp/vtM8zXwhoL0FsiS0hD0pruQ==", "dev": true }, "core-js-compat": { @@ -15077,9 +15077,9 @@ } }, "eslint-plugin-jest": { - "version": "27.5.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.5.0.tgz", - "integrity": "sha512-ed+254pKIJa0vHUxzHODwwrdrxnRxkViFq1FaRR7A4PTn1hMFRrk+IEe08UzkqzO6jhXUxsWIsClR1bBNtsc5w==", + "version": "27.6.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.6.0.tgz", + "integrity": "sha512-MTlusnnDMChbElsszJvrwD1dN3x6nZl//s4JD23BxB6MgR66TZlL064su24xEIS3VACfAoHV1vgyMgPw8nkdng==", "dev": true, "requires": { "@typescript-eslint/utils": "^5.10.0" diff --git a/package.json b/package.json index 63becadb..5228edfc 100644 --- a/package.json +++ b/package.json @@ -37,11 +37,11 @@ "@babel/preset-env": "^7.23.2", "babel-loader": "^9.1.3", "clean-jsdoc-theme": "^4.2.14", - "core-js": "^3.33.1", + "core-js": "^3.33.2", "eslint": "^8.52.0", "eslint-config-standard": "^17.1.0", "eslint-plugin-import": "^2.29.0", - "eslint-plugin-jest": "^27.5.0", + "eslint-plugin-jest": "^27.6.0", "eslint-plugin-jsdoc": "^46.8.2", "eslint-plugin-node": "^11.0.0", "eslint-plugin-promise": "^6.1.1", diff --git a/web-index.js b/web-index.js index 36691dc9..dca87d3a 100644 --- a/web-index.js +++ b/web-index.js @@ -12,7 +12,7 @@ import Passage from './src/Passage.js'; import StoryFormat from './src/StoryFormat.js'; // Add to global window. -window.extwee = { +window.Extwee = { // Objects StoryFormat, Passage,