示例#1
0
 private static WireframeGenerator BufferH(
     WireframeGenerator gen,
     int level,
     int wordCount         = 2,
     object htmlAttributes = null) => gen.Add(
     WireframeGenerator.GenerateHtmlIpsum($"h{level}", () => Lorem.GenerateWords(wordCount), htmlAttributes)
     );
示例#2
0
        public static WireframeGenerator Table(this WireframeGenerator gen, int rows = 5, object tableAttributes = null)
        {
            A.Configure <IpsumTableModel>()
            .Fill(cfg => cfg.Lorem).AsLoremIpsumWords(2)
            .Fill(cfg => cfg.Ipsum).AsLoremIpsumWords(3)
            .Fill(cfg => cfg.Aliquam).AsLoremIpsumWords(1);
            IList <IpsumTableModel> data = A.ListOf <IpsumTableModel>(rows);

            return(gen.Add(CreateTableHtmlIpsum(data, tableAttributes)));
        }
示例#3
0
        public static WireframeGenerator Image(this WireframeGenerator gen,
                                               int width,
                                               int height,
                                               string text            = null,
                                               string backgroundColor = null,
                                               string textColor       = null,
                                               object htmlAttributes  = null,
                                               ImgFormat format       = ImgFormat.GIF)
        {
            var img = new TagBuilder("img");

            img.TagRenderMode = TagRenderMode.SelfClosing;
            img.Attributes.Add("src", PlaceholditUrlBuilder.UrlFor(width, height, text, backgroundColor, textColor));
            img.MergeAttributes(HtmlAttributeHelper.GetHtmlAttributeDictionaryOrNull(htmlAttributes));
            return(gen.Add(img));
        }
示例#4
0
        private static IHtmlContent GenerateListHtmlIpsum(string outer, string inner, int listCount, bool links, object liAttributes, int wordCount, object ulAttributes)
        {
            TagBuilder element = new TagBuilder(outer);

            for (int i = 0; i < listCount; i++)
            {
                if (links)
                {
                    TagBuilder li = new TagBuilder(inner);
                    li.MergeAttributes(HtmlAttributeHelper.GetHtmlAttributeDictionaryOrNull(liAttributes));
                    li.InnerHtml.SetHtmlContent(WireframeGenerator.GenerateHtmlIpsum("a", () => Lorem.GenerateWords(wordCount), HtmlAttributeHelper.GetHtmlAttributeDictionaryOrNull(new { href = "#" })));
                    element.InnerHtml.AppendHtml(li);
                }
                else
                {
                    element.InnerHtml.AppendHtml(WireframeGenerator.GenerateHtmlIpsum(inner, () => Lorem.GenerateWords(wordCount), liAttributes));
                }
            }
            element.MergeAttributes(HtmlAttributeHelper.GetHtmlAttributeDictionaryOrNull(ulAttributes));

            return(element);
        }
示例#5
0
 /// <summary>
 /// Gets a dl element containing lorem ipsum
 /// </summary>
 /// <example>To create a unordered list of Lorem Ipusm nested in HTML 'dl' tags.<code>@Html.dl()</code></example>
 /// <param name="listCount">Number of list items to create</param>
 /// <param name="wordCount">Number of words to create</param>
 /// <param name="links">List item will contain a link, ex: href="#"</param>
 /// <param name="dlAttributes">dl element attributes</param>
 /// <param name="ddAttributes">dd element attributes</param>
 /// <returns></returns>
 public static WireframeGenerator Dl(this WireframeGenerator gen, int listCount = 5, int wordCount = 2, bool links = false, object dlAttributes = null, object ddAttributes = null) =>
 gen.Add(GenerateListHtmlIpsum("dl", "dd", listCount, links, ddAttributes, wordCount, dlAttributes));
示例#6
0
 /// <summary>
 /// Gets a ol element containing lorem ipsum
 /// </summary>
 /// <example>To create a unordered list of Lorem Ipusm nested in HTML 'ol' tags.<code>@Html.ol()</code></example>
 /// <param name="listCount">Number of list items to create</param>
 /// <param name="wordCount">Number of words to create</param>
 /// <param name="links">List item will contain a link, ex: href="#"</param>
 /// <param name="olAttributes">ol element attributes</param>
 /// <param name="liAttributes">li element attributes</param>
 /// <returns></returns>
 public static WireframeGenerator Ol(this WireframeGenerator gen, int listCount = 5, int wordCount = 2, bool links = false, object olAttributes = null, object liAttributes = null) =>
 gen.Add(GenerateListHtmlIpsum("ol", "li", listCount, links, liAttributes, wordCount, olAttributes));
示例#7
0
 /// <summary>
 /// Gets an h5 element containing lorem ipsum
 /// </summary>
 /// <example>To create an HTML h5 tag containing Lorem Ipsum.
 /// <code>@Html.h5()</code>
 /// </example>
 /// <example>To create an HTML h5 tag containing three Lorem Ipsum words and with attributes.
 /// <code>@Html.h5(3, new { @class = "my-css-class"})</code>
 /// </example>
 /// <param name="wordCount">Number of words to create</param>
 /// <param name="htmlAttributes">Html attributes</param>
 /// <returns></returns>
 public static WireframeGenerator H5(
     this WireframeGenerator gen,
     int wordCount         = 2,
     object htmlAttributes = null) => BufferH(gen, 5, wordCount, htmlAttributes);
示例#8
0
 public static WireframeGenerator Table <T>(
     this WireframeGenerator gen,
     int rows = 5, object tableAttributes = null) where T : new() =>
 gen.Add(CreateTableHtmlIpsum(A.ListOf <T>(rows), tableAttributes));