Skip to content

Commit

Permalink
fix: Correctly handle whitespaces in XBind path rewriter
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 committed Sep 16, 2021
1 parent 05b68c2 commit dfeb4a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public class Given_xBindPathParser
[DataRow("\"{x:Bind a}\"", "\"{x:Bind YQA_}\"")]
[DataRow("\"{x:Bind Test(a)}\"", "\"{x:Bind VABlAHMAdAAoAGEAKQA_}\"")]
[DataRow("\"{x:Bind Test(a,b)}\"", "\"{x:Bind VABlAHMAdAAoAGEALABiACkA}\"")]
[DataRow("\"{x:Bind\nTest(a,b)}\"", "\"{x:Bind VABlAHMAdAAoAGEALABiACkA}\"")]
[DataRow("\"{x:Bind\r\nTest(a,b)}\"", "\"{x:Bind VABlAHMAdAAoAGEALABiACkA}\"")]
[DataRow("\"{x:Bind Test(a,b)}\"", "\"{x:Bind VABlAHMAdAAoAGEALABiACkA}\"")]
[DataRow("\"{x:Bind Test(a,b), Converter={StaticResource Res1}}\"", "\"{x:Bind VABlAHMAdAAoAGEALABiACkA, Converter={StaticResource Res1}}\"")]
[DataRow("\"{x:Bind Test(a, (int)b), Converter={StaticResource Res1}}\"", "\"{x:Bind VABlAHMAdAAoAGEALAAgACgAaQBuAHQAKQBiACkA, Converter={StaticResource Res1}}\"")]
[DataRow("\"{x:Bind dateTimeField,Converter={StaticResource StringFormatConverter},ConverterParameter='Started: {0:MMM dd, yyyy hh:mm tt}',Mode=OneWay}\"", "\"{x:Bind ZABhAHQAZQBUAGkAbQBlAEYAaQBlAGwAZAA_,Converter={StaticResource StringFormatConverter},ConverterParameter='Started: {0:MMM dd, yyyy hh:mm tt}',Mode=OneWay}\"")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ internal static string RewriteDocumentPaths(string markup)
var result =
Regex.Replace(
markup,
"\"{x:Bind (.*?)}\"",
e => $"\"{{x:Bind {RewriteParameters(e.Groups[1].Value)}}}\""
"\"{x:Bind\\s(.*?)}\"",
e => $"\"{{x:Bind {RewriteParameters(e.Groups[1].Value.Trim())}}}\"",
RegexOptions.Singleline
);

return result;
Expand Down

0 comments on commit dfeb4a5

Please sign in to comment.