Create() public static méthode

public static Create ( ResourceCollection resourceProvider, string template ) : LiquidTemplateRenderer
resourceProvider ResourceCollection
template string
Résultat LiquidTemplateRenderer
Exemple #1
0
        public ITemplateRenderer Load(ResourceInfo res)
        {
            if (res == null)
            {
                return(null);
            }

            using (new LoggerFileScope(res.Path))
            {
                var extension = Path.GetExtension(res.Path);
                if (extension.Equals(MustacheTemplateRenderer.Extension, System.StringComparison.OrdinalIgnoreCase))
                {
                    return(new RendererWithResourcePool(() => new MustacheTemplateRenderer(_reader, res), _maxParallelism));
                }
                else if (extension.Equals(LiquidTemplateRenderer.Extension, System.StringComparison.OrdinalIgnoreCase))
                {
                    return(new RendererWithResourcePool(() => LiquidTemplateRenderer.Create(_reader, res), _maxParallelism));
                }
                else
                {
                    Logger.LogWarning($"{res.Path} is not a supported template view.");
                    return(null);
                }
            }
        }
Exemple #2
0
 private static ITemplateRenderer CreateRenderer(ResourceCollection resourceCollection, TemplateRendererResource templateResource)
 {
     if (templateResource.Type == TemplateRendererType.Liquid)
     {
         return(LiquidTemplateRenderer.Create(resourceCollection, templateResource));
     }
     else
     {
         return(new MustacheTemplateRenderer(resourceCollection, templateResource));
     }
 }
Exemple #3
0
 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));
     }
 }