"); // IE needs \r\n for line breaks dummy.Append(EscapeWikiMarkup(content).Replace("\n", "\r\n")); dummy.Append(""); 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) // Temporarily "escape" comments //sb.Replace("", "(^_$)"); ComputeNoWiki(sb.ToString(), ref noWikiBegin, ref noWikiEnd); // Before Producing HTML if(!bareBones) { match = EscRegex.Match(sb.ToString()); while(match.Success) { if(!IsNoWikied(match.Index, noWikiBegin, noWikiEnd, out end)) { sb.Remove(match.Index, match.Length); sb.Insert(match.Index, match.Value.Substring(5, match.Length - 11).Replace("<", "<").Replace(">", ">")); } ComputeNoWiki(sb.ToString(), ref noWikiBegin, ref noWikiEnd); match = EscRegex.Match(sb.ToString(), end); } } // Snippets and tables processing was here if(!bareBones) { match = IndentRegex.Match(sb.ToString()); while(match.Success) { if(!IsNoWikied(match.Index, noWikiBegin, noWikiEnd, out end)) { sb.Remove(match.Index, match.Length); sb.Insert(match.Index, BuildIndent(match.Value) + "\n"); } ComputeNoWiki(sb.ToString(), ref noWikiBegin, ref noWikiEnd); match = IndentRegex.Match(sb.ToString(), end); } } // Process extended UP before standard UP match = ExtendedUpRegex.Match(sb.ToString()); while(match.Success) { if(!IsNoWikied(match.Index, noWikiBegin, noWikiEnd, out end)) { sb.Remove(match.Index, match.Length); string prov = match.Groups[1].Value.StartsWith(":") ? match.Value.Substring(4, match.Value.Length - 5) : match.Value.Substring(3, match.Value.Length - 4); string page = null; // prov - Full.Provider.Type.Name(PageName) // (PageName) is optional, but it can contain brackets, for example (Page(WithBrackets)) if(prov.EndsWith(")") && prov.Contains("(")) { page = prov.Substring(prov.IndexOf("(") + 1); page = page.Substring(0, page.Length - 1); page = Tools.UrlEncode(page); prov = prov.Substring(0, prov.IndexOf("(")); } if(page == null) { // Normal file sb.Insert(match.Index, ExtendedUpReplacement.Replace("$", (prov != "") ? "Provider=" + prov + "&" : "")); } else { // Page attachment sb.Insert(match.Index, ExtendedUpReplacementForAttachment.Replace("$", (prov != "")? "Provider=" + prov + "&" : "").Replace("@", page)); } } ComputeNoWiki(sb.ToString(), ref noWikiBegin, ref noWikiEnd); match = ExtendedUpRegex.Match(sb.ToString(), end); } /*match = UpRegex.Match(sb.ToString()); while(match.Success) { if(!IsNoWikied(match.Index, noWikiBegin, noWikiEnd, out end)) { sb.Remove(match.Index, match.Length); sb.Insert(match.Index, UpReplacement); } ComputeNoWiki(sb.ToString(), ref noWikiBegin, ref noWikiEnd); match = UpRegex.Match(sb.ToString(), end); }*/ if(!bareBones) { match = SpecialTagRegex.Match(sb.ToString()); while(match.Success) { if(!IsNoWikied(match.Index, noWikiBegin, noWikiEnd, out end)) { sb.Remove(match.Index, match.Length); switch(match.Value.Substring(1, match.Value.Length - 2).ToUpperInvariant()) { case "WIKITITLE": sb.Insert(match.Index, Settings.WikiTitle); break; case "WIKIVERSION": sb.Insert(match.Index, Settings.WikiVersion); break; case "MAINURL": sb.Insert(match.Index, Settings.MainUrl); break; case "RSSPAGE": if(current != null) { sb.Insert(match.Index, @"
");
}
else {
img.Append(@" ");
}
if(bigUrl.Length > 0) {
dummy = new StringBuilder(200);
dummy.Append(@" "); img.Append(title); img.Append(" "); } if(c.Equals("imageauto")) { img.Append(" |
"); // IE needs \r\n for line breaks dummy.Append(match.Value.Substring(4, match.Value.Length - 8).Replace("\n", "\r\n")); dummy.Append(""); sb.Insert(match.Index, dummy.ToString()); } ComputeNoWiki(sb.ToString(), ref noWikiBegin, ref noWikiEnd); match = PreRegex.Match(sb.ToString(), end); } match = CodeRegex.Match(sb.ToString()); while(match.Success) { if(!IsNoWikied(match.Index, noWikiBegin, noWikiEnd, out end)) { sb.Remove(match.Index, match.Length); dummy = new StringBuilder("
");
dummy.Append(match.Value.Substring(2, match.Value.Length - 4));
dummy.Append("
");
sb.Insert(match.Index, dummy.ToString());
}
ComputeNoWiki(sb.ToString(), ref noWikiBegin, ref noWikiEnd);
match = CodeRegex.Match(sb.ToString(), end);
}
string h;
// Hx: detection pass (used for the TOC generation and section editing)
hPos = DetectHeaders(sb.ToString());
// Hx: formatting pass
int count = 0;
match = H4Regex.Match(sb.ToString());
while(match.Success) {
if(!IsNoWikied(match.Index, noWikiBegin, noWikiEnd, out end)) {
sb.Remove(match.Index, match.Length);
h = match.Value.Substring(5, match.Value.Length - 10 - (match.Value.EndsWith("\n") ? 1 : 0));
dummy = new StringBuilder(200);
dummy.Append(@""); sb.Append(Preferences.AlignWithTimezone(allChanges[i].DateTime).ToString(Settings.DateTimeFormat)); sb.Append(" | "); sb.Append(PrintRecentChange(allChanges[i], context, currentPage)); sb.Append(" | "); sb.Append("
");
sb.Append(@" ");
sb.Append(@" ");
sb.Append(""); sb.Append(TocTitlePlaceHolder); sb.Append(" "); sb.Append(@"");
sb.Append(" ");
sb.Append("
|
"); sb.Append(item.Replace(" || ", " | ")); sb.Append(" | "); } else if(item.IndexOf(" | ") != -1) { sb.Append(""); sb.Append(item.Substring(item.IndexOf(" | ") + 3)); sb.Append(" | "); } else { sb.Append(""); sb.Append(item); sb.Append(" | "); } } else if(lines[i].Trim().StartsWith("!")) { // Header if(lines[i].Length < 3) continue; // only if ! is found in the first row of the table, it is an header if(lines[i + 1] == "|-") thAdded = true; item = lines[i].Substring(2); if(item.IndexOf(" !! ") != -1) { sb.Append(""); sb.Append(item.Replace(" !! ", " | ")); sb.Append(" | "); } else if(item.IndexOf(" ! ") != -1) { sb.Append(""); sb.Append(item.Substring(item.IndexOf(" ! ") + 3)); sb.Append(" | "); } else { sb.Append(""); sb.Append(item); sb.Append(" | "); } } } if(sb.ToString().EndsWith("
---|---|---|---|---|---|---|---|