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:
parent
5f3be93193
commit
fe19554e28
1 changed files with 17 additions and 4 deletions
|
@ -367,7 +367,13 @@ namespace ScrewTurn.Wiki {
|
||||||
sb.Insert(match.Index, GenerateList(lines, 0, 0, ref d) + "\n");
|
sb.Insert(match.Index, GenerateList(lines, 0, 0, ref d) + "\n");
|
||||||
}
|
}
|
||||||
catch {
|
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);
|
ComputeNoWiki(sb.ToString(), ref noWikiBegin, ref noWikiEnd);
|
||||||
|
@ -511,9 +517,13 @@ namespace ScrewTurn.Wiki {
|
||||||
sb.Insert(match.Index, img.ToString());
|
sb.Insert(match.Index, img.ToString());
|
||||||
}
|
}
|
||||||
else {
|
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;
|
||||||
}
|
}
|
||||||
done = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(tmp.ToLowerInvariant().StartsWith("attachment:")) {
|
else if(tmp.ToLowerInvariant().StartsWith("attachment:")) {
|
||||||
|
@ -1732,6 +1742,7 @@ namespace ScrewTurn.Wiki {
|
||||||
}
|
}
|
||||||
else if(targetUrl.Contains(":") || targetUrl.ToLowerInvariant().Contains("%3a") || targetUrl.Contains("&") || targetUrl.Contains("%26")) {
|
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>");
|
sb.Append(@"<b style=""color: #FF0000;"">FORMATTER ERROR ("":"" and ""&"" not supported in Page Names)</b>");
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// The link points to a wiki page
|
// The link points to a wiki page
|
||||||
|
@ -2131,7 +2142,7 @@ namespace ScrewTurn.Wiki {
|
||||||
private static string BuildTable(string table) {
|
private static string BuildTable(string table) {
|
||||||
// Proceed line-by-line, ignoring the first and last one
|
// Proceed line-by-line, ignoring the first and last one
|
||||||
string[] lines = table.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
string[] lines = table.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
if(lines.Length < 3) {
|
if(lines.Length < 3) {
|
||||||
return "<b>FORMATTER ERROR (Malformed Table)</b>";
|
return "<b>FORMATTER ERROR (Malformed Table)</b>";
|
||||||
}
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
@ -2512,6 +2523,8 @@ namespace ScrewTurn.Wiki {
|
||||||
else {
|
else {
|
||||||
string formatterErrorString = @"<b style=""color: #FF0000;"">FORMATTER ERROR (Transcluded inexistent page or this same page)</b>";
|
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, formatterErrorString);
|
||||||
|
sb.Insert(match.Index, match);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue