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

Make slugifier better #50

Merged
merged 1 commit into from
Apr 7, 2021
Merged

Make slugifier better #50

merged 1 commit into from
Apr 7, 2021

Conversation

valtlai
Copy link
Contributor

@valtlai valtlai commented Apr 7, 2021

  • Added Unicode normalization, which handles most of the slug characters. This way we don’t need to list lots of characters.
  • Moved the hyphen at the end of the character classes, so it’s clearer that it represents a literal hyphen and not a character range.
  • Added ß to the character list.
  • Moved the character list inside the function, because it doesn’t need to be exported. (Or does it?)
  • Replaced the unnecessary function with a string.

* Added Unicode normalization,
  which handles most of the slug characters.
  This way we don’t need to list lots of characters.
* Moved the hyphen at the end of the character classes,
  so it’s clearer that it represents a literal hyphen
  and not a character range.
* Added ß to the character list.
* Moved the character list inside the function,
  because it doesn’t need to be exported.
* Replaced the unnecessary function with a string.
@oscarotero
Copy link
Member

The reason to export the characters list is to allow to configure the characters substitution in _config.js file for other casuistry not covered. But I guess with the Unicode normalization (I didn't know this trick) it's not needed.

@oscarotero oscarotero merged commit 9b48015 into lumeland:master Apr 7, 2021
@valtlai valtlai deleted the slugifier branch April 8, 2021 00:05
@valtlai valtlai restored the slugifier branch April 8, 2021 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants