Пример #1
0
 public override void Render(RenderContext renderContext)
 {
     string templatePath = (string)renderContext[_templatePathVar.Variable, _templatePathVar.Filters];
     TemplateEngine templateEngine = SiteManager.Views.GetTemplateEngine(templatePath);
     if (templateEngine != null)
     {
         renderContext.AppendResult(templateEngine.Render(renderContext.BadrRequest, renderContext.Context));
     }
     else
         throw new Exception(string.Format("Including template failed: '{0}' not found, template line {1}", templatePath, ExprMatchResult.Line));
 }
Пример #2
0
 public override void Render(RenderContext renderContext)
 {
 }
Пример #3
0
 public abstract void Render(RenderContext renderContext);
Пример #4
0
        public override void Render(RenderContext renderContext)
        {
            object forList = renderContext[_listVar.Variable, _listVar.Filters];

            if (forList != null)
            {
                int for_counter = 0;

                foreach (object o in (IEnumerable)forList)
                {
                    renderContext.PushOverride(_loopVariableName, o);
                    renderContext.PushOverride(FOR_COUNTER, for_counter);

                    renderContext.RenderSubScopes();
                    for_counter++;
                }

                renderContext.PopOverride(_loopVariableName);
                renderContext.PopOverride(FOR_COUNTER);
            }
        }
Пример #5
0
        protected internal void RenderSubScopes(RenderContext renderContext)
        {
            foreach (Scope subScope in SubScopes)
            {
                if (subScope.ExprRenderer.RenderType != ExprRenderType.BlockMiddle)
                    renderContext.AppendResult(_subScopesStaticText[subScope]);

                renderContext.RenderScope(subScope);
            }

            if (_lastStaticText != null)
                renderContext.AppendResult(_lastStaticText);
        }
Пример #6
0
 public override void Render(RenderContext renderContext)
 {
     object val = renderContext[_variable.Variable, _variable.Filters];
     if (val != null)
         renderContext.AppendResult(
             val is SafeData
             ? ((SafeData)val).Value.ToString()
             : HttpUtility.HtmlEncode(val.ToString()));
 }
Пример #7
0
        public override void Render(RenderContext renderContext)
        {
            string urlName = (string)renderContext[_urlNameVar.Variable, _urlNameVar.Filters];

            if (_namedArgsCount > 0 || _positionalArgsCount > 0)
            {
                int i = 0;
                string[] argValues = new string[_namedArgsCount + _positionalArgsCount];

                if (_urlNamedArgsVar != null)
                    foreach (KeyValuePair<string, TemplateVarFiltered> assignment in _urlNamedArgsVar)
                    {
                        argValues[i] = string.Format("{0}={1}", assignment.Key, renderContext[assignment.Value.Variable, assignment.Value.Filters]);
                        i++;
                    }

                if (_urlPositionalArgsVar != null)
                    for (int pos = 0; pos < _urlPositionalArgsVar.Count; pos++)
                    {
                        TemplateVarFiltered tvf = _urlPositionalArgsVar[pos];
                        argValues[i] = string.Format("{0}={1}", pos + 1, renderContext[tvf.Variable, tvf.Filters]);
                        i++;
                    }

                renderContext.AppendResult(SiteManager.Urls.Reverse(urlName, argValues));
            }
            else
                renderContext.AppendResult(SiteManager.Urls.Reverse(urlName));
        }
Пример #8
0
 public override void Render(RenderContext renderContext)
 {
     if (_parentIfRenderer != null && !_parentIfRenderer.EvaluationResult)
     {
         renderContext.RenderSubScopes();
     }
 }
 public override void Render(RenderContext renderContext)
 {
     FilterManager.LoadFilters(_filterName);
 }
Пример #10
0
 public override void Render(RenderContext renderContext)
 {
     renderContext.AppendResult(SiteManager.Middlewares.ResolveSpecialTag(renderContext.BadrRequest, _specialTagName));
 }
Пример #11
0
            public bool Evaluate(RenderContext renderContext)
            {
                bool result;

                object lVar = renderContext[LeftVar.Variable, LeftVar.Filters];

                if (RightVar == null)
                {
                    if (lVar is bool)
                        result = (bool)lVar;
                    else
                        result = lVar != null;
                } else
                {
                    object rVar = renderContext [RightVar.Variable, RightVar.Filters];
                    result = ApplyOperator (lVar, rVar);
                }

                if (IsNegated)
                    result = !result;

                return result;
            }
Пример #12
0
        public override void Render(RenderContext renderContext)
        {
            EvaluationResult = false;

            foreach(List<IfCondition> andedIfConditions in _oredConditions)
            {
                bool result = true;
                foreach(IfCondition ifCondition in andedIfConditions)
                    result = result && ifCondition.Evaluate(renderContext);

                EvaluationResult = EvaluationResult || result;
            }

            if (EvaluationResult)
            {
                renderContext.RenderSubScopes();
            }
        }