1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
|
Metadata-Version: 1.1
Name: python-bidi
Version: 0.4.2
Summary: Pure python implementation of the BiDi layout algorithm
Home-page: https://github.com/MeirKriheli/python-bidi
Author: Meir Kriheli
Author-email: mkriheli@gmail.com
License: http://www.gnu.org/licenses/lgpl.html
Description: ===============================
Python BiDi
===============================
.. image:: https://badge.fury.io/py/python-bidi.png
:target: http://badge.fury.io/py/python-bidi
.. image:: https://travis-ci.org/MeirKriheli/python-bidi.png?branch=master
:target: https://travis-ci.org/MeirKriheli/python-bidi
`Bi-directional`_ (BiDi) layout implementation in pure python
`Package documentation`_
.. _Bi-directional: http://en.wikipedia.org/wiki/Bi-directional_text
.. _Package documentation: http://python-bidi.readthedocs.org/en/latest/
API
----
The algorithm starts with a single entry point `bidi.algorithm.get_display`.
**Required arguments:**
* ``unicode_or_str``: The original unicode or string (i.e.: storage). If it's a string
use the optional argument ``encoding`` to specify it's encoding.
**Optional arguments:**
* ``encoding``: If unicode_or_str is a string, specifies the encoding. The
algorithm uses unicodedata_ which requires unicode. This encoding will be
used to decode and encode back to string before returning
(default: "utf-8").
* ``upper_is_rtl``: True to treat upper case chars as strong 'R' for
debugging (default: False).
* ``base_dir``: 'L' or 'R', override the calculated base_level.
* ``debug``: True to display (using `sys.stderr`_) the steps taken with the
algorithm (default: False).
Returns the display layout, either as unicode or ``encoding`` encoded string
(depending on the type of ``unicode_or_str'``).
.. _unicodedata: http://docs.python.org/library/unicodedata.html
.. _sys.stderr: http://docs.python.org/library/sys.html?highlight=sys.stderr#sys.stderr
Example::
>>> from bidi.algorithm import get_display
>>> get_display(u'car is THE CAR in arabic', upper_is_rtl=True)
u'car is RAC EHT in arabic'
CLI
----
``pybidi`` is a command line utility (calling ``bidi.main``) for running the
bidi algorithm. the script can get a string as a parameter or read text from
`stdin`. Usage::
$ pybidi -h
Usage: pybidi [options]
Options:
-h, --help show this help message and exit
-e ENCODING, --encoding=ENCODING
Text encoding (default: utf-8)
-u, --upper-is-rtl treat upper case chars as strong 'R' for debugging
(default: False).
-d, --debug Output to stderr steps taken with the algorithm
-b BASE_DIR, --base-dir=BASE_DIR
Override base direction [L|R]
Examples::
$ pybidi -u 'car is THE CAR in arabic'
car is RAC EHT in arabic
$ cat ~/Documents/example.txt | pybidi
...
Installation
-------------
See ``docs/INSTALL.rst``
Running tests
--------------
To run the tests::
python setup.py test
Some explicit tests are failing right now (see TODO)
0.4.2
-----
* Type Fixes, thanks jwilk
History
=========
0.4.1
-----
* Merged Fix for mixed RTL and numbers, Thanks Just van Rossum
0.4.0
-----
* Move to cookiecutter template
* Python 3 support (py2.6, 2.7, 3.3, 3.4 and pypy)
* Better docs
* Travis integration
* Tox tests
* PEP8 cleanup
0.3.4
------
* Remove extra newline in console script output
0.3.3
------
* Implement overriding base paragraph direction
* Allow overriding base direction in pybidi console script
* Fix returning display in same encoding
0.3.2
------
* Test for surrogate pairs
* Fix indentation in documentations
* Specify license in setup.py
0.3.1
-----
* Added missing description
* docs/INSTALL.rst
0.3
---
* Apply bidi mirroring
* Move to back function based implementation
0.2
---
* Move the algorithm to a class based implementation
0.1
---
* Initial release
Keywords: bidi unicode layout
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
Classifier: Topic :: Text Processing
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: Implementation :: PyPy
|