Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Harlowe] "...must be followed by a Harlowe-hook" error caused by tabs in code #78

Open
sdarkwell opened this issue Mar 4, 2019 · 5 comments

Comments

@sdarkwell
Copy link

A passage containing the following code (which contains a tab between ')' and '[' results in error "Story format transcoding failed at passage FirstPassage: 'if' must be followed by a Harlowe-hook.":
(if: $test is 0) [test]

The generated json contains the following entry for the tab character:

{
   "text": "\t\,
   "type": "text"
},

The error can be prevented via the brute-force method of pre-loading the file, removing all tab characters, then saving the file before it is parsed by PhantomJS, but this won't work as a real-world solution.

I spent a number of hours attempting to fix this in a more elegant way, but my unfamiliarity with the code limited my progress. If anyone more familiar with this than I am can push a fix, it would be much appreciated!
- S.

@daterre
Copy link
Owner

daterre commented Mar 4, 2019 via email

@sdarkwell
Copy link
Author

sdarkwell commented Mar 4, 2019

@daterre:

Ah! I see that. I didn't even think to look there.

Apologies. Thank you!
- S.

@sdarkwell
Copy link
Author

@daterre:

Hello. I've downloaded the development branch and tried it with both the .dll files and the .src files, and the errors still exist. It appears that an whitespace between and (if:) and [] will result in an error.

For example:
(if: $sleepFails is 0) [abruptly awoke in $their bed.]
... has an error, whereas:

(if: $sleepFails is 0) [abruptly awoke in $their bed.]
... does not.

Thank you!
- S.

@keimax
Copy link

keimax commented Apr 17, 2021

Was this solved eventually? :) I have the same error importing my twine file :(

@richardlalancetteyoui
Copy link

@keimax The source code is available for you to change.
Maybe you can have a look at the parsing code and see if the space causes issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants