https://github.com/jixingcn/pytwee
Parse/convert the twine format by python
https://github.com/jixingcn/pytwee
converter interactive parser story storybook twine-format twine-game twine2 twine3 twinery
Last synced: 12 months ago
JSON representation
Parse/convert the twine format by python
- Host: GitHub
- URL: https://github.com/jixingcn/pytwee
- Owner: jixingcn
- License: mit
- Created: 2025-06-11T14:38:46.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-20T15:25:47.000Z (about 1 year ago)
- Last Synced: 2025-06-28T15:45:12.098Z (12 months ago)
- Topics: converter, interactive, parser, story, storybook, twine-format, twine-game, twine2, twine3, twinery
- Language: Python
- Homepage: https://pytwee.readthedocs.io/
- Size: 45.9 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- License: LICENSE
Awesome Lists containing this project
README
pytwee
######
|pylint-action| |test-action| |pypi-action|
|pypi-version| |pypi-python| |pypi-status|
|docs-badge|
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)
License
*******
|license|
.. |pylint-action| image:: https://img.shields.io/github/actions/workflow/status/jixingcn/pytwee/pylint.yml?label=pylint
:alt: pylint workflow Status
:target: https://github.com/jixingcn/pytwee/actions/workflows/pylint.yml
.. |test-action| image:: https://img.shields.io/github/actions/workflow/status/jixingcn/pytwee/test.yml?label=test
:alt: test workflow Status
:target: https://github.com/jixingcn/pytwee/actions/workflows/test.yml
.. |pypi-action| image:: https://img.shields.io/github/actions/workflow/status/jixingcn/pytwee/pypi.yml?label=pypi
:alt: pypi workflow Status
:target: https://github.com/jixingcn/pytwee/actions/workflows/pypi.yml
.. |pypi-version| image:: https://img.shields.io/pypi/v/pytwee
:alt: PyPI - Version
:target: https://pypi.org/project/pytwee
.. |pypi-status| image:: https://img.shields.io/pypi/status/pytwee
:alt: PyPI - Status
:target: https://pypi.org/project/pytwee
.. |pypi-python| image:: https://img.shields.io/pypi/pyversions/pytwee
:alt: PyPI - Python Version
:target: https://pypi.org/project/pytwee
.. |docs-badge| image:: https://img.shields.io/readthedocs/pytwee/latest
:alt: Read the Docs (version)
:target: https://pytwee.readthedocs.io
.. |license| image:: https://img.shields.io/badge/license-MIT-green
:alt: Static Badge
:target: https://github.com/jixingcn/pytwee/blob/main/LICENSE