Skip to content

Commit

Permalink
Merge branch 'release/0.0.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
byashimov committed Dec 31, 2016
2 parents e6064f0 + fcdfceb commit 400a44c
Show file tree
Hide file tree
Showing 23 changed files with 1,292 additions and 267 deletions.
18 changes: 9 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
sudo: false
language: python
python: 3.5
env:
matrix:
- TOXENV=py26
- TOXENV=py27
- TOXENV=py33
- TOXENV=py34
- TOXENV=py35
python:
- "2.6"
- "2.7"
- "3.3"
- "3.4"
- "3.5"
- "3.6-dev"
cache:
directories:
- $HOME/.cache/pip
install:
- pip install tox codecov
- travis_retry pip install tox-travis codecov
script:
- python --version
- tox
after_success:
- coverage report
Expand Down
99 changes: 83 additions & 16 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,41 +1,98 @@
Typus
=====
Welcome to Typus
================

Russian language typographer.
Typus is a typography tool. It means your can write text the way you use to
and let it handle all that formating headache:

::

Disclamer
---------
"I don't feel very much like Pooh today..." said Pooh.
"There there," said Piglet. "I'll bring you tea and honey until you do."
- A.A. Milne, Winnie-the-Pooh

This project is under development and not production ready *yet*.
“I don’t feel very much like Pooh today…” said Pooh.
“There there,” said Piglet. “I’ll bring you tea and honey until you do.”
— A. A. Milne, Winnie-the-Pooh

Copy & paste this example to your rich text editor. Result may depend on
the font of your choice.
For instance, there is a tiny non-breakable space between ``A. A.`` you
can see with Helvetica:

Quickstart
----------
.. image:: https://raw.githubusercontent.com/byashimov/typus/develop/docs/example.png

Install the package:

Installation
------------

.. code-block:: console
pip install -e git://github.com/byashimov/typus.git#egg=typus
Use it:
Usage
-----

Currently Typus supports English and Russian languages only.
Which doesn't mean it can't handle more. I'm quite sure it covers Serbian
and Turkmen.

In fact, Typus doesn't make difference between languages. It works with text.
If you use Cyrillic then only relative processors will affect that text.
In another words, give it a try if your language is not on the list

Here is a short example:

.. code-block:: python
from typus import typus
from typus import en_typus, ru_typus
en_typus('"Beautiful is better than ugly." (c) Tim Peters.', debug=True)
'“Beautiful is_better than ugly.” © Tim Peters.' # nbsp after '©'
ru_typus('"Красивое лучше, чем уродливое." (с) Тим Петерс.')
'«Красивое лучше, чем уродливое.» © Тим Петерс.' # cyrillic 'с' in '(с)'
The only difference between ``en_typus`` and ``ru_typus``
are in quotes they set: ``“‘’”`` for English and ``«„“»`` for Russian. Both of
them handle mixed text and that is pretty awesome.

typus('"Красивое лучше, чем уродливое." (с) Тим Петерс.')
'«Красивое лучше, чем уродливое.» ©_Тим Петерс.' # _ is nbsp
Typus is highly customizable. Not only quotes can be replaced but almost
everything. For instance, if you don't use html tags you can skip
``EscapeHtml`` processor which makes your Typus a little
faster.


What it does
------------

- Replaces regular quotes ``"foo 'bar' baz"`` with typographic pairs:
``“foo ‘bar’ baz”``. Quotes style depends on language and your Typus configuration.
- Replaces regular dash ``foo - bar`` with mdash or ndash or minus.
Depends on case: plain text, digit rage, phone nubers, etc.
- Replaces complex symbols such as ``(c)`` with unicode characters: ``©``.
Cyrillic analogs are supported too.
- Replaces vulgar fractions ``1/2`` with unicode characters: ``½``.
- Turns multiply symbol to a real one: ``3x3`` becomes ``3×3``.
- Replaces quotes with primes: ``2' 4"`` becomes ``2′ 4″``.
- Puts non-breakable spaces.
- Puts ruble symbol.
- Trims spaces at the end of lines.
- and much more.

Documentation
-------------

Coming soon.
Docs are hosted on `readthedocs.org`_.

.. seealso::

Oh, there is also an outdated Russian article I should not
probably suggest, but since all docs are in English, this link_ might be
quite helpful.


Compatability
Compatibility
-------------

.. image:: https://travis-ci.org/byashimov/typus.svg?branch=develop
Expand All @@ -46,4 +103,14 @@ Compatability
:alt: Codecov
:target: https://codecov.io/gh/byashimov/typus

Tested on py 2.5, 2.6, 2.7, 3.3, 3.4, 3.5 and probably others, please run the tests if your version is not on list.
Tested on Python 2.6, 2.7, 3.3, 3.4, 3.5, 3.6.


Todo
----

- Rewrite tests, they are ugly as hell.
- Add missing doctests.

.. _link: https://habrahabr.ru/post/303608/
.. _readthedocs.org: http://py-typus.readthedocs.io/en/latest/

0 comments on commit 400a44c

Please sign in to comment.