Tipi
Tipi is for typographic replacements in HTML.
Status: ACTIVE
Under active development and maintenance.
Ideas behind this project
Input is HTML code, output is the same HTML code with changes in typography (entities, spaces, quotes, etc.).
The best existing HTML parser and tokenizer for Python is lxml.
There are more languages than English in the world. Each of them has different typographic rules.
Installation
Easy:
$ pip install tipi
Quickstart
Usage of tipi is very straightforward:
>>> from tipi import tipi
>>> html = '<p>"Zavolej mi na číslo <strong class="tel">765-876-888</strong>," řekla, a zmizela...</p>'
>>> html = tipi(html, lang='cs')
>>> html
'<p>\u201eZavolej mi na \u010d\xed\xadslo <strong class="tel">765\u2013876\u2013888</strong>,\u201c \u0159ekla, a\xa0zmizela\u2026</p>'
>>> print html
<p>„Zavolej mi na číslo <strong class="tel">765–876–888</strong>,“ řekla, a zmizela…</p>
Remember that tipi is designed to work with HTML. In case you need to perform replacements on plaintext, escape it first:
>>> fron tipi import tipi
>>> tipi('b -> c') # this works only by coincidence!
u'b → c'
>>> tipi('a <- b -> c')
u'a c'
>>> import cgi
>>> html = cgi.escape(u'a <- b -> c')
>>> html
u'a <- b -> c'
>>> tipi(html)
u'a ← b → c'
Features
Support for multiple languages.
Language-sensitive replacements for single quotes and double quotes.
Ellipsis, dashes, nonbreakable spaces, …
Arrows (–> turned into → ), dimensions (12 × 30).
Symbols (trademark, registered, copyright, EUR, …)
Alternatives
Typogrify - English only, adds markup for styling, on top of smartypants
cstypo - Czech only, not working well with HTML
Plans
License: MIT
© 2013-2014 Jan Javorek <mail@honzajavorek.cz>
This work is licensed under MIT license.
Metadata
Release files for tipi 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tipi-0.0.4.tar.gz | 12.5 kB | Without provenance | Details for tipi-0.0.4.tar.gz |
Release files / tipi-0.0.4.tar.gz
| Download URL | tipi-0.0.4.tar.gz |
|---|---|
| Size | 12.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a80a38ad7f8e18321e0456b40a24a82db64d338f7ed2100d10637892ba63cb03
|
|
BLAKE2b-256 checksum How to use checksums |
53f22e53b18ef06d890f8fdab4bce4ca29c921022e37cd34a45e80fe07b8b14b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for tipi 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.