public TemplateFactory newTemplateFactory(String templatePath, TemplateModifier modifier) throws TemplateLoadingException {
return newTemplateFactory(templatePath, DefaultEncoding, modifier);
}
public TemplateFactory newTemplateFactory(String templatePath, String encoding, TemplateModifier modifier) throws TemplateLoadingException {
VirtualFile file = getTemplateFile(templatePath);
TemplateDocument document = parseTemplate(file.getRealFile(), encoding);
if (modifier != null) {
modifier.modifyTemplate(document);
}
try {
if (document.getIncludes() != null) {
return new FileTemplateFactory(this, document.normalize(), file.getRealFile(), encoding, modifier, getFiles(document.getIncludes()), changeDetectionInterval);
}
return new FileTemplateFactory(this, document.normalize(), file.getRealFile(), encoding, modifier, null, changeDetectionInterval);
} catch (BehaviorInstantiationException e) {
throw new TemplateLoadingException(e);
}
}