pytwee
Features
- Parse the .twee file with twee 3 spec
StoryTitle
StoryData
Special Tags: script, stylesheet
Convert the Story to twine 2 HTML spec
Convert the Story to twine 2 JSON doc
Run as a command
Use
# Install by pip
$ python -m pip install pytwee
# Run in console
$ python -m pytwee tests/t001.tw
$ pytwee tests/t001.tw
# Import as a module
import pytwee
story = pytwee.story.Story()
with open('my-story.tw', 'rt') as f:
parser = pytwee.twee3.Parser(story)
for line in iter(f.readline, ''):
parser(line.rstrip('\n'))
del parser #<- very important
print('story:', story)