Giter Club home page Giter Club logo

twee2's Introduction

Twee2

Command-line tool to compile Twee-style (.tw, .twine) interactive fiction source files to Twine 2-style output. Use your favourite text editor to write Twine 2 interactive fiction.

Designed for those who preferred the Twee approach to source management, because the command-line is awesome, but who want to take advantage of the new features in Twine 2. With a little work, this tool may also function as a partial Twine 1 to Twine 2 converter.

For installation and usage, see https://dan-q.github.io/twee2/

Philosophy

(Why does this exist? Where is it going?)

I love the direction that Twine 2 has been going in, in regard to ditching the old Tiddlywiki backend and making it easier than ever for developers to integrate their own CSS and Javascript into their stories. However, as a fan of plain-old text editors and not of IDEs, I'm not so keen on the fact that it's now almost-impossible to develop a Twine adventure from the command-line only (there's no "Twee" equivalent for Twine 2). For my own benefit and enjoyment, I aim to fill that gap. If it helps you too, then that's just a bonus.

I'd love to hear your thoughts about the future of this gem. Pull requests are also welcome.

Installation

Install using gem

gem install twee2

For errors involving nokogiri, see Installing Nokogiri.

Basic Usage

To compile a Twee file into a HTML file using the default format (Harlowe):

twee2 build inputfile.twee outputfile.html

To use a specific format, e.g. Snowman:

twee2 build inputfile.twee outputfile.html --format=Snowman

For additional features (e.g. listing known formats, watch-for-changes mode), run twee2 without any parameters. Or see the full documentation at https://dan-q.github.io/twee2/documentation.html.

Special features

Aside from the obvious benefits of a "use your own editor" solution, Twee2 provides the following enhancements over Twine 2:

  • Multi-file inclusion - spread your work over multiple files to improve organisation, facilitate better source control, collaborate with others, or make re-usable modules.
  • HAML support - for those who prefer HAML to Markdown, and for advanced embedding of scripting into passages.
  • Coffeescript transpiler - optionally write your Javascript in Coffeescript for a smarter, lighter syntax.
  • SASS/SCSS stylesheets - optionally enhance your CSS with syntactic awesome.
  • Ruby-powered dynamic generation - automate parts of your build chain (e.g. how about a procedurally-built maze of twisty little passages... or even something actually good) with Ruby scripting
  • Twine 2 decompilation - reverse-engineer Twine 2 stories into Twee2 source code to convert your projects or to understand other people's.

Notes

  • This is not a Twee to Harlowe converter. You'll still need to change your macros as described at http://twine2.neocities.org/, and/or rewrite them as Javascript code. However, it might help your efforts to update Twee sources to Twine 2 output.
  • Some special story segments (e.g. StorySubtitle) used in Twee 1 are ignored. You will be warned when this happens.
  • The Twine 2 editor might not be able to re-open stories compiled using Twee2, because Twee2 does not automatically include positional data used by the visual editor (however, you can add this manually if you like).

Build

To build a local copy of the gem:

gem build twee2.gemspec

To install it locally (e.g., for version number 0.5.0):

gem install twee2-0.5.0.gem

License

This code is released under the GPL, version 2. It includes code (in the storyFormats directory) by other authors, including Leon Arnott: please read their licenses before redistributing.

twee2's People

Contributors

alex-ball avatar dan-q avatar duxovni avatar estiens avatar fuzzybinary avatar mcdemarco avatar unnu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

twee2's Issues

Story with Mousetrap compiles into story which shows error message when opened

Ran twee2 build minerr.tw2 test.html --format=SugarCube2 (minerr here). The story contains Mousetrap 1.6.0, but doesn't assign any shortcuts.

Tested in Firefox, Chrome, and Konqueror. All show an error message starting with Apologies! An error has occurred. You may be able to continue, but some parts may not work properly., followed by:
Firefox: Error [tw-user-script-0]: nothing to repeat.
Chrome: Error [tw-user-script-0]: Unexpected token ].
Konqueror: Error [tw-user-script-0]: Invalid regular expression: nothing to repeat.

Story is otherwise functional. Assigning shortcut keys has no effect, but my best guess is that these are symptoms of the same issue.

UTF-8 issues

In case anyone has the same issue.. Building my Harlowe format file failed:

../bin/twee2 build casino.tw2 casino.html
$HOME/.gem/ruby/2.4.0/gems/twee2-0.5.0/lib/twee2/story_format.rb:12:in `match': invalid byte sequence in US-ASCII (ArgumentError)
        from $HOME/.gem/ruby/2.4.0/gems/twee2-0.5.0/lib/twee2/story_format.rb:12:in `match'
        from $HOME/.gem/ruby/2.4.0/gems/twee2-0.5.0/lib/twee2/story_format.rb:12:in `initialize'
        from $HOME/.gem/ruby/2.4.0/gems/twee2-0.5.0/lib/twee2.rb:23:in `new'
        from $HOME/.gem/ruby/2.4.0/gems/twee2-0.5.0/lib/twee2.rb:23:in `build'
        from ../bin/twee2:13:in `build'
        from $HOME/.gem/ruby/2.4.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
        from $HOME/.gem/ruby/2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
        from $HOME/.gem/ruby/2.4.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
        from $HOME/.gem/ruby/2.4.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
        from ../bin/twee2:45:in `<main>'

but it worked fine with:

LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8 bash  ./build.sh

Error installing twee2: Failed to build gem native extension

OSX: 10.13.5 (17F77)
Ruby: 2.3.3p222
Gem: 2.5.2

$ sudo gem install twee2
Password:
Building native extensions. This could take a while...
ERROR: Error installing twee2:
ERROR: Failed to build gem native extension.

current directory: /Library/Ruby/Gems/2.3.0/gems/nokogiri-1.8.4/ext/nokogiri

/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20180805-33705-186tz9c.rb extconf.rb
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
Using mini_portile version 2.3.0
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv... yes


IMPORTANT NOTICE:

Building Nokogiri with a packaged version of libxml2-2.9.8
with the following patches applied:
- 0001-Revert-Do-not-URI-escape-in-server-side-includes.patch

Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:

gem install nokogiri -- --use-system-libraries
    [--with-xml2-config=/path/to/xml2-config]
    [--with-xslt-config=/path/to/xslt-config]

If you are using Bundler, tell it to use the option:

bundle config build.nokogiri --use-system-libraries
bundle install

Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.


Extracting libxml2-2.9.8.tar.gz into tmp/x86_64-apple-darwin17/ports/libxml2/2.9.8... OK
Running git apply with /Library/Ruby/Gems/2.3.0/gems/nokogiri-1.8.4/patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch... OK
Running 'configure' for libxml2 2.9.8... OK
Running 'compile' for libxml2 2.9.8... ERROR, review '/Library/Ruby/Gems/2.3.0/gems/nokogiri-1.8.4/ext/nokogiri/tmp/x86_64-apple-darwin17/ports/libxml2/2.9.8/compile.log' to see what happened. Last lines are:

CCLD libxml2.la
CC testdso.lo
CCLD testdso.la
CC xmllint.o
CCLD xmllint
ld: warning: ignoring file /usr/local/Cellar/xz/5.2.4/lib/liblzma.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/Cellar/xz/5.2.4/lib/liblzma.dylib
Undefined symbols for architecture i386:
"_lzma_auto_decoder", referenced from:
_xz_head in libxml2.a(xzlib.o)
"_lzma_code", referenced from:
_xz_decomp in libxml2.a(xzlib.o)
"_lzma_end", referenced from:
___libxml2_xzclose in libxml2.a(xzlib.o)
"_lzma_properties_decode", referenced from:
_is_format_lzma in libxml2.a(xzlib.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [xmllint] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/$(RUBY_BASE_NAME)
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
/Library/Ruby/Gems/2.3.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:402:in block in execute': Failed to complete compile task (RuntimeError) from /Library/Ruby/Gems/2.3.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:373:in chdir'
from /Library/Ruby/Gems/2.3.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:373:in execute' from /Library/Ruby/Gems/2.3.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:115:in compile'
from /Library/Ruby/Gems/2.3.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:154:in cook' from extconf.rb:365:in block (2 levels) in process_recipe'
from extconf.rb:257:in block in chdir_for_build' from extconf.rb:256:in chdir'
from extconf.rb:256:in chdir_for_build' from extconf.rb:364:in block in process_recipe'
from extconf.rb:262:in tap' from extconf.rb:262:in process_recipe'
from extconf.rb:551:in `

'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/Library/Ruby/Gems/2.3.0/extensions/universal-darwin-17/2.3.0/nokogiri-1.8.4/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/nokogiri-1.8.4 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-17/2.3.0/nokogiri-1.8.4/gem_make.out

Unable to specify story format from a directory

I want to use SugarCube 2 story format, so I try:

$ ls -F
input.tw2  SC2/
$ ls SC2
format.js  icon.svg  LICENSE
$ cat input.tw2
::Configuration [twee2]
Twee2::build_config.story_format = './SC2'

::Start
Hello
$ twee2 version
   Your version: 0.4.2
 Latest version: 0.4.2
$ twee2 build input.tw2 output.html               
ERROR: story format './SC2' not found.
$ twee2 build input.tw2 output.html --format=./SC2
ERROR: story format './SC2' not found.

It doesn't work. Any clues?

Thanks!

[FR] Create new directory if directory our HTML file is being output to does not exist

Hello!

I'm using twee2 as part of a CI/CD environment. I've run into a minor snag a few times now where I have to output my result HTML file into a brand new directory, and forgot to create it first -- twee2 simply crashed instead of creating the necessary directory for the file to live in. It's a simple fix (just create the directory beforehand) but twee2 should be capable of handling this itself.

If the directory that is specified for the output HTML file to be saved to does not exist when twee2 is run, twee2 should create it instead of crashing when trying to save the file.

I figure I'll also tag @harvimt here, as it's their release-0.6.0 branch of twee2 that I've actually been using most recently. (I would have placed this on their repository, but it doesn't have issue tracking turned on.) For the record, I did notice the same behavior when I was using the stock 0.5.0 gem.

Thanks to everyone who's contributed code to this project for all your hard work! It's greatly appreciated.

conflict error after install: Unable to activate twee2-0.5.0, because bundler-2.1.4 conflicts with bundler (~> 1.6)

After I install twee2 via

gem install twee2

I get the following ConflictError:

$ twee2
Traceback (most recent call last):
        7: from /Users/phivk/.rvm/gems/ruby-2.6.0/bin/ruby_executable_hooks:22:in `<main>'
        6: from /Users/phivk/.rvm/gems/ruby-2.6.0/bin/ruby_executable_hooks:22:in `eval'
        5: from /Users/phivk/.rvm/gems/ruby-2.6.0/bin/twee2:23:in `<main>'
        4: from /Users/phivk/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/rubygems.rb:304:in `activate_bin_path'
        3: from /Users/phivk/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/rubygems.rb:304:in `synchronize'
        2: from /Users/phivk/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/rubygems.rb:305:in `block in activate_bin_path'
        1: from /Users/phivk/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/rubygems/specification.rb:1415:in `activate'
/Users/phivk/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/rubygems/specification.rb:2298:in `raise_if_conflicts': Unable to activate twee2-0.5.0, because bundler-2.1.4 conflicts with bundler (~> 1.6) (Gem::ConflictError)

As you can see from the logs above, I have ruby 2.6.0 installed via RVM.

I am not super familiar with the Ruby Gem ecosystem. Is there a way to downgrade bundler-2.1.4 to match ~> 1.6 or upgrade the other way around?

Debugging HAML errors

The HAML compiler is not very helpful when encountering syntax errors; it terminates twee2 with an exception stating what the invalid syntax was, but gives absolutely no clues as to where the problem is. It would be helpful if this exception could be handled to at least state which passage is affected, and hopefully also which line.

How to install Twee2 on WSL2

  1. apt-get install ruby ruby-dev libxml2 libxml2-devel zlib zlib1g-dev
  2. gem install twee2

Mind you I do a lot of dev work so I could have somethings already installed that I didn't know about.

harlowe-2 support?

Would it be possible to add support for harlowe2?

I tried adding the format.js and icon.svg in the storyFormats/Harlowe2/ dir, (from twinejs/story-formats/harlowe-2.0.1/) and any file that contained the string, but that does not seem to be enough.

::Start
(set: $arr to (a: "hello", "world"))
(print: $arr's 1)
(for: each _item, ...$arr) [I say _item.]

Issue with backslashes in file names

Hi, I have written an inventory system that contains information on each item in an array, e.g.

state.active.variables.inventory.push({"ID":1,"name":"Remote","description":"","canBuy":true,"shopCategory":"Electronics","category":"","image":"\\data\\img\\remote.jpg","buyPrice":120,"sellPrice":100,"canOwnMultiple":false,"owned":0});

This definition is, besides some macros, in a separate tw2 file and is included in the main story. When I build the story, the double backslashes are removed in the final html file and I logically get an ecoding error.

The html contains the following line of code:
state.active.variables.allClothing.push({"ID":1,"name":"Remote","description":"","canBuy":true,"shopCategory":"Electronics","category":"","image":"\data\img\remote.jpg","buyPrice":120,"sellPrice":100,"canOwnMultiple":false,"owned":0});

As you can see, the double backslashes disappeard. How can I avoid this?

Problems with Harlowe 3.0.0

When I try to use the newest Harlowe story format on Twee2 I get the error below. It is Harlowe 3.0 I am trying to use downloaded from https://bitbucket.org/_L_/harlowe/overview
Twee2 works fine with the building Harlowe 1.0.1 format, but as a newbie to Twee2, Twine and the whole IF concepts I wanted to have the latest versions to be sure it works.

//LarsPM
@lpmwfx

> C:\Users\DKMATHIASENL\Documents\Scree Scrivener TWINE TWEE2>twee2 build firstdraft5.txt fd6.html --format=c:\twee2\harlowe3
> Traceback (most recent call last):
>         12: from C:/Ruby25-x64/bin/twee2:23:in `<main>'
>         11: from C:/Ruby25-x64/bin/twee2:23:in `load'
>         10: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/twee2-0.5.0/bin/twee2:45:in `<top (required)>'
>          9: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
>          8: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
>          7: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
>          6: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
>          5: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/twee2-0.5.0/bin/twee2:13:in `build'
>          4: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/twee2-0.5.0/lib/twee2.rb:23:in `build'
>          3: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/twee2-0.5.0/lib/twee2.rb:23:in `new'
>          2: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/twee2-0.5.0/lib/twee2/story_format.rb:14:in `initialize'
>          1: from C:/Ruby25-x64/lib/ruby/2.5.0/json/common.rb:156:in `parse'
> C:/Ruby25-x64/lib/ruby/2.5.0/json/common.rb:156:in `parse': 765: unexpected token at '{"source":"","}' (JSON::ParserError)

::@insert not working

I've been trying to make use of the ::@include functionality listed in the documentation and have had absolutely zero success.
I've had to do some trial and error testing with it, as the documentation really only says "this should work" with no real explanation of if/how it needs to be set up.

Using a dead simple example like so:
::Configuration [twee2]
Twee2::build_config.story_format = 'SugarCube'

::StoryIncludes
addme.tw2

::StoryTitle
Test Insert

::Start
This is the base text
::@insert addme.tw2

and a similarly simple single line of text in another file (addme.tw2) that simply reads
This is the inserted text

The above gives no result.
I've tried with and without addme.tw2 under StoryIncludes
I've tried with and without a passage name above the text to be inserted in the addme.tw2 file.
I've tried with and without the passage name matching the name of the file itself (::addme, ::addme.tw2)

None of, nor any combination of the above have actually inserted the text for me.

Either the functionality does not work, does not support sugarcube (in which case the documentation should say so), or I am missing a critical piece of information regarding this functionality.

Attached are the two files I've been experimenting, although given the numerous combinations of settings listed above which obviously can't all be used at once, I'm not sure how useful they are.

IncludeTest.zip

Option to not ignore special passages

Sugarcube 2 uses special passage names like StoryAuthor, StoryMenu and others which are ignored by twee2 when processing a source file. It would be nice if an option could be added to switch this off (and have those passages included in the output.

Does not accept some macros (link-[someblurb]:)

Not sure if this is an issue or a feature request...

Some macros from the Harlowe 1.2.2 specification aren't accepted in the running story, which complains with a runtime error message "I can't run the macro 'whatever' because it doesn't exist.".

I've tested with link-reveal and link-repeat. Maybe there are more.

Docker image

Since folks are having installation issues in #45 (I am having a similar issue in WSL2) it may be helpful to have a docker image for the twee2 CLI as a backup for anyone with environment issues.

Feature request: test flag.

The ability to lock the story into test/debug mode from the command line at build time would be very useful.

The content of [stylesheet] passages are not injected into story's stylesheet

I am currently using Gulp to make my worflow in Twee2 easier. The problem is, twee2's build isn't injecting scripts and stylesheets as expected with the language's syntax.

The Gulp tasks, in the end, produce a dist directory:

dist
  ⊢ scripts.tw2
  ⊢ story.html
  ⊢ story.tw2
  ∟ stylesheets.tw2
// dist/scripts.tw2

::StoryTitle
Escape from Earth

::Start
There are only hours left before the asteroid hits and, if the news is to be believed, all life on Earth is extinguished. The spaceship is fuelled-up and [[ready to go->Ready]], but after all the rush of the last few weeks, you don't feel like you've had a chance to say goodbye to the planet that's been your home your entire life. [[Your father->Father]] glances over to check that you're heading into the vessel as he shepherds [[the family dog->Dog]]'s out of the hangar door. Behind the barriers, [[your sister->Sister]] gives a sad wave, clutching a photo in her hand.

::StoryIncludes
scripts.tw2
stylesheets.tw2
// dist/stylesheets.tw2

::StyleSheets [scss stylesheet]

* {
    box-sizing: border-box;
}

body {
  margin: 0;
  background: #eee;
}

tw-passage tw-link {
  color: red;
}

.test {
    font-size: 1rem;
}

The resulting HTML with no injected secondary files:

image

Upgrading story formats?

Twine 2.0.9 was released including a new version of Harlowe. How can we update the Harlowe version that twee2 uses? Thanks!

Cannot install

I'm new to Ruby so maybe this is a dumb question...

I installed Ruby and can run ruby -v without problem: ruby 2.3.1p112 (2016-04-26 revision 54768) [i386-mingw32]

Then, when I run gem install twee2, i get the following:

ERROR:  Could not find a valid gem 'twee2' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=
SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)

I'm on Windows 7.

Any help?

::@include directives don't work unless indented

I ran into some strange behaviour while attempting to use ::@include directives to import a file: if the directive is indented it works fine, but if it's not indented twee2 compiles it as if it were a regular passage. For example, a passage containing an include directive like:

::start
::@include test.tw2

will compile as:

<tw-passagedata pid="1" name="start" tags="" position=""></tw-passagedata><tw-passagedata pid="2" name="@include test.tw2" tags="" position=""></tw-passagedata>

but if formatted like:

::start
    ::@include test.tw2

the include will work. Maybe this behaviour is intentional, but I didn't see anything in the documentation that mentions ::@include directives needing to be indented to function.

MacOSX: nokogiri 1.8.2 installation error & solution

Mac 10.13.4: subsequent installation of nokogiri fails during installation process of twee2.

Installing it manually, this works:

(sudo) gem install nokogiri -- --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/libxml2/

::StoryMenu

The ::StoryMenu special passage was NOT removed from Twine 2. It still works exactly as before; it produces a menu below the ::StoryCaption. However, whenever I use StoryMenu, it is not included with the compiled HTML file. I have to name the passage ::StoryMenu1, and then directly edit the HTML. Please fix this.

My ruby is too new for twee2?

I'm running Manjaro 22.0.0.

[~]$ gem install twee2
ERROR:  Error installing twee2:
	twee2-0.5.0 requires Ruby version ~> 2. The current ruby version is 3.0.4.
[~]$ 

Decompiler misses IFID

The decompile function seems to ignore the "ifid" attribute when parsing an HTML file. When I recompile the resulting tw2 file without modification, the compiler then complains that it did not set an IFID.

Updating SugarCube 2

The included sugarcube2 is 2.7

SugarCube2 is up to 2.12 can we either update SugarCube2
or have a way to include an external story format?

Non-ASCII characters get scrambled

Unicode characters get scrambled when loaded through Twee2. For example, the back/forward arrows in the latest version of Sugarcube look like this:

sugarcubeerrorscorrect

Whereas if a story is compiled in Twee2, they look like this:

sugarcubeerrorstwee2

Also, if a file contains UTF-8 byte-order marks, Twee2 seems to interpret them as literal ASCII characters, in includes and elsewhere.

All angle-brackets are converted to HTML entities in [script] passages

So, in my .tw2 file, I have the following code as part of a macro:

if (params.length >= 3)
    arr = [ '<abbr title="', params[1], ' (', params[2], ')">', params[0], '</abbr>' ];

After compiling, it appears in the HTML file like this:

if (params.length &gt;= 3)
    arr = [ '&lt;abbr title="', params[1], ' (', params[2], ')"&gt;', params[0], '&lt;/abbr&gt;' ];

This causes two errors: first, it complains about the &gt; in the middle of the conditional there, and second, when I implemented it without the greater-than sign, it literally appears on the page as <abbr title="bar (baz)">foo</abbr> instead of foo with the hover-text bar (baz)

Scripts in [haml] passages escaping all quotes

Definitely enjoying using Twee2 so far, but I'm having issues with some of the parsing. Any string literals in :javascript or :coffeescript HAML filters are having their quotes escaped. Using the example code on the Twee2 docs, this:

:coffeescript
  $ ->
    alert "This message will appear when you reach Nick's Bar!"

becomes this, after building:

$(function() {
    return alert(&quot;This message will appear when you reach Nick&#39;s Bar!&quot;);
  });

The browser is obviously unhappy about it!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.