internal static void MatchVariablesAndEmit(IHxlTemplateEmitter builder, string text) { var c = MatchVariables(text); ProcessVariablesAndEmit(c, builder, text); }
private static void ProcessVariablesAndEmit(MatchCollection matches, IHxlTemplateEmitter builder, string text) { int previousIndex = 0; foreach (Match match in matches) { builder.EmitLiteral(text.Substring(previousIndex, match.Index - previousIndex)); string expText = match.Groups["Expression"].Value; var e = ParseAndBindExpr(expText); builder.EmitValue(e); previousIndex = match.Index + match.Length; } builder.EmitLiteral(text.Substring(previousIndex, text.Length - previousIndex)); }
protected override void EmitCode(IHxlTemplateEmitter emitter) { string text = string.Format("{0} __model = ({0}) this.Data.Model;", Type); emitter.EmitCode(text); }
internal void GetInitCode(string variable, IHxlTemplateEmitter context, TextWriter tw) { // TODO Possibly better to use other name in this attribute render closure // HACK __self__ is a hack tw.Write("{3} = global::{0}.Create(\"{2}\", (__closure, __self__) => {1});" + Environment.NewLine, typeof(HxlAttribute).FullName, code, attrName, variable); }
internal void GetInitCode(string variable, IHxlTemplateEmitter context, TextWriter tw) { EmitCode(context); }
protected virtual void EmitCode(IHxlTemplateEmitter emitter) { }