# Path: jinja2/utils.py
# def generate_lorem_ipsum(n=5, html=True, min=20, max=100):
#     """Generate some lorem impsum for the template."""
#     from jinja2.constants import LOREM_IPSUM_WORDS
#     from random import choice, random, randrange
#     words = LOREM_IPSUM_WORDS.split()
#     result = []
# 
#     for _ in xrange(n):
#         next_capitalized = True
#         last_comma = last_fullstop = 0
#         word = None
#         last = None
#         p = []
# 
#         # each paragraph contains out of 20 to 100 words.
#         for idx, _ in enumerate(xrange(randrange(min, max))):
#             while True:
#                 word = choice(words)
#                 if word != last:
#                     last = word
#                     break
#             if next_capitalized:
#                 word = word.capitalize()
#                 next_capitalized = False
#             # add commas
#             if idx - randrange(3, 8) > last_comma:
#                 last_comma = idx
#                 last_fullstop += 2
#                 word += ','
#             # add end of sentences
#             if idx - randrange(10, 20) > last_fullstop:
#                 last_comma = last_fullstop = idx
#                 word += '.'
#                 next_capitalized = True
#             p.append(word)
# 
#         # ensure that the paragraph ends with a dot.
#         p = u' '.join(p)
#         if p.endswith(','):
#             p = p[:-1] + '.'
#         elif not p.endswith('.'):
#             p += '.'
#         result.append(p)
# 
#     if not html:
#         return u'\n\n'.join(result)
#     return Markup(u'\n'.join(u'<p>%s</p>' % escape(x) for x in result))
# 
# class Cycler(object):
#     """A cycle helper for templates."""
# 
#     def __init__(self, *items):
#         if not items:
#             raise RuntimeError('at least one item has to be provided')
#         self.items = items
#         self.reset()
# 
#     def reset(self):
#         """Resets the cycle."""
#         self.pos = 0
# 
#     @property
#     def current(self):
#         """Returns the current item."""
#         return self.items[self.pos]
# 
#     def next(self):
#         """Goes one item ahead and returns it."""
#         rv = self.current
#         self.pos = (self.pos + 1) % len(self.items)
#         return rv
# 
# class Joiner(object):
#     """A joining helper for templates."""
# 
#     def __init__(self, sep=u', '):
#         self.sep = sep
#         self.used = False
# 
#     def __call__(self):
#         if not self.used:
#             self.used = True
#             return u''
#         return self.sep
# 
# Path: jinja2/filters.py
# FILTERS = {
#     'attr':                 do_attr,
#     'replace':              do_replace,
#     'upper':                do_upper,
#     'lower':                do_lower,
#     'escape':               escape,
#     'e':                    escape,
#     'forceescape':          do_forceescape,
#     'capitalize':           do_capitalize,
#     'title':                do_title,
#     'default':              do_default,
#     'd':                    do_default,
#     'join':                 do_join,
#     'count':                len,
#     'dictsort':             do_dictsort,
#     'sort':                 do_sort,
#     'length':               len,
#     'reverse':              do_reverse,
#     'center':               do_center,
#     'indent':               do_indent,
#     'title':                do_title,
#     'capitalize':           do_capitalize,
#     'first':                do_first,
#     'last':                 do_last,
#     'random':               do_random,
#     'filesizeformat':       do_filesizeformat,
#     'pprint':               do_pprint,
#     'truncate':             do_truncate,
#     'wordwrap':             do_wordwrap,
#     'wordcount':            do_wordcount,
#     'int':                  do_int,
#     'float':                do_float,
#     'string':               soft_unicode,
#     'list':                 do_list,
#     'urlize':               do_urlize,
#     'format':               do_format,
#     'trim':                 do_trim,
#     'striptags':            do_striptags,
#     'slice':                do_slice,
#     'batch':                do_batch,
#     'sum':                  sum,
#     'abs':                  abs,
#     'round':                do_round,
#     'sort':                 do_sort,
#     'groupby':              do_groupby,
#     'safe':                 do_mark_safe,
#     'xmlattr':              do_xmlattr
# }
# 
# Path: jinja2/tests.py
# TESTS = {
#     'odd':              test_odd,
#     'even':             test_even,
#     'divisibleby':      test_divisibleby,
#     'defined':          test_defined,
#     'undefined':        test_undefined,
#     'none':             test_none,
#     'lower':            test_lower,
#     'upper':            test_upper,
#     'string':           test_string,
#     'number':           test_number,
#     'sequence':         test_sequence,
#     'iterable':         test_iterable,
#     'callable':         callable,
#     'sameas':           test_sameas,
#     'escaped':          test_escaped
# }


from jinja2.utils import generate_lorem_ipsum, Cycler, Joiner
from jinja2.filters import FILTERS as DEFAULT_FILTERS
from jinja2.tests import TESTS as DEFAULT_TESTS
# -*- coding: utf-8 -*-
"""
    jinja2.defaults
    ~~~~~~~~~~~~~~~

    Jinja default filters and tags.

    :copyright: 2007-2008 by Armin Ronacher.
    :license: BSD, see LICENSE for more details.
"""


# defaults for the parser / lexer
BLOCK_START_STRING = '{%'
BLOCK_END_STRING = '%}'
VARIABLE_START_STRING = '{{'
VARIABLE_END_STRING = '}}'
COMMENT_START_STRING = '{#'
COMMENT_END_STRING = '#}'
LINE_STATEMENT_PREFIX = None
TRIM_BLOCKS = False
NEWLINE_SEQUENCE = '\n'


# default filters, tests and namespace
DEFAULT_NAMESPACE = {
    'range':        xrange,
    'dict':         lambda **kw: kw,

# Path: jinja2/utils.py
# def generate_lorem_ipsum(n=5, html=True, min=20, max=100):
#     """Generate some lorem impsum for the template."""
#     from jinja2.constants import LOREM_IPSUM_WORDS
#     from random import choice, random, randrange
#     words = LOREM_IPSUM_WORDS.split()
#     result = []
# 
#     for _ in xrange(n):
#         next_capitalized = True
#         last_comma = last_fullstop = 0
#         word = None
#         last = None
#         p = []
# 
#         # each paragraph contains out of 20 to 100 words.
#         for idx, _ in enumerate(xrange(randrange(min, max))):
#             while True:
#                 word = choice(words)
#                 if word != last:
#                     last = word
#                     break
#             if next_capitalized:
#                 word = word.capitalize()
#                 next_capitalized = False
#             # add commas
#             if idx - randrange(3, 8) > last_comma:
#                 last_comma = idx
#                 last_fullstop += 2
#                 word += ','
#             # add end of sentences
#             if idx - randrange(10, 20) > last_fullstop:
#                 last_comma = last_fullstop = idx
#                 word += '.'
#                 next_capitalized = True
#             p.append(word)
# 
#         # ensure that the paragraph ends with a dot.
#         p = u' '.join(p)
#         if p.endswith(','):
#             p = p[:-1] + '.'
#         elif not p.endswith('.'):
#             p += '.'
#         result.append(p)
# 
#     if not html:
#         return u'\n\n'.join(result)
#     return Markup(u'\n'.join(u'<p>%s</p>' % escape(x) for x in result))
# 
# class Cycler(object):
#     """A cycle helper for templates."""
# 
#     def __init__(self, *items):
#         if not items:
#             raise RuntimeError('at least one item has to be provided')
#         self.items = items
#         self.reset()
# 
#     def reset(self):
#         """Resets the cycle."""
#         self.pos = 0
# 
#     @property
#     def current(self):
#         """Returns the current item."""
#         return self.items[self.pos]
# 
#     def next(self):
#         """Goes one item ahead and returns it."""
#         rv = self.current
#         self.pos = (self.pos + 1) % len(self.items)
#         return rv
# 
# class Joiner(object):
#     """A joining helper for templates."""
# 
#     def __init__(self, sep=u', '):
#         self.sep = sep
#         self.used = False
# 
#     def __call__(self):
#         if not self.used:
#             self.used = True
#             return u''
#         return self.sep
# 
# Path: jinja2/filters.py
# FILTERS = {
#     'attr':                 do_attr,
#     'replace':              do_replace,
#     'upper':                do_upper,
#     'lower':                do_lower,
#     'escape':               escape,
#     'e':                    escape,
#     'forceescape':          do_forceescape,
#     'capitalize':           do_capitalize,
#     'title':                do_title,
#     'default':              do_default,
#     'd':                    do_default,
#     'join':                 do_join,
#     'count':                len,
#     'dictsort':             do_dictsort,
#     'sort':                 do_sort,
#     'length':               len,
#     'reverse':              do_reverse,
#     'center':               do_center,
#     'indent':               do_indent,
#     'title':                do_title,
#     'capitalize':           do_capitalize,
#     'first':                do_first,
#     'last':                 do_last,
#     'random':               do_random,
#     'filesizeformat':       do_filesizeformat,
#     'pprint':               do_pprint,
#     'truncate':             do_truncate,
#     'wordwrap':             do_wordwrap,
#     'wordcount':            do_wordcount,
#     'int':                  do_int,
#     'float':                do_float,
#     'string':               soft_unicode,
#     'list':                 do_list,
#     'urlize':               do_urlize,
#     'format':               do_format,
#     'trim':                 do_trim,
#     'striptags':            do_striptags,
#     'slice':                do_slice,
#     'batch':                do_batch,
#     'sum':                  sum,
#     'abs':                  abs,
#     'round':                do_round,
#     'sort':                 do_sort,
#     'groupby':              do_groupby,
#     'safe':                 do_mark_safe,
#     'xmlattr':              do_xmlattr
# }
# 
# Path: jinja2/tests.py
# TESTS = {
#     'odd':              test_odd,
#     'even':             test_even,
#     'divisibleby':      test_divisibleby,
#     'defined':          test_defined,
#     'undefined':        test_undefined,
#     'none':             test_none,
#     'lower':            test_lower,
#     'upper':            test_upper,
#     'string':           test_string,
#     'number':           test_number,
#     'sequence':         test_sequence,
#     'iterable':         test_iterable,
#     'callable':         callable,
#     'sameas':           test_sameas,
#     'escaped':          test_escaped
# }


# Path: jinja2/defaults.py
from jinja2.utils import generate_lorem_ipsum, Cycler, Joiner
from jinja2.filters import FILTERS as DEFAULT_FILTERS
from jinja2.tests import TESTS as DEFAULT_TESTS

# -*- coding: utf-8 -*-
"""
    jinja2.defaults
    ~~~~~~~~~~~~~~~

    Jinja default filters and tags.

    :copyright: 2007-2008 by Armin Ronacher.
    :license: BSD, see LICENSE for more details.
"""


# defaults for the parser / lexer
BLOCK_START_STRING = '{%'
BLOCK_END_STRING = '%}'
VARIABLE_START_STRING = '{{'
VARIABLE_END_STRING = '}}'
COMMENT_START_STRING = '{#'
COMMENT_END_STRING = '#}'
LINE_STATEMENT_PREFIX = None
TRIM_BLOCKS = False
NEWLINE_SEQUENCE = '\n'


# default filters, tests and namespace
DEFAULT_NAMESPACE = {
    'range':        xrange,
    'dict':         lambda **kw: kw,

    'lipsum':       generate_lorem_ipsum,