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

Consider removing apostrophe when slugifying English contractions #105

Open
zzzzBov opened this issue Jul 26, 2017 · 3 comments
Open

Consider removing apostrophe when slugifying English contractions #105

zzzzBov opened this issue Jul 26, 2017 · 3 comments

Comments

@zzzzBov
Copy link

zzzzBov commented Jul 26, 2017

rather than converting don't and can't to don-t and can-t, consider adding a custom conversion from "'" to "" for English to turn them into dont and cant respectively.

In the odd case where single quotes are used as an actual quotation, they are typically surrounded by spaces:

Isn't this an 'example'?

would become

isnt-this-an-example
@pid
Copy link
Owner

pid commented Jul 30, 2017

It's not a quick change. Because of this config option mark and the order of replacements.
In short, at the moment I haven't the time for deeper changes, so I would recommend to go with this solution:

var options = {
	    custom: {
                  "'": ""
            }
	};

var mySlug = require('speakingurl').createSlug(options);

var slug = mySlug("Isn't this an 'example'?");
console.log(slug); // Output: isnt-this-an-example

I use it all the time to configure an own project specific slug-function.

Hope it helps; if you have the time to send a pull request, feel free ;-) I think it would be a nice feature.

@zzzzBov
Copy link
Author

zzzzBov commented Jul 31, 2017

@pid

Thanks for the response. I've already been using the {custom:...} solution, but I figured I'd call out the possibility for improvement around this feature.

@niftylettuce
Copy link

I think that having this built in would be nice. I don't see why anyone would want foo-s vs. foos.

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

No branches or pull requests

3 participants