public ConfigureLiquidEngine(IConfiguration configuration, IWorkflowStorageService workflowStorageService, IOptions <LiquidOptions> liquidOptions, IActivityTypeService activityTypeService) { _configuration = configuration; _workflowStorageService = workflowStorageService; _liquidOptions = liquidOptions.Value; _activityTypeService = activityTypeService; }
public LiquidTemplateManager(LiquidParser parser, IMemoryCache memoryCache, IOptions <LiquidOptions> options, IServiceProvider serviceProvider) { _parser = parser; _memoryCache = memoryCache; _serviceProvider = serviceProvider; _options = options.Value; }
public LiquidTemplateManager( IMemoryCache memoryCache, IOptions <LiquidOptions> options, IServiceProvider serviceProvider) { _memoryCache = memoryCache; _liquidOptions = options.Value; _serviceProvider = serviceProvider; }
internal static void AddAsyncFilters(this TemplateContext templateContext, LiquidOptions options, IServiceProvider services) { foreach (var registration in options.FilterRegistrations) { templateContext.Filters.AddAsyncFilter(registration.Key, (input, arguments, ctx) => { var filter = (ILiquidFilter)services.GetRequiredService(registration.Value); return(filter.ProcessAsync(input, arguments, ctx)); }); } }
internal static void AddAsyncFilters(this LiquidTemplateContext context, LiquidOptions options) { context.Filters.EnsureCapacity(options.FilterRegistrations.Count); foreach (var registration in options.FilterRegistrations) { context.Filters.AddAsyncFilter(registration.Key, (input, arguments, ctx) => { var filter = (ILiquidFilter)context.Services.GetRequiredService(registration.Value); return(filter.ProcessAsync(input, arguments, ctx)); }); } }
public async Task Render() { var options = new LiquidOptions(); var parser = new LiquidParser(new OptionsWrapper <LiquidOptions>(options)); var template = parser.Parse("{% render 'header' %}"); var root = Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location), "Scripting\\Liquid"); var context = new TemplateContext(options) { Options = { FileProvider = new PhysicalFileProvider(root) } }; var rendered = await template.RenderAsync(context); Assert.Equal("<h2>YES</h2>", rendered); }
public LiquidTemplateManager(IMemoryCache memoryCache, IOptions <LiquidOptions> options, IServiceProvider serviceProvider) { this.memoryCache = memoryCache; this.serviceProvider = serviceProvider; this.options = options.Value; }