public void AfterVisit(Element element) { var scope = _scopes.Pop(); Action<TextWriter, IDataContext, IRenderingContext> exp = (writer, dataContext, renderingContext) => { writer.Write($"<{element.TagName}"); foreach (var attribute in scope.Attributes) { writer.Write(" "); attribute.Item1(writer, dataContext, renderingContext); writer.Write("=\""); attribute.Item2(writer, dataContext, renderingContext); writer.Write("\""); } writer.Write(">"); foreach (var action in scope.Elements) { action(writer, dataContext, renderingContext); } writer.Write($"</{element.TagName}>"); }; var parentScope = _scopes.Peek(); parentScope.Elements.Add(exp); }
public static void AssertElement(Element expected, Element actual) { AssertDocument(expected, actual); Assert.Equal(expected.TagName, actual.TagName); AssertElementParts(expected.Attributes, actual.Attributes); }
public virtual void AfterVisit(Element element) { }
public virtual bool BeforeVisit(Element element) { return false; }
public override void AfterVisit(Element element) { var emitter = EmitterNode.Many(LeaveScope()); var attributeEmitter = EmitterNode.Many(_properties.Pop()); Scope.Add(EmitterNode.AsList(EmitterNode.Lambda((d, r) => new VElement(element.TagName, attributeEmitter.Execute(d, r), emitter.Execute(d, r))))); }
public override bool BeforeVisit(Element element) { EnterScope(); _properties.Push(new List<IListEmitter<VProperty>>()); return true; }
public bool BeforeVisit(Element element) { _scopes.Push(new Scope()); return true; }