Render an ERB template
16687
def render(*args, &block)
      if $_compiler_stack && $_compiler_stack.last
        $_compiler_stack.last.render(*args, &block)
      else
        Origen.generator.compiler.render(*args, &block)
      end
    end
1123004
def render_template(template_file, template_vars):
    """"""
    # Load our Jinja templates
    template_dir = "{0}/templates".format(
        os.path.dirname(os.path.abspath(__file__))
    )
    jinja_env = jinja2.Environment(
        loader=jinja2.FileSystemLoader(template_dir),
        trim_blocks=True
    )
    rendered = jinja_env.get_template(template_file).render(template_vars)

    return rendered
1168746
def render(options=nil, deprecated_status_or_extra_options=nil, &block)
      if ::Rails::VERSION::STRING >= '2.0.0' && deprecated_status_or_extra_options.nil?
        deprecated_status_or_extra_options = {}
      end

      unless block_given?
        if @template.respond_to?(:finder)
          (class << @template.finder; self; end).class_eval do
            define_method :file_exists? do; true; end
          end
        else
          (class << @template; self; end).class_eval do
            define_method :file_exists? do; true; end
          end
        end
        (class << @template; self; end).class_eval do
          define_method :render_file do |*args|
            @first_render ||= args[0] unless args[0] =~ /^layouts/
            @_first_render ||= args[0] unless args[0] =~ /^layouts/
          end

          define_method :_pick_template do |*args|
            @_first_render ||= args[0] unless args[0] =~ /^layouts/
            PickedTemplate.new
          end
        end
      end

      super(options, deprecated_status_or_extra_options, &block)
    end
1290235
function render_template(type, object) {
  try {
    return new EJS({text: __templates[type]}).render(object);
  } catch (e) {
    //console.error(e);
    return "";
  }
}
30152
def render_tmplt(path, cp):
    

    # define filename and slug from path
    filename = os.path.basename(path)
    slug = filename.replace('.', '_')

    # initializations
    content = None

    # read file as a string
    with open(path, 'rb') as fp:
        content = fp.read()

    # replace all the escaped characters
    content = unescape(content, unescape_table)

    # render template
    template_dir = '/'.join(path.split('/')[:-1])
    env = Environment(loader=FileSystemLoader(template_dir))
    env.globals.update(setup_template_render=setup_template_render)
    env.globals.update(get_embedded_config=get_embedded_config)
    env.globals.update(path_exists=os.path.exists)
    template = env.get_template(filename)
    context = {'filename' : filename,
               'slug'     : slug,
               'cp'       : cp,
               'content'  : content}
    output = template.render(context)

    return output
227635
def render
      raise "unable to find template file: #{template}" unless File.exists?(template)

      extension = File.extname(template)
      extension = extension.downcase if extension

      case extension
        when '.erb'
          contents = File.open(template, "r") {|f| f.read}
          ERB.new(contents, nil, '-').result(self.get_binding)
        when '.slim'
          Slim::Template.new(template, {:pretty => true}).render(self)
        else
          raise "unsupported template type based on file extension #{extension}"
      end
    end
948496
def render_template(template_name, **context):
    """"""
    tmpl = jinja_env.get_template(template_name)
    context["url_for"] = url_for
    return Response(tmpl.render(context), mimetype="text/html")
395986
def render_template(name)
      if !@content.post_template.blank?

        # check if the template file actually exists
        if template_exists?("template-#{@content.post_template.downcase}")

          render :template => "themes/#{current_theme}/template-#{@content.post_template.downcase}." + get_theme_ext

        else

          # check if a file with the given name exists
          if template_exists?(name)
            render :template => "themes/#{current_theme}/#{name}." + get_theme_ext
          elsif template_exists?("page")
            # if not use the page.html.erb template which has to be included in the theme
            render :template => "themes/#{current_theme}/page." + get_theme_ext
          else
            render :inline => I18n.t("helpers.routing_helper.render_template.template_error")
          end

        end

      else

        # check if a file with the given name exists
        if template_exists?(name)
          render :template => "themes/#{current_theme}/#{name}." + get_theme_ext
        elsif template_exists?("page")
          # if not use the page.html.erb template which has to be included in the theme
          render :template => "themes/#{current_theme}/page." + get_theme_ext
        else
          render :inline => I18n.t("helpers.routing_helper.render_template.template_error")
        end

      end

    end
1349819
def _render_template(param, username):
    '''
    
    '''
    env = Environment()
    template = env.from_string(param)
    variables = {'username': username}
    return template.render(variables)
677987
def render_template(request, app, template_name, context=None, subdir="templates", def_name=None):
    '''
    
    '''
    return get_template(app, template_name, subdir).render(context, request, def_name)
17424
def render(self, name, context):
        """"""
        if Generator.strict:
            self.env.undefined = TestableUndefined
        else:
            self.env.undefined = Undefined
        template = self.get_template(name)
        return template.render(context)
273085
def render
      Mustache.view_namespace = self.class

      result = {}
      self.class.views.each do |view_name|
        template = File.join 'templates', "#{view_name}.mustache"
        template_path = self.class.find template

        view = File.join 'views', "#{view_name}.rb"
        view_path = self.class.find view

        Mustache.template_path = File.dirname template_path
        Mustache.view_path     = File.dirname view_path
        mustache = Mustache.view_class(view_name).new(self)
        mustache.template_name = view_name
        result[view_name] = mustache.render
      end
      result
    end
503255
def render_string(template_string, context, format = default_format)
      render_file(proc_template(template_string), context, format)
    end
1369411
def render(template, dest, **kwargs):
    '''
    '''

    dest_dir = dirname(dest)
    if dest_dir and not exists(dest_dir):
        makedirs(dest_dir)

    template = environment.get_template(template)
    text = template.render(**kwargs)

    f = open(dest, 'wb')
    f.write(text.encode('utf-8'))
    f.close()
1125808
def render_template(self, template, **kwargs):
        
        kwargs["base_template"] = self.appbuilder.base_template
        kwargs["appbuilder"] = self.appbuilder
        return render_template(
            template, **dict(list(kwargs.items()) + list(self.extra_args.items()))
        )
1114568
def template
      File.read("#{Dir.home}/.gem_updater_template.erb")
    rescue Errno::ENOENT
      File.read(File.expand_path('../lib/gem_updater_template.erb', __dir__))
    end
685018
def render_template(template_name, context):
    """"""
    return Environment(
        loader=PackageLoader('remarkable')
    ).get_template(template_name).render(context)