Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prepone non-ascii characters removal for Wikipedia (FortPile) #4814

Merged
merged 2 commits into from
Nov 27, 2023

Conversation

Coadon
Copy link
Contributor

@Coadon Coadon commented Nov 26, 2023

Description

Very simple.

When using the Wikipedia funbox, there would be occasional consecutive spaces (like ' '). As you would have guessed, the cursor glitched in the event of one.
This (from my observations) is caused by the algorithm after fetching having to remove all non-ASCII characters (most notably '–' involved with dates) AFTER cleaning whitespaces with the regex /\s+/g.
This process is now moved back.

I'm pretty sure this is the only source causing this issue. Otherwise, we could also clear all elements of words with an empty string after const words = sectionText.split(" ");.

Checks

  • Adding a language or a theme?
    • If is a language, did you edit _list.json, _groups.json and add languages.json?
    • If is a theme, did you add the theme.css?
      • Also please add a screenshot of the theme, it would be extra awesome if you do so!
  • Check if any open issues are related to this PR; if so, be sure to tag them below.
  • Make sure the PR title follows the Conventional Commits standard. (https://www.conventionalcommits.org for more info)
  • Make sure to include your GitHub username inside round brackets at the end of the PR title

@monkeytypegeorge monkeytypegeorge added the frontend User interface or web stuff label Nov 26, 2023
@Miodec
Copy link
Member

Miodec commented Nov 27, 2023

Are you sure this is the fix? This line replaces these characters with an empty string, not a space.

@Miodec Miodec added the waiting for update Pull requests or issues that require changes/comments before continuing label Nov 27, 2023
@Coadon
Copy link
Contributor Author

Coadon commented Nov 27, 2023

Well, you see, replacing these characters with an empty string after converting all the whitespace to space results in potential consecutive spaces missing the purge.
Here's an example:
Consider the text (21 April 1926 – 8 September 2022)
Firstly, all whitespace (consecutive or single) is replaced with a single space which so far does nothing.
Then, non-ASCII characters are replaced with nothing, leaving (21 April 1926 8 September 2022)
Notice the double space missing the clean. This step should've been done earlier.

@Miodec Miodec merged commit 4fa6647 into monkeytypegame:master Nov 27, 2023
6 checks passed
@Miodec
Copy link
Member

Miodec commented Nov 27, 2023

Thanks, makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend User interface or web stuff waiting for update Pull requests or issues that require changes/comments before continuing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants