Changeset 18197 for lang/csharp

Show
Ignore:
Timestamp:
08/25/08 00:28:58 (3 months ago)
Author:
poolmmjp
Message:

fotolifeの画像のURLをimgタグに展開するようにした。

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/csharp/MMMMB/MMMMB/MiniBlogs/HatenaHaiku.cs

    r18079 r18197  
    6464                e.Permalink = new Uri(node.SelectSingleNode("link").InnerText); 
    6565                e.Name = node.SelectSingleNode("user/screen_name").InnerText; 
    66                 e.Content = node.SelectSingleNode("text").InnerText; 
     66                e.Content = Regex.Replace(node.SelectSingleNode("text").InnerText, @"(http://f\.hatena\.ne\.jp/[^ ]+?\.(?:jpg|gif|png))", new MatchEvaluator(delegate(Match m) 
     67                { 
     68                    string url = System.Web.HttpUtility.HtmlEncode(m.Groups[1].Value); 
     69                    return "<a href=\"" + url + "\"><img src=\"" + url + "\"></a>"; 
     70                })); 
    6771                e.Date = DateTime.Parse(node.SelectSingleNode("created_at").InnerText); 
    6872                e.Image = new Uri(node.SelectSingleNode("user/profile_image_url").InnerText);