private static HtmlControl GenerateElement(string part, string name) { HtmlControl element = null; if (!_shortcuts.IsMatch(name)) { element = CreateElementWithAttributes(part, name); } else { element = ShortcutHelper.Parse(part); } return(element); }
public static Control CreateDoctypes(string part, ref IEnumerable <Control> current) { if (part == null) { return(null); } using (ContentPlaceHolder root = new ContentPlaceHolder()) { string second = part.Substring(part.IndexOf(':') + 1); root.Controls.Add(new LiteralControl(GetDoctype(second))); using (HtmlControl html = HtmlElementFactory.Create("html")) { if (!second.StartsWith("x", StringComparison.Ordinal)) { html.Attributes["lang"] = "en"; } else { html.Attributes["xmlns"] = "http://www.w3.org/1999/xhtml"; html.Attributes["xml:lang"] = "en"; } root.Controls.Add(html); using (HtmlControl head = HtmlElementFactory.Create("head")) using (HtmlControl title = HtmlElementFactory.Create("title")) using (HtmlControl meta = ShortcutHelper.Parse("meta:utf")) { head.Controls.Add(title); head.Controls.Add(meta); html.Controls.Add(head); } using (HtmlControl body = HtmlElementFactory.Create("body")) { html.Controls.Add(body); current = new Control[] { body }; } return(root); } } }