public void ToStringFormatsEscapedHtmlTag() { var tag = new OpenGraphTag(new OpenGraphName(new OpenGraphNamespace("<ns>", "http://ns/"), "<key>"), "<val\"ue>"); var expected = "<meta property=\"<ns>:<key>\" content=\"<val"ue>\" />"; Assert.AreEqual(expected, tag.ToString()); }
public void ToStringFormatsHtmlTag() { var tag = new OpenGraphTag(new OpenGraphName(new OpenGraphNamespace("ns", "http://ns/"), "key"), "value"); var expected = "<meta property=\"ns:key\" content=\"value\" />"; Assert.AreEqual(expected, tag.ToString()); }
protected System.Web.UI.Control GenerateOpenGraphTag(OpenGraphTag openGraphTag, string content) { StringBuilder sb = new StringBuilder(); string tag = openGraphTag.ToString("g").ToLower(); if (tag.Contains("__")) { tag = tag.Replace("__", ":").ToLower(); } else { tag = "og:" + tag; } sb.AppendFormat("<meta property=\"{0}\" content=\"{1}\" />", tag, content); sb.AppendLine(); return(new System.Web.UI.LiteralControl(sb.ToString())); }
protected System.Web.UI.Control GenerateOpenGraphTag(OpenGraphTag openGraphTag, string content) { StringBuilder sb = new StringBuilder(); string tag = openGraphTag.ToString("g").ToLower(); if (tag.Contains("__")) tag = tag.Replace("__", ":").ToLower(); else tag = "og:" + tag; sb.AppendFormat("<meta property=\"{0}\" content=\"{1}\" />", tag, content); sb.AppendLine(); return new System.Web.UI.LiteralControl(sb.ToString()); }