public Template(string template, string templateName, string script, ResourceCollection resourceProvider) { if (string.IsNullOrEmpty(templateName)) { throw new ArgumentNullException(nameof(templateName)); } if (string.IsNullOrEmpty(template)) { throw new ArgumentNullException(nameof(template)); } Name = templateName; var typeAndExtension = GetTemplateTypeAndExtension(templateName); Extension = typeAndExtension.Item2; Type = typeAndExtension.Item1; IsPrimary = typeAndExtension.Item3; _script = script; if (resourceProvider != null) { if (Path.GetExtension(templateName).Equals(".liquid", StringComparison.OrdinalIgnoreCase)) { _renderer = LiquidTemplateRenderer.Create(resourceProvider, template); } else { _renderer = new MustacheTemplateRenderer(resourceProvider, template); } } Resources = ExtractDependentResources(); }
private static ITemplateRenderer CreateRenderer(ResourceCollection resourceCollection, string templateName, string template) { if (resourceCollection == null) { throw new ArgumentNullException(nameof(resourceCollection)); } if (Path.GetExtension(templateName).Equals(".liquid", StringComparison.OrdinalIgnoreCase)) { return(LiquidTemplateRenderer.Create(resourceCollection, template)); } else { return(new MustacheTemplateRenderer(resourceCollection, template)); } }