コード例 #1
0
 public HandlebarsCompiler(HandlebarsConfiguration configuration)
 {
     _configuration     = configuration;
     _tokenizer         = new Tokenizer(configuration);
     _expressionBuilder = new ExpressionBuilder(configuration);
     _functionBuilder   = new FunctionBuilder(configuration);
 }
コード例 #2
0
 public HandlebarsCompiler(HandlebarsConfiguration configuration)
 {
     _configuration=configuration;
     _tokenizer = new Tokenizer(configuration);
     _expressionBuilder = new ExpressionBuilder(configuration);
     _functionBuilder = new FunctionBuilder(configuration);
 }
コード例 #3
0
 private static void InvokePartial(
     string partialName,
     BindingContext context,
     HandlebarsConfiguration configuration)
 {
     if (configuration.RegisteredTemplates.ContainsKey(partialName) == false)
     {
         if (configuration.FileSystem != null && context.TemplatePath != null)
         {
             var partialPath = configuration.FileSystem.Closest(context.TemplatePath,
                 "partials/" + partialName + ".hbs");
             if (partialPath != null)
             {
                 var compiled = Handlebars.Create(configuration)
                     .CompileView(partialPath);
                 configuration.RegisteredTemplates.Add(partialName, (writer, o) =>
                 {
                     writer.Write(compiled(o));
                 });
             }
         }
         else
         {
             throw new HandlebarsRuntimeException(
                 string.Format("Referenced partial name {0} could not be resolved", partialName));
         }
     }
     configuration.RegisteredTemplates[partialName](context.TextWriter, context);
 }
コード例 #4
0
        private static bool InvokePartial(
            string partialName,
            BindingContext context,
            HandlebarsConfiguration configuration)
        {
            if (!configuration.TemplateRegistration.TryGetTemplate(partialName, out HandlebarsTemplate template))
            {
                var partialLookupKey = $"{context.TemplateName ?? string.Empty}+{partialName}";
                if (!configuration.TemplateRegistration.TryGetTemplate(partialLookupKey, out template))
                {
                    template = Handlebars.Create(configuration).CompileView(partialName, context.TemplateName, false);
                    if (template == null)
                    {
                        return(false);
                    }
                    configuration.TemplateRegistration.RegisterTemplate(partialLookupKey, template);
                }
                else
                {
                    return(false);
                }
            }

            try
            {
                template.RenderTo(context.TextWriter, context);
                return(true);
            }
            catch (Exception exception)
            {
                throw new HandlebarsRuntimeException(
                          $"Runtime error while rendering partial '{partialName}', see inner exception for more information",
                          exception);
            }
        }
コード例 #5
0
 private static void RegisterHelpers(this HandlebarsConfiguration handlebarsConfiguration, IEnumerable <IHelperBase> helpers)
 {
     foreach (var h in helpers)
     {
         h.Setup(handlebarsConfiguration);
     }
 }
コード例 #6
0
 private static bool InvokePartial(
     string partialName,
     BindingContext context,
     HandlebarsConfiguration configuration)
 {
     if (configuration.RegisteredTemplates.ContainsKey(partialName) == false)
     {
         if (configuration.FileSystem != null && context.TemplatePath != null)
         {
             var partialPath = configuration.FileSystem.Closest(context.TemplatePath,
                                                                "partials/" + partialName + ".hbs");
             if (partialPath != null)
             {
                 var compiled = Handlebars.Create(configuration)
                                .CompileView(partialPath);
                 configuration.RegisteredTemplates.Add(partialName, (writer, o) =>
                 {
                     writer.Write(compiled(o));
                 });
             }
             else
             {
                 // Failed to find partial in filesystem
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     configuration.RegisteredTemplates[partialName](context.TextWriter, context);
     return(true);
 }
コード例 #7
0
        public void BasicPathNoThrowOnNullExpression()
        {
            var source =
                @"{{#if foo}}
{{foo.bar}}
{{else}}
false
{{/if}}
";

            var config = new HandlebarsConfiguration
            {
                ThrowOnUnresolvedBindingExpression = true
            };
            var handlebars = Handlebars.Create(config);
            var template   = handlebars.Compile(source);

            var data = new
            {
                foo = (string)null
            };
            var result = template(data);

            Assert.Contains("false", result);
        }
コード例 #8
0
        private static bool IsBlockHelper(Expression item, HandlebarsConfiguration configuration)
        {
            item = UnwrapStatement(item);
            var helperExpression = item as HelperExpression;

            return(helperExpression != null && configuration.BlockHelpers.ContainsKey(helperExpression.HelperName.Replace("#", "")));
        }
コード例 #9
0
        public static ObjectEnumeratorValueProvider Create(HandlebarsConfiguration configuration)
        {
            var provider = Pool.Get();

            provider._configuration = configuration;
            return(provider);
        }
コード例 #10
0
 private static void InvokePartial(
     string partialName,
     BindingContext context,
     HandlebarsConfiguration configuration)
 {
     if (configuration.RegisteredTemplates.ContainsKey(partialName) == false)
     {
         if (configuration.FileSystem != null && context.TemplatePath != null)
         {
             var partialPath = configuration.FileSystem.Closest(context.TemplatePath,
                                                                "partials/" + partialName + ".hbs");
             if (partialPath != null)
             {
                 var compiled = Handlebars.Create(configuration)
                                .CompileView(partialPath);
                 configuration.RegisteredTemplates.Add(partialName, (writer, o) =>
                 {
                     writer.Write(compiled(o));
                 });
             }
         }
         else
         {
             throw new HandlebarsRuntimeException(
                       string.Format("Referenced partial name {0} could not be resolved", partialName));
         }
     }
     configuration.RegisteredTemplates[partialName](context.TextWriter, context);
 }
コード例 #11
0
ファイル: CasparTests.cs プロジェクト: esskar/Handlebars.Net
        public void CanRenderCasparIndexTemplate()
        {
            var configuration = new HandlebarsConfiguration
            {
                TemplateContentProvider = new DiskFileSystemTemplateContentProvider()
            };

            var handlebars = Handlebars.Create(configuration);

            AddHelpers(handlebars);
            var renderView = handlebars.CompileView("Providers/Casper-master/index.hbs");
            var output     = renderView.Render(new
            {
                blog = new
                {
                    url   = "http://someblog.com",
                    title = "This is the blog title"
                },
                posts = new[]
                {
                    new
                    {
                        title      = "My Post Title",
                        image      = "/someimage.png",
                        post_class = "somepostclass"
                    }
                }
            });
            var cq = CsQuery.CQ.CreateDocument(output);

            Assert.Equal("My Post Title", cq["h2.post-title a"].Text());
        }
コード例 #12
0
        public void CanIterateOverDictionaryInLayout()
        {
            var files = new FakeFileSystem
            {
                { "views\\layout.hbs", "Layout: {{#each this}}{{#if @First}}First:{{/if}}{{#if @Last}}Last:{{/if}}{{@Key}}={{@Value}};{{/each}}{{{body}}}" },
                { "views\\someview.hbs", "{{!< layout}} View" },
            };

            var handlebarsConfiguration = new HandlebarsConfiguration
            {
                FileSystem = files,
            };
            var handlebars = Handlebars.Create(handlebarsConfiguration);
            var render     = handlebars.CompileView("views\\someview.hbs");
            var output     = render(
                new Dictionary <string, object>
            {
                { "Foo", "Bar" },
                { "Baz", "Foo" },
                { "Bar", "Baz" },
            }
                );

            Assert.Equal("Layout: First:Foo=Bar;Baz=Foo;Last:Bar=Baz; View", output);
        }
コード例 #13
0
        public void CanIterateOverObjectInLayout()
        {
            var files = new FakeFileSystem
            {
                { "views\\layout.hbs", "Layout: {{#each this}}{{#if @First}}First:{{/if}}{{#if @Last}}Last:{{/if}}{{@Key}}={{@Value}};{{/each}}{{{body}}}" },
                { "views\\someview.hbs", "{{!< layout}} View" },
            };

            var handlebarsConfiguration = new HandlebarsConfiguration
            {
                FileSystem    = files,
                Compatibility =
                {
                    SupportLastInObjectIterations = true,
                },
            };
            var handlebars = Handlebars.Create(handlebarsConfiguration);
            var render     = handlebars.CompileView("views\\someview.hbs");
            var output     = render(
                new
            {
                Foo = "Bar",
                Baz = "Foo",
                Bar = "Baz",
            }
                );

            Assert.Equal("Layout: First:Foo=Bar;Baz=Foo;Last:Bar=Baz; View", output);
        }
コード例 #14
0
        public void AssertHandlebarsUndefinedBindingException()
        {
            var source = "Hello, {{person.firstname}} {{person.lastname}}!";

            var config = new HandlebarsConfiguration
            {
                ThrowOnUnresolvedBindingExpression = true
            };
            var handlebars = Handlebars.Create(config);
            var template   = handlebars.Compile(source);

            var data = new
            {
                person = new
                {
                    firstname = "Erik"
                }
            };

            try
            {
                template(data);
            }
            catch (HandlebarsUndefinedBindingException ex)
            {
                Assert.Equal("person.lastname", ex.Path);
                Assert.Equal("lastname", ex.MissingKey);
                return;
            }

            Assert.False(true, "Exception is expected.");
        }
コード例 #15
0
 public static BlockAccumulatorContext Create(Expression item, HandlebarsConfiguration configuration)
 {
     BlockAccumulatorContext context = null;
     if (IsConditionalBlock(item))
     {
         context = new ConditionalBlockAccumulatorContext(item);
     }
     else if (IsPartialBlock(item))
     {
         context = new PartialBlockAccumulatorContext(item);
     }
     else if (IsBlockHelper(item, configuration))
     {
         context = new BlockHelperAccumulatorContext(item);
     }
     else if (IsIteratorBlock(item))
     {
         context = new IteratorBlockAccumulatorContext(item);
     }
     else if (IsDeferredBlock(item))
     {
         context = new DeferredBlockAccumulatorContext(item);
     }
     return context;
 }
コード例 #16
0
        public static BlockAccumulatorContext Create(Expression item, HandlebarsConfiguration configuration)
        {
            BlockAccumulatorContext context = null;

            if (IsConditionalBlock(item))
            {
                context = new ConditionalBlockAccumulatorContext(item);
            }
            else if (IsPartialBlock(item))
            {
                context = new PartialBlockAccumulatorContext(item);
            }
            else if (IsBlockHelper(item, configuration))
            {
                context = new BlockHelperAccumulatorContext(item);
            }
            else if (IsIteratorBlock(item))
            {
                context = new IteratorBlockAccumulatorContext(item);
            }
            else if (IsDeferredBlock(item))
            {
                context = new DeferredBlockAccumulatorContext(item);
            }
            return(context);
        }
コード例 #17
0
 public override void Setup(HandlebarsConfiguration configuration)
 {
     configuration.Helpers.Add("set", SetHelper);
     configuration.Helpers.Add("get", GetHelper);
     configuration.Helpers.Add("clear", ClearHelper);
     configuration.BlockHelpers.Add("with_get", WithGetHelper);
     configuration.BlockHelpers.Add("with_set", WithSetHelper);
 }
コード例 #18
0
        /// <summary>
        /// Adds <c>log</c> helper that uses provided <paramref name="loggerFactory"/>
        /// </summary>
        /// <param name="configuration"></param>
        /// <param name="loggerFactory"></param>
        /// <returns></returns>
        public static HandlebarsConfiguration UseLogger(this HandlebarsConfiguration configuration, ILoggerFactory loggerFactory)
        {
            var compileTimeConfiguration = configuration.CompileTimeConfiguration;

            compileTimeConfiguration.Features.Add(new LoggerFeatureFactory(loggerFactory));

            return(configuration);
        }
コード例 #19
0
        private static HandlebarsConfiguration GetHandleBarsConfiguration(IPartialTemplateResolver templateResolver, IEnumerable <IHelperBase> moreHelpers)
        {
            var configuration = new HandlebarsConfiguration();

            configuration.RegisterDefaultHelpers();
            configuration.RegisterHelpers(moreHelpers);
            configuration.PartialTemplateResolver = templateResolver;
            return(configuration);
        }
コード例 #20
0
        public CustomConfigurationTests()
        {
            var configuration = new HandlebarsConfiguration
            {
                ExpressionNameResolver = new UpperCamelCaseExpressionNameResolver()
            };

            HandlebarsInstance = Handlebars.Create(configuration);
        }
コード例 #21
0
        /// <summary>
        /// Adds <see cref="IObjectDescriptorProvider"/>s required to support <c>System.Text.Json</c>.
        /// </summary>
        /// <param name="configuration"></param>
        /// <returns></returns>
        public static HandlebarsConfiguration UseJson(this HandlebarsConfiguration configuration)
        {
            var providers = configuration.ObjectDescriptorProviders;

            providers.Add(JsonDocumentObjectDescriptor);
            providers.Add(JsonElementObjectDescriptor);

            return(configuration);
        }
コード例 #22
0
 public void Init()
 {
     var configuration = new HandlebarsConfiguration
                             {
                                 ExpressionNameResolver =
                                     new UpperCamelCaseExpressionNameResolver()
                             };
                 
     this.HandlebarsInstance = Handlebars.Create(configuration);
 }
コード例 #23
0
        public void Init()
        {
            var configuration = new HandlebarsConfiguration
            {
                ExpressionNameResolver =
                    new UpperCamelCaseExpressionNameResolver()
            };

            this.HandlebarsInstance = Handlebars.Create(configuration);
        }
コード例 #24
0
        /// <summary>
        /// Allows to warm-up internal caches for specific types
        /// </summary>
        public static HandlebarsConfiguration UseWarmUp(this HandlebarsConfiguration configuration, Action <ICollection <Type> > configure)
        {
            var types = new HashSet <Type>();

            configure(types);

            configuration.CompileTimeConfiguration.Features.Add(new WarmUpFeatureFactory(types));

            return(configuration);
        }
コード例 #25
0
        public FileBasedHandlebarsTemplateEngine(string templateDirectoryPath)
        {
            BasePath = templateDirectoryPath ?? throw new ArgumentNullException(nameof(templateDirectoryPath));

            Configuration = new HandlebarsConfiguration()
            {
                ThrowOnUnresolvedBindingExpression = true
            };

            Handlebars = HandlebarsDotNet.Handlebars.Create(Configuration);
        }
コード例 #26
0
 private static void InvokePartial(
     string partialName,
     BindingContext context,
     HandlebarsConfiguration configuration)
 {
     if (configuration.RegisteredTemplates.ContainsKey(partialName) == false)
     {
         throw new HandlebarsRuntimeException("Referenced partial name could not be resolved");
     }
     configuration.RegisteredTemplates[partialName](context.TextWriter, context);
 }
コード例 #27
0
        public TemplateCollection()
        {
            var config = new HandlebarsConfiguration
            {
                // Not yet available. Uncomment later.
                //ThrowOnUnresolvedBindingExpression = true,
                TextEncoder = new NoopTextEncoder()
            };

            this.Instance = Handlebars.Create(config);
        }
コード例 #28
0
 /// <summary>
 /// Allows to intercept calls to missing helpers.
 /// <para>For Handlebarsjs docs see: https://handlebarsjs.com/guide/hooks.html#helpermissing</para>
 /// </summary>
 /// <param name="configuration"></param>
 /// <param name="helperMissing">Delegate that returns interceptor for <see cref="HandlebarsReturnHelper"/> and <see cref="HandlebarsHelper"/></param>
 /// <param name="blockHelperMissing">Delegate that returns interceptor for <see cref="HandlebarsBlockHelper"/></param>
 /// <returns></returns>
 public static HandlebarsConfiguration RegisterMissingHelperHook(
     this HandlebarsConfiguration configuration,
     HandlebarsReturnWithOptionsHelper helperMissing = null,
     HandlebarsBlockHelper blockHelperMissing        = null
     )
 {
     return(configuration.RegisterMissingHelperHook(
                helperMissing != null ? new DelegateReturnHelperWithOptionsDescriptor("helperMissing", helperMissing) : null,
                blockHelperMissing != null ? new DelegateBlockHelperDescriptor("blockHelperMissing", blockHelperMissing) : null
                ));
 }
コード例 #29
0
 private static void InvokePartial(
     string partialName,
     BindingContext context,
     HandlebarsConfiguration configuration)
 {
     if(configuration.RegisteredTemplates.ContainsKey(partialName) == false)
     {
         throw new HandlebarsRuntimeException("Referenced partial name could not be resolved");
     }
     configuration.RegisteredTemplates[partialName](context.TextWriter, context);
 }
コード例 #30
0
 private static bool IsBlockHelper(Expression item, HandlebarsConfiguration configuration)
 {
     item = UnwrapStatement(item);
     if (item is HelperExpression hitem)
     {
         var helperName = hitem.HelperName;
         return(!configuration.Helpers.ContainsKey(helperName) &&
                configuration.BlockHelpers.ContainsKey(helperName.Replace("#", "")));
     }
     return(false);
 }
コード例 #31
0
        public static string GetHelperResultFromJToken(IHelper helper, string json, string template)
        {
            var configuration = new HandlebarsConfiguration();

            helper.Setup(configuration);
            var handleBar = Handlebars.Create(configuration);

            var hb     = handleBar.Compile(template);
            var output = hb.Invoke(JToken.Parse(json));

            return(output);
        }
コード例 #32
0
        private static string GenerateFileContent(Student student)
        {
            var formatCustomHelper = new FormatCustomHelper();
            var config             = new HandlebarsConfiguration();

            config.Helpers.Add(formatCustomHelper.Key, formatCustomHelper.Write);

            string fileTemplate = File.ReadAllText("OutboundStudent.hbs");
            var    template     = Handlebars.Create(config).Compile(fileTemplate);

            var result = template(student);

            return(result);
        }
コード例 #33
0
ファイル: LoggerTests.cs プロジェクト: esskar/handlebars-core
        public void BasicLogging()
        {
            var loggerMock    = new Mock <ILogger>();
            var configuration = new HandlebarsConfiguration
            {
                Logger = loggerMock.Object
            };
            var engine   = new HandlebarsEngine(configuration);
            var template = engine.Compile("{{log \"Look at me!\"}}");

            template.Render(null);

            loggerMock.Verify(l => l.Log("Look at me!", LogLevel.Info));
        }
コード例 #34
0
        /// <summary>
        /// Changes <see cref="IExpressionCompiler"/> to the one using <c>FastExpressionCompiler</c>
        /// </summary>
        /// <param name="configuration"></param>
        /// <returns></returns>
        public static HandlebarsConfiguration UseCompileFast(this HandlebarsConfiguration configuration)
        {
            if (!OperatingSystem.IsWindows())
            {
                Debug.WriteLine("[WARNING] Only Windows OS is supported at the moment. Skipping feature.");
                return(configuration);
            }

            var compileTimeConfiguration = configuration.CompileTimeConfiguration;

            compileTimeConfiguration.Features.Add(new FastCompilerFeatureFactory());

            return(configuration);
        }
コード例 #35
0
ファイル: LoggerTests.cs プロジェクト: esskar/handlebars-core
        public void EverythingAfterLogLevelIsNotLogged()
        {
            var loggerMock    = new Mock <ILogger>();
            var configuration = new HandlebarsConfiguration
            {
                Logger = loggerMock.Object
            };
            var engine   = new HandlebarsEngine(configuration);
            var template = engine.Compile("{{log \"Logged!\" level=\"error\" \"Not logged!\" }}");

            template.Render(null);

            loggerMock.Verify(l => l.Log("Logged!", LogLevel.Error));
            loggerMock.Verify(l => l.Log("Not logged!", It.IsAny <LogLevel>()), Times.Never);
        }
コード例 #36
0
        public void NoOutputEncoding()
        {
            var template =
                "Hello {{person.name}} {{person.surname}} from {{person.address.homeCountry}}. You're {{description}}.";


            var configuration = new HandlebarsConfiguration
                                    {
                                        TextEncoder = null
                                    };

            var handlebarsInstance = Handlebars.Create(configuration);

            var output = handlebarsInstance.Compile(template).Invoke(Value);

            Assert.AreEqual(ExpectedOutput, output);
        }
コード例 #37
0
ファイル: PartialBinder.cs プロジェクト: rexm/Handlebars.Net
        private static bool InvokePartial(
            string partialName,
            BindingContext context,
            HandlebarsConfiguration configuration)
        {
            if (configuration.RegisteredTemplates.ContainsKey(partialName) == false)
            {
                if (configuration.FileSystem != null && context.TemplatePath != null)
                {
                    var partialPath = configuration.FileSystem.Closest(context.TemplatePath,
                        "partials/" + partialName + ".hbs");
                    if (partialPath != null)
                    {
                        var compiled = Handlebars.Create(configuration)
                            .CompileView(partialPath);
                        configuration.RegisteredTemplates.Add(partialName, (writer, o) =>
                        {
                            writer.Write(compiled(o));
                        });
                    }
                    else
                    {
                        // Failed to find partial in filesystem
                        return false;
                    }
                }
                else
                {
                    return false;
                }
            }

            try
            {
                configuration.RegisteredTemplates[partialName]( context.TextWriter, context );
                return true;
            }
            catch ( Exception exception )
            {
                throw new HandlebarsRuntimeException(
                    $"Runtime error while rendering partial '{partialName}', see inner exception for more information",
                    exception );
            }

        }
コード例 #38
0
        private static void RegisterHandlebarsViewEngine()
        {
            ViewEngines.Engines.Clear();

            var config = new HandlebarsConfiguration()
            {
                FileSystem = new HandlebarsMvcViewEngineFileSystem(),
            };
            var handlebars = Handlebars.Create(config);

            /* Helpers need to be registered up front - these are dummmy implementations of the ones used in Ghost*/
            handlebars.RegisterHelper("asset", (writer, context, arguments) => writer.Write("asset:" + string.Join("|", arguments)));
            handlebars.RegisterHelper("date", (writer, context, arguments) => writer.Write("date:" + string.Join("|", arguments)));
            handlebars.RegisterHelper("tags", (writer, context, arguments) => writer.Write("tags:" + string.Join("|", arguments)));
            handlebars.RegisterHelper("encode", (writer, context, arguments) => writer.Write("encode:" + string.Join("|", arguments)));
            handlebars.RegisterHelper("url", (writer, context, arguments) => writer.Write("url:" + string.Join("|", arguments)));

            ViewEngines.Engines.Add(new HandlebarsMvcViewEngine(handlebars));
        }
コード例 #39
0
        public void CanRenderCasparPostNoLayoutTemplate()
        {
            var fs = (new DiskFileSystem());
            var handlebarsConfiguration = new HandlebarsConfiguration() {FileSystem = fs};
            var handlebars = Handlebars.Create(handlebarsConfiguration);

            AddHelpers(handlebars);
            var renderView = handlebars.CompileView("ViewEngine/Casper-master/post-no-layout.hbs");
            var output = renderView(new
            {
                post = new
                {
                    title = "My Post Title",
                    image = "/someimage.png",
                    post_class = "somepostclass"
                }
            });
            var cq = CsQuery.CQ.CreateDocument(output);
            Assert.AreEqual("My Post Title", cq["h1.post-title"].Html());
        }
コード例 #40
0
 public FunctionBuilder(HandlebarsConfiguration configuration)
 {
     _configuration = configuration;
 }
コード例 #41
0
        public void JsonEncoding()
        {
            var template = "No html entities, {{Username}}.";


            var configuration = new HandlebarsConfiguration
                                    {
                                        TextEncoder = new JsonEncoder()
                                    };

            var handlebarsInstance = Handlebars.Create(configuration);

            var value = new {Username = "******"<Eric>\"\n<Sharp>"};
            var output = handlebarsInstance.Compile(template).Invoke(value);

            Assert.AreEqual(@"No html entities, \""<Eric>\""\n<Sharp>.", output);
        }
コード例 #42
0
 public CompilationContext(HandlebarsConfiguration configuration)
 {
     _configuration = configuration;
     _bindingContext = Expression.Variable(typeof(BindingContext), "context");
 }
コード例 #43
0
 public static IEnumerable<object> Convert(
     IEnumerable<object> sequence,
     HandlebarsConfiguration configuration)
 {
     return new HelperConverter(configuration).ConvertTokens(sequence).ToList();
 }
コード例 #44
0
 private BlockAccumulator(HandlebarsConfiguration configuration)
 {
     _configuration = configuration;
 }
コード例 #45
0
 public static IEnumerable<object> Remove(IEnumerable<object> sequence, HandlebarsConfiguration configuration)
 {
     return new WhitespaceRemover(configuration).ConvertTokens(sequence).ToList();
 }
コード例 #46
0
 private WhitespaceRemover(HandlebarsConfiguration configuration)
 {
     _configuration = configuration;
 }
コード例 #47
0
 private static bool IsBlockHelper(Expression item, HandlebarsConfiguration configuration)
 {
     item = UnwrapStatement(item);
     return (item is HelperExpression) && configuration.BlockHelpers.ContainsKey(((HelperExpression)item).HelperName.Replace("#", ""));
 }
コード例 #48
0
	    public UndefinedBindingResult(string value, HandlebarsConfiguration configuration)
	    {
		    Value = value;
		    _configuration = configuration;
	    }
コード例 #49
0
 public ExpressionBuilder(HandlebarsConfiguration configuration)
 {
     _configuration = configuration;
 }
コード例 #50
0
 private HelperConverter(HandlebarsConfiguration configuration)
 {
     _configuration = configuration;
 }
コード例 #51
0
ファイル: Tokenizer.cs プロジェクト: JMontagu/Handlebars.Net
        //TODO: structure parser

        public Tokenizer(HandlebarsConfiguration configuration)
        {
            _configuration = configuration;
        }
コード例 #52
0
 public static IEnumerable<object> Accumulate(
     IEnumerable<object> tokens,
     HandlebarsConfiguration configuration)
 {
     return new BlockAccumulator(configuration).ConvertTokens(tokens).ToList();
 }