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);
		}
Exemplo n.º 2
0
        public static void AssertElement(Element expected, Element actual)
        {
            AssertDocument(expected, actual);
            Assert.Equal(expected.TagName, actual.TagName);

            AssertElementParts(expected.Attributes, actual.Attributes);
        }
Exemplo n.º 3
0
 public virtual void AfterVisit(Element element)
 {
 }
Exemplo n.º 4
0
 public virtual bool BeforeVisit(Element element)
 {
     return false;
 }
Exemplo n.º 5
0
 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)))));
 }
Exemplo n.º 6
0
 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;
		}