Example #1
0
    def testJabberwocky(self):
        """
		Tests the tag for pulling jabberwocky
		"""
        graph_range = range(1, 8)
        for graphs in graph_range:
            t = "{% load greeking_tags %}{% jabberwocky " + str(graphs) + " %}"
            ctx, out = self.render(t)
            match = get_jabberwocky_html(get_grafs(graphs))
            self.assertEqual(out, match)
def jabberwocky(count=7):
    """
    Prints paragraphs from Lewis Caroll's poem Jabberwocky for greeking
    in templates.

    Usage format::

        {% jabberwocky [count] %}

    ``count`` is a number (or variable) containing the number of paragraphs or
    words to generate (default is 7, which prints the entire poem).

    Examples:
        * ``{% jabberwocky %}`` will output the common "lorem ipsum" paragraph
        * ``{% jabberwocky 3 %}`` will output three paragraphs from the poem
    """
    return get_jabberwocky_html(get_grafs(count or 7))
 def render(self, context):
     try:
         count = int(self.count)
     except (ValueError, TypeError):
         count = None
     return get_jabberwocky_html(get_grafs(count))