diff --git a/Core-Tests/FormatterTests.cs b/Core-Tests/FormatterTests.cs index 7485697..68092b7 100644 --- a/Core-Tests/FormatterTests.cs +++ b/Core-Tests/FormatterTests.cs @@ -29,6 +29,7 @@ second line"; private MockRepository mocks; [Test] + //[TestCase("{wikititle}","Title")] [TestCase("@@rigatesto1\r\nriga2@@","
rigatesto1\r\nriga2
\n")] [TestCase(Input,ExpectedOutput)] public void Format(string input, string output) { diff --git a/Core/Formatter.cs b/Core/Formatter.cs index e33ce60..b9dd305 100644 --- a/Core/Formatter.cs +++ b/Core/Formatter.cs @@ -39,6 +39,7 @@ namespace ScrewTurn.Wiki { private static readonly Regex BoxRegex = new Regex(@"\(\(\(.+?\)\)\)", RegexOptions.Compiled | RegexOptions.Singleline); private static readonly Regex ExtendedUpRegex = new Regex(@"\{up((\:|\().+?)?\}", RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly Regex SpecialTagRegex = new Regex(@"\{(wikititle|wikiversion|mainurl|rsspage|themepath|clear|br|top|searchbox|pagecount|pagecount\(\*\)|categories|cloud|orphans|wanted|namespacelist)\}", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); + private static readonly Regex SpecialTagBR = new Regex(@"\{(br)\}", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); private static readonly Regex Phase3SpecialTagRegex = new Regex(@"\{(username|pagename|loginlogout|namespace|namespacedropdown|incoming|outgoing)\}", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); private static readonly Regex RecentChangesRegex = new Regex(@"\{recentchanges(\(\*\))?\}", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); private static readonly Regex ListRegex = new Regex(@"(?<=(\n|^))((\*|\#)+(\ )?.+?\n)+((?=\n)|\z)", RegexOptions.Compiled | RegexOptions.Singleline); // Singleline to matche list elements on multiple lines @@ -264,7 +265,7 @@ namespace ScrewTurn.Wiki { match = ExtendedUpRegex.Match(sb.ToString(), end); } - match = SpecialTagRegex.Match(sb.ToString()); + match = SpecialTagBR.Match(sb.ToString()); // solved by introducing a new regex call SpecialTagBR while(match.Success) { if(!IsNoWikied(match.Index, noWikiBegin, noWikiEnd, out end)) { sb.Remove(match.Index, match.Length);