Returns the renderer object.

        :param name: name of the requested renderer
        :param template_path: path to the template
779238
def get(self, name, template_path):
        '''
        
        '''
        if name not in self._renderers:
            cls = self._renderer_classes.get(name)
            if cls is None:
                return None
            else:
                self._renderers[name] = cls(template_path, self.extra_vars)
        return self._renderers[name]
206023
def render_mako_template(self, template_path, context=None):
        
        context = context or {}
        template_str = self.load_unicode(template_path)
        lookup = MakoTemplateLookup(directories=[pkg_resources.resource_filename(self.module_name, '')])
        template = MakoTemplate(template_str, lookup=lookup)
        return template.render(**context)
283342
def render(self, template, filename, context={}, filters={}):
        
        filename = os.path.normpath(filename)
        path, file = os.path.split(filename)
        try:
            os.makedirs(path)
        except OSError as exception:
            if exception.errno != errno.EEXIST:
                raise

        path, file = os.path.split(template)
        loader = jinja2.FileSystemLoader(path)
        env = jinja2.Environment(loader=loader, trim_blocks=True, lstrip_blocks=True)
        env.filters.update(filters)
        template = env.get_template(file)
        text = template.render(context)
        with open(filename, 'wt') as f:
            f.write(text)
685018
def render_template(template_name, context):
    """"""
    return Environment(
        loader=PackageLoader('remarkable')
    ).get_template(template_name).render(context)
1113518
def render_template_for_path(request, path, context=None, use_cache=True, def_name=None):
    '''
    
    '''
    return get_template_for_path(path, use_cache).render(context, request, def_name)
1365302
def render(self, template: str, **vars) -> str:
        
        vars.setdefault('ctx', self._ctx)
        return self._renderer.render(template, **vars)
1130935
def template(template_name, *, app_key=APP_KEY, encoding='utf-8', status=200):
    

    def wrapper(func):
        @functools.wraps(func)
        async def wrapped(*args, **kwargs):
            if asyncio.iscoroutinefunction(func):
                coro = func
            else:
                coro = asyncio.coroutine(func)
            context = await coro(*args, **kwargs)
            if isinstance(context, web.StreamResponse):
                return context

            if 'request' in kwargs:
                request = kwargs['request']
            elif not args:
                request = None
                warnings.warn("Request not detected")
            elif isinstance(args[0], AbstractView):
                request = args[0].request
            else:
                request = args[-1]

            response = render_template(template_name, request, context,
                                       app_key=app_key, encoding=encoding)
            response.set_status(status)
            return response
        return wrapped
    return wrapper
1172210
def get_template(self, path):
        

        if self.options['debug'] and self.options['cache_size']:
            return self.cache.get(path, self.cache_template(path))
        return self.load_template(path)
684006
def template(tpl, template_adapter=SimpleTemplate, **kwargs):
    '''
    
    '''
    if tpl not in TEMPLATES or DEBUG:
        settings = kwargs.get('template_settings',{})
        lookup = kwargs.get('template_lookup', TEMPLATE_PATH)
        if isinstance(tpl, template_adapter):
            TEMPLATES[tpl] = tpl
            if settings: TEMPLATES[tpl].prepare(settings)
        elif "\n" in tpl or "{" in tpl or "%" in tpl or '$' in tpl:
            TEMPLATES[tpl] = template_adapter(source=tpl, lookup=lookup, settings=settings)
        else:
            TEMPLATES[tpl] = template_adapter(name=tpl, lookup=lookup, settings=settings)
    if not TEMPLATES[tpl]:
        abort(500, 'Template (%s) not found' % tpl)
    kwargs['abort'] = abort
    kwargs['request'] = request
    kwargs['response'] = response
    return TEMPLATES[tpl].render(**kwargs)
688833
def render(self, name=None, template=None, context={}):
        ''''

        '''

        if isinstance(template, Template):
            _template = template
        else:
            _template = Template.objects.get(name=name)

        # Maybe cache or save local ?
        response = self.env.from_string(
            _template.content).render(context)

        return response
292097
def render_name(self, template_name, *context, **kwargs):
        
        loader = self._make_loader()
        template = loader.load_name(template_name)
        return self._render_string(template, *context, **kwargs)
1003545
def setup_template_render(path, config_path):
    

    # initialization
    cp = get_embedded_config(path)
    output = ''
    filename = os.path.basename(path)

    # use meta-data if not empty for rendering
    if cp.has_option(filename, 'render-function'):
        render_function_name = cp.get(filename, 'render-function')
        render_function = eval(render_function_name)
        output = render_function(path, cp)

    # read configuration file for rendering
    elif os.path.exists(config_path):
        cp.read(config_path)

        # render template
        if cp.has_option(filename, 'render-function'):
            render_function_name = cp.get(filename, 'render-function')
            render_function = eval(render_function_name)
            output = render_function(path, cp)
        else:
            output = render_default(path, cp)

    # if no configuration file is present
    # then render the default template
    else:
        output = render_default(path, cp)

    return output
307282
def render_page(path):
    
    try:
        page = Page.get_by_url(request.path)
    except NoResultFound:
        abort(404)

    return render_template(
        [page.template_name, current_app.config['PAGES_DEFAULT_TEMPLATE']],
        page=page)
861882
def render_template_file(template, context=None):
    
    assert isinstance(context, Mapping)
    template = get_template(template)
    return template.render(context)
534838
def render(self, template_name, __data=None, **kw):
        ''''''
        return self.template.render(template_name,
                                    **self._vars(__data, **kw))
139062
def renderer(name):
    
    try:
        if name not in Store.renderers:
            extension(name)
        return Store.renderers[name]
    except ImportError:
        msg = ('Could not find a {name!r} renderer, available renderers are: {available}.')
        available = ', '.join(repr(k) for k in Store.renderers)
        raise ImportError(msg.format(name=name, available=available))
952998
def get_template_loader_for_path(path, use_cache=True):
    '''
    
    '''
    dmp = apps.get_app_config('django_mako_plus')
    return dmp.engine.get_template_loader_for_path(path, use_cache)