本文整理了Java中freemarker.template.Configuration.setStrictSyntaxMode()
方法的一些代码示例,展示了Configuration.setStrictSyntaxMode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.setStrictSyntaxMode()
方法的具体详情如下:
包路径:freemarker.template.Configuration
类名称:Configuration
方法名:setStrictSyntaxMode
[英]Sets whether directives such as if, else, etc must be written as #if, #else, etc. Defaults to true.
When this is true, any tag not starting with <# or </# or <@ or </@ is considered as plain text and will go to the output as is. Tag starting with <# or </# must be valid FTL tag, or else the template is invalid (i.e. <#noSuchDirective> is an error).
[中]
代码示例来源:origin: org.freemarker/freemarker
setLocalizedLookup(StringUtil.getYesNo(value));
} else if (STRICT_SYNTAX_KEY_SNAKE_CASE.equals(name) || STRICT_SYNTAX_KEY_CAMEL_CASE.equals(name)) {
setStrictSyntaxMode(StringUtil.getYesNo(value));
} else if (WHITESPACE_STRIPPING_KEY_SNAKE_CASE.equals(name)
|| WHITESPACE_STRIPPING_KEY_CAMEL_CASE.equals(name)) {
代码示例来源:origin: net.sourceforge.fmpp/fmpp
/**
* Sets if the {@code #} is required in FTL tags or not.
* In the old template syntax {@code #} was not required.
* The default and recommended value for this engine parameter is
* {@code false}.
*/
public void setOldTemplateSyntax(boolean oldSyntax) {
checkParameterLock();
fmCfg.setStrictSyntaxMode(!oldSyntax);
}
代码示例来源:origin: liimaorg/liima
/**
* Validates if the given freemarker context is syntactically correct.
*
* @param freemarkerContent
* @throws AMWException
* if the template can not be successfully validate. The error message distincts between
* parsing exceptions and other (unexpected) potential issues.
*/
public void validateFreemarkerSyntax(String freemarkerContent) throws AMWException {
Objects.requireNonNull(freemarkerContent, "freemarker content must not be null");
Configuration c = new Configuration();
c.setStrictSyntaxMode(true);
c.setTagSyntax(Configuration.AUTO_DETECT_TAG_SYNTAX);
String templateName = "validation";
StringTemplateLoader stringLoader = new StringTemplateLoader();
stringLoader.putTemplate(templateName, freemarkerContent);
c.setTemplateLoader(stringLoader);
try {
c.getTemplate(templateName);
}
catch (ParseException e) {
// Validation failed! - was not able to parse the template!
throw new AMWException("The template is syntactically incorrect: " + e.getMessage(), e);
}
catch (IOException e) {
// Something else went wrong
throw new AMWException("The template can not be validated: " + e.getMessage(), e);
}
}
代码示例来源:origin: net.sourceforge.schemacrawler/schemacrawler
cfg
.setEncoding(Locale.getDefault(), outputOptions.getInputCharset().name());
cfg.setStrictSyntaxMode(true);
cfg.setWhitespaceStripping(true);
代码示例来源:origin: org.freemarker/freemarker-gae
setLocalizedLookup(StringUtil.getYesNo(value));
} else if (STRICT_SYNTAX_KEY_SNAKE_CASE.equals(name) || STRICT_SYNTAX_KEY_CAMEL_CASE.equals(name)) {
setStrictSyntaxMode(StringUtil.getYesNo(value));
} else if (WHITESPACE_STRIPPING_KEY_SNAKE_CASE.equals(name)
|| WHITESPACE_STRIPPING_KEY_CAMEL_CASE.equals(name)) {
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
setLocalizedLookup(StringUtil.getYesNo(value));
} else if (STRICT_SYNTAX_KEY_SNAKE_CASE.equals(name) || STRICT_SYNTAX_KEY_CAMEL_CASE.equals(name)) {
setStrictSyntaxMode(StringUtil.getYesNo(value));
} else if (WHITESPACE_STRIPPING_KEY_SNAKE_CASE.equals(name)
|| WHITESPACE_STRIPPING_KEY_CAMEL_CASE.equals(name)) {
代码示例来源:origin: org.freemarker/com.springsource.freemarker
setLocalizedLookup(StringUtil.getYesNo(value));
} else if (STRICT_SYNTAX_KEY.equals(key)) {
setStrictSyntaxMode(StringUtil.getYesNo(value));
} else if (WHITESPACE_STRIPPING_KEY.equals(key)) {
setWhitespaceStripping(StringUtil.getYesNo(value));
内容来源于网络,如有侵权,请联系作者删除!