cstypo-0.1.3
توضیحات
Package to apply Czech typography easily
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | cstypo-0.1.3 |
| نام | cstypo |
| نسخه کتابخانه | 0.1.3 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Juda Kaleta |
| ایمیل نویسنده | juda.kaleta@gmail.com |
| آدرس صفحه اصلی | https://github.com/yetty/cstypo |
| آدرس اینترنتی | https://pypi.org/project/cstypo/ |
| مجوز | MIT License ----------- Copyright (c) 2012 Juda Kaleta (http://www.judakaleta.cz) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
cstypo
======
Balíček pro zkrášlení českých textů aplikováním základních typografických
pravidel. Nesnaží se o pokrytí veškerých českých pravidel, spíše o aplikaci
základních a to hlavně těch, které jsou na webu nejvíce vidět.
.. image:: https://travis-ci.org/yetty/cstypo.png?branch=master
:target: https://travis-ci.org/yetty/cstypo
.. image:: https://coveralls.io/repos/yetty/cstypo/badge.png?branch=master
:target: https://coveralls.io/r/yetty/cstypo?branch=master
.. image:: https://pypip.in/v/cstypo/badge.png
:target: https://crate.io/packages/cstypo/
.. image:: https://pypip.in/d/cstypo/badge.png
:target: https://crate.io/packages/cstypo/
**Pozor!** Aplikování typografických pravidel na delší texty je poměrně výpočetně
náročná operace. Zvažte kešování těchto textů.
Instalace
---------
::
pip install cstypo
API
-------
- ``cstypo.parser.TxtParser``
Výchozí třída pro zpracování textu. Použití:
::
parser = cstypo.parser.TxtParser(text)
print parser.parser() # zformátovaný text
Je možné využít samostatně jednotlivé metody aplikující určitá pravidla:
- ``cstypo.parser.TxtParser.parse_ellipsis``
- ``cstypo.parser.TxtParser.parse_en_dash``
- ``cstypo.parser.TxtParser.parse_em_dash``
- ``cstypo.parser.TxtParser.parse_dates``
- ``cstypo.parser.TxtParser.parse_arrows``
- ``cstypo.parser.TxtParser.parse_plusminus``
- ``cstypo.parser.TxtParser.parse_dimension``
- ``cstypo.parser.TxtParser.parse_quotes``
- ``cstypo.parser.TxtParser.parse_prepositions``
- ``cstypo.parser.TxtParser.parse_last_short_word``
- ``cstypo.parser.HtmlParser``
Potomek třídy ``TxtParser``, který nejdříve escapuje veškeré HTML tagy,
aplikuje typografická pravidla na získaný text a vratí tagy zpět.
Django
-------
Pro použití ve frameworku Django je připraven filtr typify v souboru ``cstags``.
Nejdříve je potřeba ``cstypo`` přidat do ``INSTALLED_APPS``
::
INSTALLED_APPS = (
...
'cstypo',
)
Poté je možné začít v šablonách používat filtr.
::
{% load cstags %}
{{ text|typify }} # zpracování obyčejného textu (výchozí)
{{ text|typify:'txt' }} # ...
{{ text|typify:'html' }} # zpracování html
{{ text|typify:'html'|safe }} # pro povolení vypsání je potřeba filter safe
CLI
----
::
cstypo
Usage:
cstypo [--type (txt|html)] <input>
cstypo -h | --help
cstypo -v | --version
Options:
-h --help show this screen.
-v --version show version.
--type type of parsed file (txt default).
نحوه نصب
نصب پکیج whl cstypo-0.1.3:
pip install cstypo-0.1.3.whl
نصب پکیج tar.gz cstypo-0.1.3:
pip install cstypo-0.1.3.tar.gz