Login

Text replacement with alternative font faces

Author:
scsiboy
Posted:
June 21, 2009
Language:
Python
Version:
1.0
Score:
0 (after 0 ratings)

Complex of tags and filters for easy replacement of text with alternative font faces. For browsers, who doesn`t support it by themselves.

Templatetag code and documentation at GitHub of django-headline.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
{% load headline %}

{{ foo|headline:"font.ttf,20,#000" }}
{{ foo|headline:"font.ttf,20,#000,underlined,all" }}
{{ foo|headline:"base,br" }}

{% headline "font.ttf,20,#000" %}Big {{ foo }}{% endheadline %}
{% headline "font.ttf,20,#000,strikeout,none" %}Big {{ foo }}{% endheadline %}
{% headline "base" %}Big {{ foo }}{% endheadline %}

{% headlines foo_list bar_dict baz_var "And some text" as headers "font.ttf,20,#000" %}
{% headlines foo_list bar_dict baz_var "And some text" as headers "font.ttf,20,#000,all" %}
{% headlines foo_list bar_dict baz_var "And some text" as headers "base" %}

{% for head in headers %}
   <img src="{{ head.file }}" alt="{{ head.text }}" width="{{ head.width }}" height="{{ head.height }}" />
{% endfor %}

More like this

  1. Template tag - list punctuation for a list of items by shapiromatron 3 months, 1 week ago
  2. JSONRequestMiddleware adds a .json() method to your HttpRequests by cdcarter 3 months, 2 weeks ago
  3. Serializer factory with Django Rest Framework by julio 10 months, 1 week ago
  4. Image compression before saving the new model / work with JPG, PNG by Schleidens 11 months ago
  5. Help text hyperlinks by sa2812 11 months, 4 weeks ago

Comments

Please login first before commenting.