コード例 #1
0
		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);
		}
コード例 #2
0
        public static void AssertElement(Element expected, Element actual)
        {
            AssertDocument(expected, actual);
            Assert.Equal(expected.TagName, actual.TagName);

            AssertElementParts(expected.Attributes, actual.Attributes);
        }
コード例 #3
0
 public virtual void AfterVisit(Element element)
 {
 }
コード例 #4
0
 public virtual bool BeforeVisit(Element element)
 {
     return false;
 }
コード例 #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)))));
 }
コード例 #6
0
 public override bool BeforeVisit(Element element)
 {
     EnterScope();
     _properties.Push(new List<IListEmitter<VProperty>>());
     return true;
 }
コード例 #7
0
		public bool BeforeVisit(Element element)
		{
			_scopes.Push(new Scope());
			return true;
		}