~ubuntu-branches/debian/sid/python-django/sid

« back to all changes in this revision

Viewing changes to django/contrib/webdesign/templatetags/webdesign.py

  • Committer: Package Import Robot
  • Author(s): Raphaël Hertzog
  • Date: 2014-09-17 14:15:11 UTC
  • mfrom: (1.3.17) (6.2.18 experimental)
  • Revision ID: package-import@ubuntu.com-20140917141511-icneokthe9ww5sk4
Tags: 1.7-2
* Release to unstable.
* Add a migrate-south sample script to help users apply their South
  migrations. Thanks to Brian May.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
register = template.Library()
7
7
 
 
8
 
8
9
class LoremNode(template.Node):
9
10
    def __init__(self, count, method, common):
10
11
        self.count, self.method, self.common = count, method, common
22
23
            paras = ['<p>%s</p>' % p for p in paras]
23
24
        return '\n\n'.join(paras)
24
25
 
 
26
 
25
27
@register.tag
26
28
def lorem(parser, token):
27
29
    """
41
43
    paragraph (starting "Lorem ipsum dolor sit amet, consectetuer...").
42
44
 
43
45
    Examples:
44
 
        * ``{% lorem %}`` will output the common "lorem ipsum" paragraph
45
 
        * ``{% lorem 3 p %}`` will output the common "lorem ipsum" paragraph
46
 
          and two random paragraphs each wrapped in HTML ``<p>`` tags
47
 
        * ``{% lorem 2 w random %}`` will output two random latin words
 
46
 
 
47
    * ``{% lorem %}`` will output the common "lorem ipsum" paragraph
 
48
    * ``{% lorem 3 p %}`` will output the common "lorem ipsum" paragraph
 
49
      and two random paragraphs each wrapped in HTML ``<p>`` tags
 
50
    * ``{% lorem 2 w random %}`` will output two random latin words
48
51
    """
49
52
    bits = list(token.split_contents())
50
53
    tagname = bits[0]