pyspinner is simple library for parsing text that uses spin-syntax.
To install pyspinner, simply:
$ pip install pyspinner
or download the source code and do:
$ python setup.py install
>>> import spinning
>>> spinning.unique('The {quick|fast} {brown|gray|red} fox jumped over the lazy dog.')
'The quick gray fox jumped over the lazy dog.'
$ python spinning-tests.py
....
----------------------------------------------------------------------
Ran 2 tests in 0.000s
OK
- Supports nested syntax.
- Supports custom opening, closing and separator characters by using the
override_params
function.
- Allow optional phrases:
The quick{ red|} fox...
- Allow special characters
{,|,}
inside text by escaping them. - Write more tests