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)); }
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); }
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())); }
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)); }
public override void Render(RenderContext renderContext) { renderContext.AppendResult(SiteManager.Middlewares.ResolveSpecialTag(renderContext.BadrRequest, _specialTagName)); }