コード例 #1
0
ファイル: Conversations.cs プロジェクト: mo5h/omeo
 private static void ToHtmlPhrase(string body, StringBuilder htmlBuilder)
 {
     htmlBuilder.Append("<td width=100% valign=top>");
     // convert all urls to active weblinks
     htmlBuilder.Append(HtmlTools.ConvertLinks(body.Replace("\n", "<br>")));
     htmlBuilder.Append("</td>");
 }
コード例 #2
0
 [Test] public void TestConvertLinks()
 {
     Assert.AreEqual("WWW).", HtmlTools.ConvertLinks("WWW)."));
     Assert.AreEqual("WWW сервере", HtmlTools.ConvertLinks("WWW сервере"));
     Assert.AreEqual("RSDN@home", HtmlTools.ConvertLinks("RSDN@home"));
     Assert.AreEqual("<a href=\"news:[email protected]\">news:[email protected]</a>...", HtmlTools.ConvertLinks("news:[email protected]..."));
     Assert.AreEqual("<a href=\"http://jetbrains.com\">http://jetbrains.com</a>.", HtmlTools.ConvertLinks("http://jetbrains.com."));
     Assert.AreEqual("<a href=\"http://www.jetbrains.com\">www.jetbrains.com</a>.", HtmlTools.ConvertLinks("www.jetbrains.com."));
     Assert.AreEqual("<a href=\"http://www.jetbrains.com\">www.jetbrains.com</a>. ", HtmlTools.ConvertLinks("www.jetbrains.com. "));
     Assert.AreEqual("<a href=\"http://www.jetbrains.com/\">www.jetbrains.com/</a>", HtmlTools.ConvertLinks("www.jetbrains.com/"));
     Assert.AreEqual("<a href=\"http://www.jetbrains.com/\">http://www.jetbrains.com/</a>", HtmlTools.ConvertLinks("http://www.jetbrains.com/"));
     Assert.AreEqual("<a href=\"http://www.jetbrains.com\">www.jetbrains.com</a>&nbsp;a", HtmlTools.ConvertLinks("www.jetbrains.com&nbsp;a"));
     Assert.AreEqual("<a href=\"news://news.intellij.net:119/[email protected]\">news://news.intellij.net:119/[email protected]</a>", HtmlTools.ConvertLinks("news://news.intellij.net:119/[email protected]"));
 }