fix(bot): allow end-of-line space on otherwise empty blockquote line

Fixes #507
This commit is contained in:
Iris System 2023-02-05 01:20:52 +13:00
parent 6cc479b40b
commit 3fd16182f0

View File

@ -52,8 +52,9 @@ public static class StringUtils
public static string NormalizeLineEndSpacing(this string input) => public static string NormalizeLineEndSpacing(this string input) =>
// iOS has a weird issue on embeds rendering newlines when there are spaces *just before* it // iOS has a weird issue on embeds rendering newlines when there are spaces *just before* it
// so we remove 'em all :) // so we remove 'em - except in the case where there's a blockquote line that contains only
Regex.Replace(input, " *\n", "\n"); // spaces (if we removed all the spaces there, the blockquote breaks horribly)
Regex.Replace(input, "(?<!\\>) *\n", "\n");
public static IReadOnlyList<string> JoinPages(IEnumerable<string> input, int characterLimit) => public static IReadOnlyList<string> JoinPages(IEnumerable<string> input, int characterLimit) =>
JoinPages(input, _ => characterLimit); JoinPages(input, _ => characterLimit);