public Enter ( Nustache.Core.Section section ) : void | ||
section | Nustache.Core.Section | |
리턴 | void |
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 ? 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(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(); } }
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(); } }