mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-01 01:05:06 +08:00
replacing non ascii characters in wikipedia mode when language is english
closes #4447
This commit is contained in:
parent
99a7972c13
commit
8b8d9ebf01
1 changed files with 5 additions and 1 deletions
|
@ -51,7 +51,7 @@ export async function getSection(language: string): Promise<Section> {
|
|||
// get TLD for wikipedia according to language group
|
||||
let urlTLD = "en";
|
||||
|
||||
let currentLanguageGroup;
|
||||
let currentLanguageGroup: MonkeyTypes.LanguageGroup | undefined;
|
||||
try {
|
||||
currentLanguageGroup = await Misc.findCurrentGroup(language);
|
||||
} catch (e) {
|
||||
|
@ -109,6 +109,10 @@ export async function getSection(language: string): Promise<Section> {
|
|||
// Removing whitespace before and after text
|
||||
sectionText = sectionText.trim();
|
||||
|
||||
if (urlTLD === "en") {
|
||||
sectionText = sectionText.replace(/[^\x20-\x7E]+/g, "");
|
||||
}
|
||||
|
||||
const words = sectionText.split(" ");
|
||||
|
||||
const section = new Section(
|
||||
|
|
Loading…
Reference in a new issue