Richtypo.py

The only web typograph that don't make a mess out of your text
Alternatives To Richtypo.py
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Django_documentation64
3 years ago12Python
Russian translation of Django documentation
Chm Documentation16
5 years ago
chm documentation PostgreSQL pgadmin3 SQLAlchemy Django Flask jinja2 webpy doc chm compiled html help Postgres Postgre документация russian
Mahjong Portal12
3 days ago23mitPython
Portal for russian riichi mahjong community
Richtypo.py8
13 years ago5February 27, 201710mitPython
The only web typograph that don't make a mess out of your text
Django Vkontakte Iframe8
9 years ago1mitPython
Django app for developing vk.com (aka vkontakte.ru largest, Russian social network) iframe applications. Handles user authentication and registration. Official git mirror.
Django Sphinxsearch8
10 years ago1Python
A transparent layer for full-text search using Sphinx API and Django
Emergent6
10 years ago19mitJavaScript
Эксперимент на самоорганизацию программеров.
Pybb5
12 years agobsd-3-clausePython
Django Forum Application
Django Sendsmsru5
5 years agoPython
Russian backends for django-sendsms
Django Dev Protector4
6 years agobsd-3-clausePython
Django app that protects freelance developers
Alternatives To Richtypo.py
Select To Compare


Alternative Project Comparisons
Readme

Richtypo — the only web typograph tool that don't make a mess out of your text

Richtypo assumes that your text already has right dashes and quotes. The main concern is to add non-breaking spaces to the right places.

This project is heavily inspired by Artem Sapegin's richtypo.

PyPI version Build Status codecov

Features

  • Blazing fast, aimed for render-time usage.
  • Native Russian support.
  • HTML, Markdown and Plain-text aware, does not break your markup.
  • Your text stays readable and indexable — richtypo does not produce HTML entities and other messy stuff.
  • Easy integration with Jinja2, Django templates and any other language.
  • Well tested Python3 and Python2 support. For py2 only unicode input is accepted.
  • Easily extendable through smallest possible regular expressions defined in YAML with in-place specifications.

Installation

pip install richtypo

Usage

from richtypo import Richtypo


r = Richtypo(ruleset='ru-lite')

well_done = r.richtypo(text)

Jinja2 filter

from richtypo.filter import filter

env = jinja2.Environment(
    filters={
        'richtypo': filter
    }
)

Template:

{{ text | richtypo('ru-lite') }}

Django filter

# your_app/templatetags/richtypo.py

from django import template
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
from richtypo.filter import filter as typograph

register = template.Library()


@register.filter
@stringfilter
def richtypo(value, ruleset='generic'):
    return mark_safe(typograph(value, ruleset))

Template:

{% load richtypo %}

{{ object.text | richtypo:"ru-lite"}}

License

MIT

Popular Django Projects
Popular Russian Projects
Popular Frameworks Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Python
Django
Russian
Jinja2