Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Readme
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ů.
::
pip install cstypo
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.
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
::
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).
FAQs
Package to apply Czech typography easily
We found that cstypo demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.