This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

CJKwrap is a library for wrapping and filling CJK text.

CJKwrap fix the issue24665 because Python 2 will stay broken forever: https://bugs.python.org/issue24665.

CJKwrap support both Python 2 (2.6 and above) and Python 3 (3.3 and above).

CJKwrap is developed by Florent Gallaire fgallaire@gmail.com.

Website: http://fgallaire.github.io/cjkwrap.

Download and Install

To install the last stable version from PyPI:

$ sudo pip install cjkwrap

To install the development version from GitHub:

$ git clone https://github.com/fgallaire/cjkwrap
$ cd cjkwrap
$ sudo python setup.py install

Or you can just use the cjkwrap.py file alone, nothing more needed!

Usage

is_wide() to know if a char is double-width, cjklen() and cjkslices() to replace built-in len() and slicing:

>>> import cjkwrap
>>> cjkwrap.is_wide(u"c")
False
>>> cjkwrap.is_wide(u"長")
True
>>> cjkwrap.cjklen(u"最終的には良い長さ")
18
>>> head, tail = cjkwrap.cjkslices(u"最終的には良い長さ", 6)
>>> print(head)
最終的
>>> print(tail)
には良い長さ

As cjklen() uses len() for non unicode stuff, you can safely do this:

>>> from cjkwrap import cjklen as len
>>> len(u"最終的には良い長さ")
18
>>> len([1, 2, 3, 4])
4

wrap() and fill() to replace the ones from the Python standard library:

>>> wrapped_cjk = cjkwrap.wrap(u"最終的に良いラッピング", 10)
>>> for line in wrapped_cjk: print(line)
...
最終的に良
いラッピン
グ
>>> print(cjkwrap.fill(u"最終的に良いラッピング", 10))
最終的に良
いラッピン
グ

Mixed content is allowed:

>>> cjkwrap.cjklen(u"CJK 最終的には良い長さ")
22
>>> print(cjkwrap.fill(u"CJK 最終的には良い長さ", 10))
CJK 最終的
には良い長
さ

License

CJKwrap files are released under the GNU LGPLv3 or above license.

CJKwrap codebase from textwrap by Greg Ward (gward@python.net) under the Python license.

Release History

Release History

2.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
CJKwrap-2.2-py2.py3-none-any.whl (4.3 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Dec 27, 2016
CJKwrap-2.2.tar.gz (21.4 kB) Copy SHA256 Checksum SHA256 Source Dec 27, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting