Exemple #1
0
 def tests(self, env, context, builtins=True):
     """List the tests."""
     from inspect import getdoc
     strip = set()
     if not builtins:
         from jinja.defaults import DEFAULT_TESTS
         strip = set(DEFAULT_TESTS.values())
     tests = env.tests.items()
     tests.sort(lambda a, b: cmp(a[0].lower(), b[0].lower()))
     result = []
     for name, f in tests:
         if f in strip:
             continue
         doc = '\n'.join(['    ' + x for x in (getdoc(f) or '').splitlines()])
         result.append('`%s`\n\n%s' % (name, doc))
     return '\n\n'.join(result)
Exemple #2
0
 def tests(self, env, context, builtins=True):
     """List the tests."""
     from inspect import getdoc
     strip = set()
     if not builtins:
         from jinja.defaults import DEFAULT_TESTS
         strip = set(DEFAULT_TESTS.values())
     tests = env.tests.items()
     tests.sort(lambda a, b: cmp(a[0].lower(), b[0].lower()))
     result = []
     for name, f in tests:
         if f in strip:
             continue
         doc = '\n'.join(
             ['    ' + x for x in (getdoc(f) or '').splitlines()])
         result.append('`%s`\n\n%s' % (name, doc))
     return '\n\n'.join(result)