Page MenuHomePhabricator

Tabulation(s) at end of line can be cleaned like normal space(s)
Open, Needs TriagePublicFeature

Description

Feature summary:

At now AWB removes space(s) and non-breaking space(s) at end of line, but leaves tabulation(s) (\t).
It should remove tabulation(s) too.

Benefits: Just the same as removing spaces. It is invisible and sometimes confusing.

--- a/AWB/UnitTests/FormattingTests.cs
+++ b/AWB/UnitTests/FormattingTests.cs
@@ -724,7 +724,8 @@
             Assert.AreEqual("a \r\nb", Parsers.RemoveWhiteSpace("a \r\nb"), "keep space at end of line before single line break, e.g. within infobox parameters");
             Assert.AreEqual("a\r\n\r\nb", Parsers.RemoveWhiteSpace("a \r\n\r\nb"));
             Assert.AreEqual("a\r\n\r\nb", Parsers.RemoveWhiteSpace("a\u00a0\r\n\r\nb"), "Unicode U+00A0 NO-BREAK SPACE");
+            Assert.AreEqual("a\r\n\r\nb", Parsers.RemoveWhiteSpace("a\t\r\n\r\nb"), "Tabulation");
             Assert.AreEqual("a\r\n\r\n\r\n{{foo stub}}", Parsers.RemoveWhiteSpace("a\r\n\r\n\r\n{{foo stub}}"), "two newlines before stub are kept");
 
             Assert.AreEqual("== foo ==\r\n==bar", Parsers.RemoveWhiteSpace("== foo ==\r\n==bar"));


--- a/AWB/WikiFunctions/Parse/Parsers.cs
+++ b/AWB/WikiFunctions/Parse/Parsers.cs
@@ -398,7 +398,7 @@
         private static readonly Regex NewlinesBelowExternalLinks = new Regex(@"==External links==[\r\n\s]*\*");
         private static readonly Regex HorizontalRule = new Regex("----+$");
         private static readonly Regex MultipleTabs = new Regex("  +", RegexOptions.Compiled);
-        private static readonly Regex SpacesThenTwoNewline = new Regex(@"[ \u00a0]+\r\n\r\n", RegexOptions.Compiled);
+        private static readonly Regex SpacesThenTwoNewline = new Regex(@"[ \u00a0\t]+\r\n\r\n", RegexOptions.Compiled);
         private static readonly Regex WikiListWithMultipleSpaces = new Regex(@"^([\*#]+) +", RegexOptions.Compiled | RegexOptions.Multiline);
         private static readonly Regex SpacedDashes = new Regex(" (—|&#15[01];|—|&#821[12];|&#x201[34];) ", RegexOptions.Compiled);
         private static readonly Regex NewlinesWithinLists = new Regex(@"(\r\n\*.*)\r\n[\t ]*\r\n\*", RegexOptions.Compiled);