Exemple #1
0
        public void ToStringFormatsEscapedHtmlTag()
        {
            var tag      = new OpenGraphTag(new OpenGraphName(new OpenGraphNamespace("<ns>", "http://ns/"), "<key>"), "<val\"ue>");
            var expected = "<meta property=\"&lt;ns&gt;:&lt;key&gt;\" content=\"&lt;val&quot;ue&gt;\" />";

            Assert.AreEqual(expected, tag.ToString());
        }
Exemple #2
0
        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());
        }