Backed out changeset: f5712ba85504

This commit is contained in:
Matteo Tomasini 2011-04-04 14:55:24 +02:00
parent 51f08e6492
commit c732a7a909

View file

@ -1662,10 +1662,10 @@ namespace ScrewTurn.Wiki {
sb.Append(@""" title="""); sb.Append(@""" title=""");
if(!isImage && title.Length > 0) sb.Append(nstripped); if(!isImage && title.Length > 0) sb.Append(nstripped);
else if(isImage && imageTitle.Length > 0) sb.Append(imageTitleStripped); else if(isImage && imageTitle.Length > 0) sb.Append(imageTitleStripped);
else sb.Append(NoWikiUrl(targetUrl.Substring(1))); else sb.Append(targetUrl.Substring(1));
sb.Append(@""">"); sb.Append(@""">");
if(title.Length > 0) sb.Append(title); if(title.Length > 0) sb.Append(title);
else sb.Append(NoWikiUrl(targetUrl.Substring(1))); else sb.Append(targetUrl.Substring(1));
sb.Append("</a>"); sb.Append("</a>");
} }
else if(targetUrl.StartsWith("http://") || targetUrl.StartsWith("https://") || targetUrl.StartsWith("ftp://") || targetUrl.StartsWith("file://")) { else if(targetUrl.StartsWith("http://") || targetUrl.StartsWith("https://") || targetUrl.StartsWith("ftp://") || targetUrl.StartsWith("file://")) {
@ -1673,14 +1673,14 @@ namespace ScrewTurn.Wiki {
sb.Append(@"<a"); sb.Append(@"<a");
if(!isImage) sb.Append(@" class=""externallink"""); if(!isImage) sb.Append(@" class=""externallink""");
sb.Append(@" href="""); sb.Append(@" href=""");
sb.Append(NoWikiUrl(targetUrl)); sb.Append(targetUrl);
sb.Append(@""" title="""); sb.Append(@""" title=""");
if(!isImage && title.Length > 0) sb.Append(nstripped); if(!isImage && title.Length > 0) sb.Append(nstripped);
else if(isImage && imageTitle.Length > 0) sb.Append(imageTitleStripped); else if(isImage && imageTitle.Length > 0) sb.Append(imageTitleStripped);
else sb.Append(NoWikiUrl(targetUrl)); else sb.Append(targetUrl);
sb.Append(@""" target=""_blank"">"); sb.Append(@""" target=""_blank"">");
if(title.Length > 0) sb.Append(title); if(title.Length > 0) sb.Append(title);
else sb.Append(NoWikiUrl(targetUrl)); else sb.Append(targetUrl);
sb.Append("</a>"); sb.Append("</a>");
} }
else if(targetUrl.StartsWith(@"\\") || targetUrl.StartsWith("//")) { else if(targetUrl.StartsWith(@"\\") || targetUrl.StartsWith("//")) {
@ -1688,14 +1688,14 @@ namespace ScrewTurn.Wiki {
sb.Append(@"<a"); sb.Append(@"<a");
if(!isImage) sb.Append(@" class=""externallink"""); if(!isImage) sb.Append(@" class=""externallink""");
sb.Append(@" href=""file://///"); sb.Append(@" href=""file://///");
sb.Append(NoWikiUrl(targetUrl.Substring(2))); sb.Append(targetUrl.Substring(2));
sb.Append(@""" title="""); sb.Append(@""" title=""");
if(!isImage && title.Length > 0) sb.Append(nstripped); if(!isImage && title.Length > 0) sb.Append(nstripped);
else if(isImage && imageTitle.Length > 0) sb.Append(imageTitleStripped); else if(isImage && imageTitle.Length > 0) sb.Append(imageTitleStripped);
else sb.Append(NoWikiUrl(targetUrl)); else sb.Append(targetUrl);
sb.Append(@""" target=""_blank"">"); sb.Append(@""" target=""_blank"">");
if(title.Length > 0) sb.Append(title); if(title.Length > 0) sb.Append(title);
else sb.Append(NoWikiUrl(targetUrl)); else sb.Append(targetUrl);
sb.Append("</a>"); sb.Append("</a>");
} }
else if(targetUrl.IndexOf("@") != -1 && targetUrl.IndexOf(".") != -1) { else if(targetUrl.IndexOf("@") != -1 && targetUrl.IndexOf(".") != -1) {
@ -1876,11 +1876,6 @@ namespace ScrewTurn.Wiki {
return sb.ToString(); return sb.ToString();
} }
// Wrap url in <nowiki> tags to prevent formatter to erroneously modify it.
private static string NoWikiUrl(string url) {
return "<nowiki>" + url + "</nowiki>";
}
/// <summary> /// <summary>
/// Detects all the Headers in a block of text (H1, H2, H3, H4). /// Detects all the Headers in a block of text (H1, H2, H3, H4).
/// </summary> /// </summary>