本文整理汇总了C#中INodeVisitor.Accept方法的典型用法代码示例。如果您正苦于以下问题:C# INodeVisitor.Accept方法的具体用法?C# INodeVisitor.Accept怎么用?C# INodeVisitor.Accept使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类INodeVisitor
的用法示例。
在下文中一共展示了INodeVisitor.Accept方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitNode
public void VisitNode(INodeVisitor visitor, IList<Node> body, IList<Chunk> chunks)
{
Transform(Node, body);
visitor.Accept(Node);
visitor.Accept(body);
if (!Node.IsEmptyElement)
{
visitor.Accept(new EndElementNode(Node.Name));
}
}
示例2: VisitNode
public void VisitNode(INodeVisitor visitor, IList<Node> body, IList<Chunk> chunks)
{
visitor.Accept(body);
var sectionVisitor = new ViewComponentSectionChunkBuilderVisitor();
sectionVisitor.Accept(body);
sections = sectionVisitor.Sections;
attributes = sectionVisitor.Attributes;
}
示例3: VisitNode
public void VisitNode(INodeVisitor visitor, IList<Node> body, IList<Chunk> chunks)
{
if (visitor is ChunkBuilderVisitor)
{
var newNodes = new List<Node>();
Utilities.AddApplyPathModifier(_mNode.Attributes,"href");
newNodes.Add(_mNode);
if (!_mNode.IsEmptyElement)
{
newNodes.AddRange(body);
newNodes.Add(new EndElementNode(_mNode.Name));
}
// visit the new nodes normally
visitor.Accept(newNodes);
// keep the output chunks to render later
_mChunks = chunks;
}
}
示例4: VisitNode
public void VisitNode(INodeVisitor visitor, IList<Node> body, IList<Chunk> chunks)
{
if (visitor is ChunkBuilderVisitor)
{
var newNodes = new List<Node>();
var classNode = _mNode.Attributes.SingleOrDefault(x => x.Name == "class") ??
new AttributeNode("class", "");
var newclassNode = Utilities.AddMethodCallingToAttributeValue(classNode, Constants.ADDBROWSERDETAILS);
_mNode.Attributes.Remove(classNode);
_mNode.Attributes.Add(newclassNode);
newNodes.Add(_mNode);
newNodes.AddRange(body);
newNodes.Add(new EndElementNode(_mNode.Name));
// visit the new nodes normally
visitor.Accept(newNodes);
// keep the output chunks to render later
_mChunks = chunks;
}
}
示例5: VisitNode
public void VisitNode(INodeVisitor visitor, IList<Node> body, IList<Chunk> chunks)
{
var registerTarget = string.Format(
@"RegisterTarget(""{0}"", ""{1}"", ""{2}"", __target_{3});",
_idAttribute.Value,
_classAttribute != null ? _classAttribute.Value : "",
_descriptionAttribute != null ? _descriptionAttribute.Value : "",
_targetExtensionCount);
if (_targetAttribute != null)
{
registerTarget +=
Environment.NewLine +
string.Format(
@"RegisterTarget(""{0}"", ""{1}"", null, null);",
_targetAttribute.Value,
_idAttribute.Value);
}
var beginLambda = string.Format(
@"__target_{0} = () => {{",
_targetExtensionCount);
const string endLambda = "};";
var startingTarget = string.Format(
@"StartingTarget(""{0}"");",
_idAttribute.Value);
var nameAttribute = new AttributeNode("name", _idAttribute.QuotChar, _idAttribute.Nodes) { OriginalNode = _idAttribute };
var macroAttributes = _targetElement.Attributes
.Where(x => x != _idAttribute && x != _classAttribute && x != _descriptionAttribute)
.Concat(new[] { nameAttribute })
.ToList();
var macroElement = new SpecialNode(new ElementNode("macro", macroAttributes, false));
var onceAttribute = new AttributeNode("once", _idAttribute.QuotChar, _idAttribute.Nodes);
var testElement = new SpecialNode(new ElementNode("test", new[] { onceAttribute }, false));
macroElement.Body.Add(testElement);
testElement.Body = body;
testElement.Body.Insert(0, new StatementNode(startingTarget));
visitor.Accept(new StatementNode(beginLambda));
visitor.Accept(testElement);
visitor.Accept(new StatementNode(endLambda));
visitor.Accept(new StatementNode(registerTarget));
}
示例6: VisitNode
public void VisitNode(INodeVisitor visitor, IList<Node> body, IList<Chunk> chunks)
{
if (visitor is ChunkBuilderVisitor)
{
var sectionVisitor = new ViewComponentVisitor((ChunkBuilderVisitor)visitor, info);
sectionVisitor.Accept(body);
sectionsChunks = sectionVisitor.Sections;
sectionsAttributes = sectionVisitor.Attributes;
}
else
{
visitor.Accept(body);
}
}
示例7: VisitNode
public void VisitNode(INodeVisitor visitor, IList<Node> body, IList<Chunk> chunks)
{
if (visitor is ChunkBuilderVisitor)
{
var newNodes = new List<Node>();
Utilities.AddApplyPathModifier(_mNode.Attributes, "action");
HttpMethodOverride(body);
if (validate)
{
var idNode = _mNode.Attributes.SingleOrDefault(x => x.Name == "id");
var id = (idNode != null) ? idNode.Value : GenerateFormId();
_mNode.Attributes.Remove(_mNode.Attributes.FirstOrDefault(x => x.Name == Constants.VALIDATE_ATTRIBUTE));
newNodes.Add(_mNode);
var code = String.Format(Constants.HTML_GETCLIENTVALIDATIONJSON, id, outputStyle, modelName);
//For MVC we have to create MvcForm first
if (outputStyle.Equals(OutputStyle.MVC))
{
var codeForMvc = String.Format(Constants.CREATEMVCFORM, id);
newNodes.Add(new StatementNode(codeForMvc));
}
newNodes.AddRange(body);
newNodes.Add(new StatementNode(code));
}
else
{
newNodes.Add(_mNode);
newNodes.AddRange(body);
}
newNodes.Add(new EndElementNode(_mNode.Name));
// visit the new nodes normally
visitor.Accept(newNodes);
// keep the output chunks to render later
_mChunks = chunks;
}
}
示例8: VisitNode
public void VisitNode(INodeVisitor visitor, IList<Node> body, IList<Chunk> chunks)
{
visitor.Accept(body);
}