public override void Render(RenderContext context) { object value = context.GetValue(_name); if (value != null) { context.Write(value.ToString()); } }
private static void ParseOptions(RenderContext ctx, string[] splits, out IDictionary <string, object> options) { options = null; for (var i = 0; i < splits.Length; i++) { var arg = splits[i]; if (arg.Contains("=")) { if (options == null) { options = new Dictionary <string, object>(); } var splits2 = arg.Split(new[] { '=' }, 2); var key = splits2[0]; var val = splits2[1]; if (val[0] == '"') { options[key] = val.Substring(1, val.Length - 2); } else { options[key] = ctx.GetValue(val); } } } }
public override void Render(RenderContext context) { object value = context.GetValue(_path); if (value != null) { context.Write(_escaped ? Encoders.HtmlEncode(value.ToString()) : value.ToString()); } }
public override void Render(RenderContext context) { object value = context.GetValue(_name); if (value != null) { context.Write(_escaped ? HttpUtility.HtmlEncode( value.ToString()) : value.ToString()); } }
public override void Render(RenderContext context) { object value = context.GetValue(_name); if (value != null) { context.Write(_escaped ? HttpUtility.HtmlEncode(value.ToString()) : value.ToString()); } }
public override void Render(RenderContext context) { var value = context.GetValue(_path); var helper = value as HelperProxy; if (helper != null) { helper(data => { }, data => { }); } else if (value != null) { context.Write(_escaped ? Encoders.HtmlEncode(value.ToString()) : value.ToString()); } }
public override void Render(RenderContext context) { object value = context.GetValue(_path); if (value != null) { context.Write(_escaped ? Encoders.HtmlEncode(value.ToString()) : ReplaceLineBreaksAndEncode(value.ToString())); return; } if (context.CurrentOptions.PreserveUndefinedVariables && !context.PathExists(_path)) { context.Write(Source()); } }
public override void Render(RenderContext context) { var value = context.GetValue(_path); var lambda = CheckValueIsDelegateOrLambda(value); if (lambda != null) { var lambdaResult = lambda().ToString(); lambdaResult = _escaped ? Encoders.HtmlEncode(lambdaResult.ToString()) : lambdaResult.ToString(); using (System.IO.TextReader sr = new System.IO.StringReader(lambdaResult)) { Template template = new Template(); template.StartDelimiter = "{{"; template.EndDelimiter = "}}"; template.Load(sr); context.Enter(template); template.Render(context); context.Exit(); return; } } var helper = value as HelperProxy; if (helper != null) { helper(data => { }, data => { }); } else if (value != null) { context.Write(_escaped ? Encoders.HtmlEncode(value.ToString()) : value.ToString()); } }
public override void Render(RenderContext context) { var value = context.GetValue(_path); var lambda = CheckValueIsDelegateOrLambda(value); if(lambda != null) { var lambdaResult = lambda().ToString(); lambdaResult = _escaped ? context.HtmlEncoder(lambdaResult.ToString()) : lambdaResult.ToString(); using (System.IO.TextReader sr = new System.IO.StringReader(lambdaResult)) { Template template = new Template(); template.StartDelimiter = "{{"; template.EndDelimiter = "}}"; template.Load(sr); context.Enter(template); template.Render(context); context.Exit(); return; } } var helper = value as HelperProxy; if (helper != null) { helper(data => { }, data => { }); } else if (value != null) { context.Write(_escaped ? context.HtmlEncoder(value.ToString()) : value.ToString()); } }
private static void ParseArguments(RenderContext ctx, string[] splits, out IList <object> arguments) { arguments = null; if (splits.Length > 1) { arguments = new List <object>(splits).GetRange(1, splits.Length - 1); for (var i = 0; i < arguments.Count; i++) { var arg = (string)arguments[i]; if (arg[0] == '"') { arguments[i] = arg.Substring(1, arg.Length - 2); } else { arguments[i] = ctx.GetValue(arg); } } } }
public override void Render(RenderContext context) { var value = context.GetValue(Name); var lambda = CheckValueIsDelegateOrLambda(value); if (lambda != null) { var lambdaResult = lambda(InnerSource()).ToString(); using (TextReader sr = new StringReader(lambdaResult)) { var template = new Template(); template.StartDelimiter = context.ActiveStartDelimiter; template.EndDelimiter = context.ActiveEndDelimiter; template.Load(sr); context.Enter(template); template.Render(context); context.Exit(); } return; } var helper = value as HelperProxy; if (helper != null) { helper(data => { context.Enter(this); context.Push(data); RenderParts(context); context.Pop(); context.Exit(); }, data => { if (Inverse != null) { context.Enter(Inverse); context.Push(data); Inverse.RenderParts(context); context.Pop(); context.Exit(); } }); return; } foreach (var item in context.GetValues(Name)) { context.Enter(this); context.Push(item); base.Render(context); context.Pop(); context.Exit(); } }
private static void ParseOptions(RenderContext ctx, string[] splits, out IDictionary<string, object> options) { options = null; for (var i = 0; i < splits.Length; i++) { var arg = splits[i]; if (arg.Contains("=")) { if (options == null) { options = new Dictionary<string, object>(); } var splits2 = arg.Split(new[] { '=' }, 2); var key = splits2[0]; var val = splits2[1]; if (val[0] == '"') { options[key] = val.Substring(1, val.Length - 2); } else { options[key] = ctx.GetValue(val); } } } }
private static void ParseArguments(RenderContext ctx, string[] splits, out IList<object> arguments) { arguments = null; if (splits.Length > 1) { arguments = new List<object>(splits).GetRange(1, splits.Length - 1); for (var i = 0; i < arguments.Count; i++) { var arg = (string)arguments[i]; if (arg[0] == '"') { arguments[i] = arg.Substring(1, arg.Length - 2); } else { arguments[i] = ctx.GetValue(arg); } } } }
public override void Render(RenderContext context) { var value = context.GetValue(Name); var lambda = CheckValueIsDelegateOrLambda(value); if (lambda != null) { var lambdaResult = lambda(InnerSource()).ToString(); using(TextReader sr = new StringReader(lambdaResult)) { var template = new Template(); template.StartDelimiter = context.ActiveStartDelimiter; template.EndDelimiter = context.ActiveEndDelimiter; template.Load(sr); context.Enter(template); template.Render(context); context.Exit(); } return; } var helper = value as HelperProxy; if (helper != null) { helper(data => { context.Enter(this); context.Push(data); RenderParts(context); context.Pop(); context.Exit(); }, data => { if (Inverse != null) { context.Enter(Inverse); context.Push(data); Inverse.RenderParts(context); context.Pop(); context.Exit(); } }); return; } foreach (var item in context.GetValues(Name)) { context.Enter(this); context.Push(item); base.Render(context); context.Pop(); context.Exit(); } }