Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.