Changed errors management in formatting when switching to visual editor, if there is an error in wiki markup do not lose data. [completed: 399]

This commit is contained in:
Cristian Trapattoni 2011-03-11 18:10:35 +01:00
parent 5f3be93193
commit fe19554e28

View file

@ -367,7 +367,13 @@ namespace ScrewTurn.Wiki {
sb.Insert(match.Index, GenerateList(lines, 0, 0, ref d) + "\n");
}
catch {
sb.Insert(match.Index, @"<b style=""color: #FF0000;"">FORMATTER ERROR (Malformed List)</b>");
if(!bareBones) {
sb.Insert(match.Index, @"<b style=""color: #FF0000;"">FORMATTER ERROR (Malformed List)</b><br />");
}
else {
sb.Insert(match.Index, match);
end = match.Index + match.Length;
}
}
}
ComputeNoWiki(sb.ToString(), ref noWikiBegin, ref noWikiEnd);
@ -511,11 +517,15 @@ namespace ScrewTurn.Wiki {
sb.Insert(match.Index, img.ToString());
}
else {
sb.Insert(match.Index, @"<b style=""color: #FF0000;"">FORMATTER ERROR (Malformed Image Tag)</b>");
if(!bareBones) sb.Insert(match.Index, @"<b style=""color: #FF0000;"">FORMATTER ERROR (Malformed Image Tag)</b>");
else {
sb.Insert(match.Index, match);
end = match.Index + match.Length;
}
done = true;
}
}
}
else if(tmp.ToLowerInvariant().StartsWith("attachment:")) {
// This is an attachment
done = true;
@ -1732,6 +1742,7 @@ namespace ScrewTurn.Wiki {
}
else if(targetUrl.Contains(":") || targetUrl.ToLowerInvariant().Contains("%3a") || targetUrl.Contains("&") || targetUrl.Contains("%26")) {
sb.Append(@"<b style=""color: #FF0000;"">FORMATTER ERROR ("":"" and ""&"" not supported in Page Names)</b>");
}
else {
// The link points to a wiki page
@ -2512,6 +2523,8 @@ namespace ScrewTurn.Wiki {
else {
string formatterErrorString = @"<b style=""color: #FF0000;"">FORMATTER ERROR (Transcluded inexistent page or this same page)</b>";
sb.Insert(match.Index, formatterErrorString);
sb.Insert(match.Index, match);
}