This application provides a set of custom filters for the Django template system which automatically apply various transformations to plain text in order to yield typographically-improved HTML.
typogrify is designed to work with Django, and so requires a functioning installation of Django 0.96 or later.
checkout the project into a folder called typogrify
on your python path:
git clone git@github.com:chrisdrackett/django-typogrify.git typogrify
Add 'typogrify' to your INSTALLED_APPS setting.
Wraps ampersands in HTML with <span class="amp"></span>
so they can be
styled with CSS. Ampersands are also normalized to &. Requires
ampersands to have whitespace or an on both sides. Will not
change any ampersand which has already been wrapped in this fashion.
Wraps multiple capital letters in <span class="caps"></span>
so they can
be styled with CSS.
Wraps initial quotes in <span class="dquo"></span>
for double quotes or
<span class="quo"></span>
for single quotes. Works inside these block
elements:
Also accounts for potential opening inline elements: a, em, strong, span, b, i.
Based on Shaun Inman's PHP utility of the same name, replaces the
space between the last two words in a string with
to avoid
a final line of text with only one word.
Works inside these block elements:
Also accounts for potential closing inline elements: a, em, strong, span, b, i.
http://daringfireball.net/2008/05/title_case
wraps number suffix's in <span class="ord"></span>
so they can be styled.
(uses code from http://djangosnippets.org/snippets/1347/)
Returns the date in a more human readable format:
Applies all of the following filters, in order:
Apply all django-typogrify
filters to template output:
{% load typogrify_tags %}
{{ blog_post.contents|typogrify }}