当前位置: 首页>>代码示例>>C#>>正文


C# HtmlTag.Add方法代码示例

本文整理汇总了C#中HtmlTag.Add方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlTag.Add方法的具体用法?C# HtmlTag.Add怎么用?C# HtmlTag.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HtmlTag的用法示例。


在下文中一共展示了HtmlTag.Add方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HtmlDocument

 public HtmlDocument()
 {
     RootTag = new HtmlTag("html");
     DocType = "<!DOCTYPE html>";
     Head = RootTag.Add("head");
     _title = Head.Add("title");
     Body = RootTag.Add("body");
     Last = Body;
 }
开发者ID:storyteller,项目名称:Storyteller,代码行数:9,代码来源:HtmlDocument.cs

示例2: Transform

        public string Transform(Topic current, string data)
        {
            var ol = new HtmlTag("ol").AddClass("breadcrumb");

            current.Ancestors().Each(x =>
            {
                ol.Add("li/a").Attr("href", _resolver.ToUrl(current, x)).Text(x.Title);
            });

            ol.Add("li").AddClass("active").Text(current.Title);

            return ol.ToString();
        }
开发者ID:storyteller,项目名称:Storyteller,代码行数:13,代码来源:ParentBreadcrumbsTransformHandler.cs

示例3: add_returns_the_newly_created_child_tag

 public void add_returns_the_newly_created_child_tag()
 {
     var original = new HtmlTag("div");
     var child = original.Add("span");
     child.ToString().ShouldEqual("<span></span>");
     original.ToString().ShouldEqual("<div><span></span></div>");
 }
开发者ID:ryansroberts,项目名称:htmltags,代码行数:7,代码来源:HtmlTagTester.cs

示例4: add_and_return_a_child_tag_by_type

 public void add_and_return_a_child_tag_by_type()
 {
     var original = new HtmlTag("div");
     var child = original.Add<HiddenTag>();
     child.ToString().ShouldEqual("<input type=\"hidden\" />");
     original.ToString().ShouldEqual("<div><input type=\"hidden\" /></div>");
 }
开发者ID:ryansroberts,项目名称:htmltags,代码行数:7,代码来源:HtmlTagTester.cs

示例5: parent_property_is_set_correctly_using_add

 public void parent_property_is_set_correctly_using_add()
 {
     var tag = new HtmlTag("div");
     var child = tag.Add("span");
     tag.ShouldEqual(child.Parent);
     tag.Children[0].ShouldEqual(child);
 }
开发者ID:calebjenkins,项目名称:htmltags,代码行数:7,代码来源:ParentTagTester.cs

示例6: add_multiple_levels_of_nesting

        public void add_multiple_levels_of_nesting()
        {
            var tag = new HtmlTag("table");
            tag.Add("tbody/tr/td").Text("some text");

            tag.ToString()
                .ShouldEqual("<table><tbody><tr><td>some text</td></tr></tbody></table>");
        }
开发者ID:ryansroberts,项目名称:htmltags,代码行数:8,代码来源:HtmlTagTester.cs

示例7: insert_before

        public void insert_before()
        {
            var tag = new HtmlTag("div");
            tag.Add("span");
            tag.InsertFirst(new HtmlTag("p"));

            tag.ToString().ShouldEqual("<div><p></p><span></span></div>");
        }
开发者ID:joshuaflanagan,项目名称:fubumvc,代码行数:8,代码来源:HtmlTagTester.cs

示例8: Transform

        public string Transform(Topic current, string data)
        {
            var props = data.Split(';');
            var key = props.First();

            

            try
            {
                var other = findOther(current, key);
                if (other == null) return string.Empty;

                return transformFromTopic(current, other, props);
            }
            catch (ArgumentOutOfRangeException)
            {
                var tag = new HtmlTag("p").AddClass("bg-warning").Style("padding", "5px");
                tag.Add("b").Text($"Unknown topic key '{key}'");
                tag.Add("small").Text(" -- CTRL+SHIFT+R to force refresh the topic tree");
                return tag.ToString();
            }
        }
开发者ID:storyteller,项目名称:Storyteller,代码行数:22,代码来源:LinkToTransformHandler.cs

示例9: writeChildNodes

        private void writeChildNodes(Topic root, Topic parent, HtmlTag tag, IUrlResolver resolver)
        {
            parent.Children.Each(childTopic =>
            {
                var li = tag.Add("li");

                li.Add("a").Attr("href", resolver.ToUrl(root, childTopic)).Text(childTopic.Title);

                if (childTopic.Children.Any())
                {
                    var ul = li.Add("ul");
                    writeChildNodes(root, childTopic, ul, resolver);
                }
            });
        }
开发者ID:storyteller,项目名称:Storyteller,代码行数:15,代码来源:TableOfContentsTag.cs

示例10: nesting_also_supports_jquery_direct_child_syntax

        public void nesting_also_supports_jquery_direct_child_syntax()
        {
            var tag = new HtmlTag("table");
            tag.Add("tbody > tr > td").Text("some text");

            tag.ToString()
                .ShouldEqual("<table><tbody><tr><td>some text</td></tr></tbody></table>");
        }
开发者ID:ryansroberts,项目名称:htmltags,代码行数:8,代码来源:HtmlTagTester.cs

示例11: does_not_return_children_or_siblings_when_treated_as_a_tag_source

 public void does_not_return_children_or_siblings_when_treated_as_a_tag_source()
 {
     var original = new HtmlTag("div");
     original.Add("span");
     original.After(new HtmlTag("p"));
     var tagSource = (ITagSource) original;
     var allTags = tagSource.AllTags().ToArray();
     allTags.ShouldHaveCount(1);
     allTags[0].ShouldBeTheSameAs(original);
 }
开发者ID:ryansroberts,项目名称:htmltags,代码行数:10,代码来源:HtmlTagTester.cs

示例12: I_just_want_to_generate_a_div_with_text_and_a_class

 public void I_just_want_to_generate_a_div_with_text_and_a_class()
 {
     HtmlTag tag = new HtmlTag("div").Text("my text").AddClass("collapsible");
     tag.Add("span").Text("inner");
     Debug.WriteLine(tag.ToString());
 }
开发者ID:joshuaflanagan,项目名称:fubumvc,代码行数:6,代码来源:HtmlTagTester.cs

示例13: render_html_from_top_if_set_renderfromtop

 public void render_html_from_top_if_set_renderfromtop()
 {
     var tag = new HtmlTag("div");
     var child = tag.Add("span").RenderFromTop().Text("hi");
     child.ToString().ShouldEqual("<div><span>hi</span></div>");
 }
开发者ID:calebjenkins,项目名称:htmltags,代码行数:6,代码来源:ParentTagTester.cs

示例14: render_html_from_current_tag_by_default

 public void render_html_from_current_tag_by_default()
 {
     var tag = new HtmlTag("div");
     var child = tag.Add("span").Text("hi");
     child.ToString().ShouldEqual("<span>hi</span>");
 }
开发者ID:calebjenkins,项目名称:htmltags,代码行数:6,代码来源:ParentTagTester.cs


注:本文中的HtmlTag.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。