예제 #1
0
        //internal static Template LoadTemplate(JinjaEnvironment environment, string templateText, IDictionary<string, object?> variableTemplate, string? templateName, string? templatePath)
        //{
        //    var expr = ToExpression(environment, templateText, variableTemplate, out var compiler);
        //    return new Template(environment, compiler.Compile(expr), templateName, templatePath);
        //}
        internal static Template LoadTemplate(JinjaEnvironment environment, string templateText, IScope scope, string?templateName, string?templatePath)
        {
            var expr = ToExpression(templateName, environment, templateText, scope);

            var debug = expr.ToString("C#");
            var test  = new VariableSetterWalker();
            var x     = test.Visit(expr);

            ;

            return(new Template(environment, ExpressionData.CreateCompiled(expr, scope), templateName, templatePath));
        }
예제 #2
0
        internal static Template LoadTemplate(JinjaEnvironment environment, string templateText, IDictionary <string, object?> variableTemplate, string?templateName, string?templatePath)
        {
            var rootScope = Scope.CreateRootScope("GLOBALS", variableTemplate);
            var expr      = ToExpression(templateName, environment, templateText, rootScope);

            var debug = expr.ToString("C#");
            var test  = new VariableSetterWalker();
            var x     = test.Visit(expr);

            ;

            return(new Template(environment, ExpressionData.CreateCompiled(expr, rootScope), templateName, templatePath));
        }