freemarker.template.Configuration.setRecognizeStandardFileExtensions()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中freemarker.template.Configuration.setRecognizeStandardFileExtensions()方法的一些代码示例,展示了Configuration.setRecognizeStandardFileExtensions()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.setRecognizeStandardFileExtensions()方法的具体详情如下:
包路径:freemarker.template.Configuration
类名称:Configuration
方法名:setRecognizeStandardFileExtensions

Configuration.setRecognizeStandardFileExtensions介绍

[英]Sets if the "file" extension part of the source name ( Template#getSourceName()) will influence certain parsing settings. For backward compatibility, it defaults to false if #getIncompatibleImprovements() is less than 2.3.24. Starting from incompatibleImprovements2.3.24, it defaults to true, so the following standard file extensions take their effect:

  • ftlh: Sets TemplateConfiguration#setOutputFormat(OutputFormat) to "HTML" (i.e., HTMLOutputFormat#INSTANCE, unless the "HTML" name is overridden by #setRegisteredCustomOutputFormats(Collection)) and TemplateConfiguration#setAutoEscapingPolicy(int) to #ENABLE_IF_DEFAULT_AUTO_ESCAPING_POLICY.
  • ftlx: Sets TemplateConfiguration#setOutputFormat(OutputFormat) to "XML" (i.e., XMLOutputFormat#INSTANCE, unless the "XML" name is overridden by #setRegisteredCustomOutputFormats(Collection)) and TemplateConfiguration#setAutoEscapingPolicy(int) to #ENABLE_IF_DEFAULT_AUTO_ESCAPING_POLICY.

These file extensions are not case sensitive. The file extension is the part after the last dot in the source name. If the source name contains no dot, then it has no file extension.

The settings activated by these file extensions override the setting values dictated by #setTemplateConfigurations(TemplateConfigurationFactory).
[中]设置源名称(模板#getSourceName())的“文件”扩展名部分是否会影响某些解析设置。对于向后兼容性,如果#GetCompatibleMProvisions()小于2.3.24,则默认为false。从不兼容的改进2开始。3.24,默认为true,因此以下标准文件扩展名生效:
*ftlh:将TemplateConfiguration#setOutputFormat(OutputFormat)设置为“HTML”(即,HTMLOutputFormat)实例,除非“HTML”名称被#setRegisteredCustomOutputFormats(Collection))覆盖,并将TemplateConfiguration#设置自动转义策略(int)设置为#如果默认#自动转义#策略,则启用#。
*ftlx:将TemplateConfiguration#setOutputFormat(OutputFormat)设置为“XML”(即,XMLOutputFormat#实例,除非“XML”名称被#setRegisteredCustomOutputFormats(Collection))覆盖,并将TemplateConfiguration#设置自动转义策略(int)设置为#如果默认#自动转义#策略,则启用#。
这些文件扩展名不区分大小写。文件扩展名是源名称中最后一个点之后的部分。如果源名称不包含点,则它没有文件扩展名。
这些文件扩展名激活的设置会覆盖#setTemplateConfigurations(TemplateConfigurationFactory)指定的设置值。

代码示例

代码示例来源:origin: org.freemarker/freemarker

unsetRecognizeStandardFileExtensions();
} else {
  setRecognizeStandardFileExtensions(StringUtil.getYesNo(value));

代码示例来源:origin: org.freemarker/freemarker-gae

unsetRecognizeStandardFileExtensions();
} else {
  setRecognizeStandardFileExtensions(StringUtil.getYesNo(value));

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

unsetRecognizeStandardFileExtensions();
} else {
  setRecognizeStandardFileExtensions(StringUtil.getYesNo(value));

相关文章

Configuration类方法