コード例 #1
0
        /// <summary>
        /// Instantiates a new instance of a <see cref="TagHelperBlock"/>.
        /// </summary>
        /// <param name="source">A <see cref="TagHelperBlockBuilder"/> used to construct a valid
        /// <see cref="TagHelperBlock"/>.</param>
        public TagHelperBlock(TagHelperBlockBuilder source)
            : base(source.Type, source.Children, source.ChunkGenerator)
        {
            TagName        = source.TagName;
            Descriptors    = source.Descriptors;
            Attributes     = new List <KeyValuePair <string, SyntaxTreeNode> >(source.Attributes);
            _start         = source.Start;
            TagMode        = source.TagMode;
            SourceStartTag = source.SourceStartTag;
            SourceEndTag   = source.SourceEndTag;

            source.Reset();

            foreach (var attributeChildren in Attributes)
            {
                if (attributeChildren.Value != null)
                {
                    attributeChildren.Value.Parent = this;
                }
            }
        }
コード例 #2
0
ファイル: BlockFactory.cs プロジェクト: cjqian/Razor
        public Block TagHelperBlock(
            string tagName,
            TagMode tagMode,
            SourceLocation start,
            Block startTag,
            SyntaxTreeNode[] children,
            Block endTag)
        {
            var builder = new TagHelperBlockBuilder(
                tagName,
                tagMode,
                attributes: new List<TagHelperAttributeNode>(),
                children: children)
            {
                Start = start,
                SourceStartTag = startTag,
                SourceEndTag = endTag
            };

            return builder.Build();
        }