Skip to content

Support for punctuation in the :ignore option#10

Merged
jayjun merged 1 commit intojayjun:masterfrom
simedw:master
Jun 19, 2020
Merged

Support for punctuation in the :ignore option#10
jayjun merged 1 commit intojayjun:masterfrom
simedw:master

Conversation

@simedw
Copy link
Copy Markdown
Contributor

@simedw simedw commented Jun 18, 2020

Hi, thanks for a great library.

I have a use case in which I needed to ignore underscores, but since they are part of [:punct:] using ignore: "_" didn't work.

In this PR I extracted out the :punct: to a list of characters and then filter out the ignored_codepoints.

Copy link
Copy Markdown
Owner

@jayjun jayjun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks great! Just a couple of small nit picks below.

Also probably OCD but might as well fix commit message typo and capitalisation.

Support to ignore punctuations

Comment thread lib/slug.ex Outdated
replaced by hyphens.
"""

@punctuation ~c"!\"#$%&'()*+,-./:;<=>?@[\\]^_‘{|}~"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe :punct: includes ` (backtick) but not (left single quote).

Can you confirm?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, you are correct. I also doubled checked the rest of characters, they seem to be correct.

Comment thread lib/slug.ex Outdated
@simedw simedw changed the title support to ignore punctiations Support for punctuation in :ignore option Jun 18, 2020
@simedw simedw changed the title Support for punctuation in :ignore option Support for punctuation in the :ignore option Jun 18, 2020
@simedw
Copy link
Copy Markdown
Contributor Author

simedw commented Jun 18, 2020

Thanks for the feedback @jayjun , I have updated the PR.

@jayjun jayjun merged commit bfc5d35 into jayjun:master Jun 19, 2020
@jayjun
Copy link
Copy Markdown
Owner

jayjun commented Jun 19, 2020

👍👌🤝👊🤘

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