renders a template and returns its output

@param templateName the templateName to be resolved by Thymeleafs templateResolver
@param emailModel the emailModel
@param model additional model
@param locale the locale

@return rendered output
324196
public String render(String templateName, EmailModel emailModel, Map<String, Object> model, Locale locale) {

		if (logger.isDebugEnabled()) {
			logger.debug("Rendering template [{}] for recipient [{}]", templateName, emailModel.getTo());
		}

		final IEngineConfiguration engineConfiguration = templateEngineFactory.getTemplateEngine().getConfiguration();
		final ExpressionContext context = new ExpressionContext(engineConfiguration, locale);

        context.setVariable(ThymeleafEvaluationContext.THYMELEAF_EVALUATION_CONTEXT_CONTEXT_VARIABLE_NAME,
                new ThymeleafEvaluationContext(applicationContext, null));

		context.setVariables(model);
		context.setVariable(THYMELEAF_EMAIL_MODEL_NAME, emailModel);
		return templateEngineFactory.getTemplateEngine().process(templateName, context);
	}
802947
private String generateContent(String templateFile) {
		try {
			GStringTemplateEngine gStringEngine = new GStringTemplateEngine();
			URL url = loadTemplate(templateFolder + "/" + templateFile);
			if (url == null) {
				logWarn("NO TEMPLATE FOUND FOR " + templateFile);
			} else {
				logDebug("Loaded template: " + url.getPath());
			}
			if (url == null) return null;
			
			Template template = gStringEngine.createTemplate(url);
			return template.make(modelMap).toString();
		} catch (Exception e) {
			ps.println("### ERROR: Failed generate templatefile: " + templateFile);
			e.printStackTrace(ps);
			return null;
		}
	}
1270303
function renderString(templateString, options, callback) {
  var template = builtTemplateFromString(templateString, '', options);
  return template.render({ model: options, }, callback);
}
818916
public static <T> Middleware<SyncHandler<Response<T>>, AsyncHandler<Response<ByteString>>> htmlSerializeResponseSync(
      final String templateName) {
    Middleware<SyncHandler<Response<T>>, AsyncHandler<Response<T>>> syncToAsync = Middleware::syncToAsync;
    return syncToAsync.and(htmlSerializeResponse(templateName));
  }
167890
public OvhTemplates installationTemplate_templateName_GET(String templateName) throws IOException {
		String qPath = "/me/installationTemplate/{templateName}";
		StringBuilder sb = path(qPath, templateName);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhTemplates.class);
	}
218165
public function javascriptTemplateRender($templateName, $viewData) {
    /** @var $templateEngine \Twig_Environment */
    $templateEngine = $this->getTemplateEnv();
    return $templateEngine->render($templateName, $viewData);
  }
1098091
@Deprecated
  @SuppressWarnings({"deprecation"})
  @Override
  public String render(
      SoyTemplateInfo templateInfo, @Nullable SoyRecord data, @Nullable SoyMsgBundle msgBundle) {
    return render(templateInfo.getPartialName(), data, msgBundle);
  }
231311
public function renderMethod()
    {
        return $this->renderTemplate($this->templateName, [
            'className'     => $this->foreignClass,
            'methodName'    => camel_case($this->methodName),
            'foreignColumn' => $this->foreignColumnName,
            'localColumn'   => $this->localColumnName,
        ]);
    }
1315179
def get_template_i18n(template_name, locale):
    """"""
    if locale is None:
        return [template_name]

    template_list = []
    parts = template_name.rsplit(".", 1)
    root = parts[0]
    suffix = parts[1]

    if locale.territory is not None:
        locale_string = "_".join([locale.language, locale.territory])
        localized_template_path = ".".join([root, locale_string, suffix])
        template_list.append(localized_template_path)

    localized_template_path = ".".join([root, locale.language, suffix])
    template_list.append(localized_template_path)

    # append the default
    template_list.append(template_name)
    return template_list
427705
public String render(String template) {
    ENGINE_LOG.debug(template);
    return render(parse(template), true);
  }
489726
function renderMessage(template, user, vars) {
    var appurl = app.getExternalUrl();
    var emailVars = _.defaults(vars || {}, template.templateVars || {}, config.templateVars || {}, {
      'appurl': appurl,
      'settings': app.config.settings
    });
    // XXX should use route resolution fns
    if (user && user.local.signupToken) {
      emailVars.signupLink = appurl + "/verification/" + user.local.signupToken;
    }
    if (user && user.local.resetToken) {
      emailVars.resetLink = appurl + "/forgot/" + user.local.resetToken;
    }

    var msgSubject = swig.render(template.subject, {locals:emailVars});

    var message = {
        from: template.from || config.from,
        to: template.to || user.local.email,
        subject: msgSubject,
    };
    if (template.replyTo) {
      message.replyTo = template.replyTo;
    }

    if (template.templatePath && template.templateName) {
      throw new Error("mail template configuration error: templatePath and templateName cannot both be set");
    }

    if (template.templatePath) {
      message.html = swig.renderFile(template.templatePath, emailVars);
      return message;
    } else {
      message.vars = emailVars;
      message.templateName = template.templateName;
      message.merge_language = template.merge_language || "mailchimp";
      return message;
    }
  }
749915
public String transform(Map<String, Object> model, Locale locale) {
		return transform(model, locale, engine.getModelAdaptor(), null);
	}
919061
def render(self, template_name, **kw):
        '''
        
        '''
        logger.debug('Rendering template "%s"', template_name)
        vars = self.globs.copy()
        vars.update(kw)
        resolved_name, engine = self.resolve(template_name)
        return engine.render(resolved_name, **vars)
87332
public Renderable<?> render(Template template, Map<String, Object> parameters) {
        return template.render(this, parameters);
    }
867581
public static String render(String path, String templateFileName, Map<String, Object> bindingMap) {
		if (FileUtil.isAbsolutePath(path)) {
			return render(getFileTemplate(path, templateFileName), bindingMap);
		} else {
			return render(getClassPathTemplate(path, templateFileName), bindingMap);
		}
	}
1074950
@Override
	protected void renderMergedTemplateModel(Map<String, Object> model, HttpServletRequest request,
			HttpServletResponse response) throws NoSuchBeanDefinitionException, NoUniqueBeanDefinitionException
	{
		// 如果未指定groupTemplate，取上下文中唯一的GroupTemplate对象
		if (groupTemplate == null)
		{
			groupTemplate = getApplicationContext().getBean(GroupTemplate.class);
		}

		// 渲染方法
		WebRender render = new WebRender(groupTemplate) {
			@Override
			protected void modifyTemplate(Template template, String key, HttpServletRequest request,
					HttpServletResponse response, Object... args)
			{
				Map<?, ?> model = (Map<?, ?>) args[0];

				for (Entry<?, ?> entry : model.entrySet())
				{
					String name = (String) entry.getKey();
					Object value = entry.getValue();
					template.binding(name, value);
				}
			}
		};
		String path = getUrl();
		render.render(path, request, response, model);
	}
1177026
def EmailTemplate(
        self,
        TemplateId,
        TemplateModel,
        From,
        To,
        TemplateAlias=None,
        Cc=None,
        Bcc=None,
        Subject=None,
        Tag=None,
        ReplyTo=None,
        Headers=None,
        TrackOpens=None,
        TrackLinks="None",
        Attachments=None,
        InlineCss=True,
    ):
        
        return EmailTemplate(
            manager=self,
            TemplateId=TemplateId,
            TemplateAlias=TemplateAlias,
            TemplateModel=TemplateModel,
            From=From,
            To=To,
            Cc=Cc,
            Bcc=Bcc,
            Subject=Subject,
            Tag=Tag,
            ReplyTo=ReplyTo,
            Headers=Headers,
            TrackOpens=TrackOpens,
            TrackLinks=TrackLinks,
            Attachments=Attachments,
            InlineCss=InlineCss,
        )