Tentatively fixed #383 and #386: semicolons and ">>>" sequences are correctly escaped inside @@...@@ tags.
This commit is contained in:
parent
bc3a5fa51f
commit
0edaac7132
2 changed files with 36 additions and 35 deletions
|
@ -16,5 +16,5 @@ using System.Reflection;
|
||||||
//
|
//
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
[assembly: AssemblyVersion("3.0.1.416")]
|
[assembly: AssemblyVersion("3.0.1.417")]
|
||||||
[assembly: AssemblyFileVersion("3.0.1.416")]
|
[assembly: AssemblyFileVersion("3.0.1.417")]
|
||||||
|
|
|
@ -157,6 +157,23 @@ namespace ScrewTurn.Wiki {
|
||||||
|
|
||||||
ComputeNoWiki(sb.ToString(), ref noWikiBegin, ref noWikiEnd);
|
ComputeNoWiki(sb.ToString(), ref noWikiBegin, ref noWikiEnd);
|
||||||
|
|
||||||
|
// Before Producing HTML
|
||||||
|
match = FullCodeRegex.Match(sb.ToString());
|
||||||
|
while(match.Success) {
|
||||||
|
if(!IsNoWikied(match.Index, noWikiBegin, noWikiEnd, out end)) {
|
||||||
|
sb.Remove(match.Index, match.Length);
|
||||||
|
string content = match.Value.Substring(2, match.Length - 4);
|
||||||
|
dummy = new StringBuilder();
|
||||||
|
dummy.Append("<nobr><pre>");
|
||||||
|
// IE needs \r\n for line breaks
|
||||||
|
dummy.Append(EscapeWikiMarkup(content).Replace("\n", "\r\n"));
|
||||||
|
dummy.Append("</pre></nobr>");
|
||||||
|
sb.Insert(match.Index, dummy.ToString());
|
||||||
|
}
|
||||||
|
ComputeNoWiki(sb.ToString(), ref noWikiBegin, ref noWikiEnd);
|
||||||
|
match = FullCodeRegex.Match(sb.ToString(), end);
|
||||||
|
}
|
||||||
|
|
||||||
if(current != null) {
|
if(current != null) {
|
||||||
// Check redirection
|
// Check redirection
|
||||||
match = RedirectionRegex.Match(sb.ToString());
|
match = RedirectionRegex.Match(sb.ToString());
|
||||||
|
@ -177,23 +194,6 @@ namespace ScrewTurn.Wiki {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Before Producing HTML
|
|
||||||
match = FullCodeRegex.Match(sb.ToString());
|
|
||||||
while(match.Success) {
|
|
||||||
if(!IsNoWikied(match.Index, noWikiBegin, noWikiEnd, out end)) {
|
|
||||||
sb.Remove(match.Index, match.Length);
|
|
||||||
string content = match.Value.Substring(2, match.Length - 4);
|
|
||||||
dummy = new StringBuilder();
|
|
||||||
dummy.Append("<nobr><pre>");
|
|
||||||
// IE needs \r\n for line breaks
|
|
||||||
dummy.Append(EscapeWikiMarkup(content).Replace("\n", "\r\n"));
|
|
||||||
dummy.Append("</pre></nobr>");
|
|
||||||
sb.Insert(match.Index, dummy.ToString());
|
|
||||||
}
|
|
||||||
ComputeNoWiki(sb.ToString(), ref noWikiBegin, ref noWikiEnd);
|
|
||||||
match = FullCodeRegex.Match(sb.ToString(), end);
|
|
||||||
}
|
|
||||||
|
|
||||||
// No more needed (Striked Regex modified)
|
// No more needed (Striked Regex modified)
|
||||||
// Temporarily "escape" comments
|
// Temporarily "escape" comments
|
||||||
//sb.Replace("<!--", "($_^)");
|
//sb.Replace("<!--", "($_^)");
|
||||||
|
@ -1497,24 +1497,25 @@ namespace ScrewTurn.Wiki {
|
||||||
private static string EscapeWikiMarkup(string content) {
|
private static string EscapeWikiMarkup(string content) {
|
||||||
StringBuilder sb = new StringBuilder(content);
|
StringBuilder sb = new StringBuilder(content);
|
||||||
sb.Replace("&", "&"); // Before all other escapes!
|
sb.Replace("&", "&"); // Before all other escapes!
|
||||||
sb.Replace("#", "#");
|
sb.Replace("#", "#");
|
||||||
sb.Replace("*", "*");
|
sb.Replace("*", "*");
|
||||||
sb.Replace("<", "<");
|
sb.Replace("<", "<");
|
||||||
sb.Replace(">", ">");
|
sb.Replace(">", ">");
|
||||||
sb.Replace("[", "[");
|
sb.Replace("[", "[");
|
||||||
sb.Replace("]", "]");
|
sb.Replace("]", "]");
|
||||||
sb.Replace("{", "{");
|
sb.Replace("{", "{");
|
||||||
sb.Replace("}", "}");
|
sb.Replace("}", "}");
|
||||||
sb.Replace("'''", "'''");
|
sb.Replace("'''", "'''");
|
||||||
sb.Replace("''", "''");
|
sb.Replace("''", "''");
|
||||||
sb.Replace("=====", "=====");
|
sb.Replace("=====", "=====");
|
||||||
sb.Replace("====", "====");
|
sb.Replace("====", "====");
|
||||||
sb.Replace("===", "===");
|
sb.Replace("===", "===");
|
||||||
sb.Replace("==", "==");
|
sb.Replace("==", "==");
|
||||||
sb.Replace("§§", "§§");
|
sb.Replace("§§", "§§");
|
||||||
sb.Replace("__", "__");
|
sb.Replace("__", "__");
|
||||||
sb.Replace("--", "--");
|
sb.Replace("--", "--");
|
||||||
sb.Replace("@@", "@@");
|
sb.Replace("@@", "@@");
|
||||||
|
sb.Replace(":", ":");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue