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

Apostrophe in the custom option is ignored #39

Open
david-benes opened this issue Jan 31, 2021 · 2 comments
Open

Apostrophe in the custom option is ignored #39

david-benes opened this issue Jan 31, 2021 · 2 comments
Labels

Comments

@david-benes
Copy link

Expected behavior:

>limax("wendy's", {custom: ["'"]})
wendy's

Actual behavior:

>limax("wendy's", {custom: ["'"]})
wendys

The separateApostrophes option does not help here.

@lovell
Copy link
Owner

lovell commented Jan 31, 2021

Hi, this looks like a bug. I guess the following RegEx should exclude any chars that are included in custom:

limax/lib/limax.js

Lines 20 to 23 in ffdcda7

text = text.replace(
/(\S)['\u2018\u2019\u201A\u201B\u2032\u2035\u0301](\S)/g, // eslint-disable-line no-misleading-character-class
options.separateApostrophes === true ? '$1 $2' : '$1$2'
);

Happy to accept a PR if you're able.

@lovell lovell added the bug label Jan 31, 2021
@david-benes
Copy link
Author

I figured out that there are more similar issues originating from speakingurl package on which limax depends. Fixing this issue #39 won't help much unless the upstream issue pid/speakingurl#124 is resolved first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants