Пример #1
0
        public void LinkToText(Entity entity, string originalText, IDictionary <string, string> attributes,
                               StringBuilder builder)
        {
            if (NoFollow)
            {
                attributes.Add("rel", "nofollow");
            }

            if (LinkAttributeModifier != null)
            {
                LinkAttributeModifier.Modify(entity, attributes);
            }

            string text = originalText;

            if (LinkTextModifier != null)
            {
                text = LinkTextModifier.Modify(entity, originalText);
            }

            builder.Append("<a");

            foreach (var entry in attributes)
            {
                builder.Append(" ").Append(EscapeHtml(entry.Key)).Append("=\"").
                Append(EscapeHtml(entry.Value)).Append("\"");
            }

            builder.Append(">").Append(text).Append("</a>");
        }
Пример #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="text"></param>
 /// <param name="attributes"></param>
 /// <param name="builder"></param>
 public void LinkToText(TweetEntity entity, string text, IDictionary <string, string> attributes, StringBuilder builder)
 {
     if (NoFollow)
     {
         attributes["rel"] = "nofollow";
     }
     if (LinkAttributeModifier != null)
     {
         LinkAttributeModifier.Modify(entity, attributes);
     }
     if (LinkTextModifier != null)
     {
         text = LinkTextModifier.Modify(entity, text);
     }
     // append <a> tag
     builder.Append("<a");
     foreach (var entry in attributes)
     {
         builder.Append(" ").Append(EscapeHTML(entry.Key)).Append("=\"").Append(EscapeHTML(entry.Value)).Append("\"");
     }
     builder.Append(">").Append(text).Append("</a>");
 }