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

Question: Why are custom replacements ran twice? #119

Closed
jdevera opened this issue Sep 26, 2022 · 1 comment
Closed

Question: Why are custom replacements ran twice? #119

jdevera opened this issue Sep 26, 2022 · 1 comment
Labels
type:question A question about the library or its code

Comments

@jdevera
Copy link
Collaborator

jdevera commented Sep 26, 2022

I noticed this block

     if replacements:
        for old, new in replacements:
            text = text.replace(old, new)

appears twice in slugify. Why is that? Would it not make sense to have some pre-replacements and post-replacements instead?

@jdevera jdevera added the type:question A question about the library or its code label Sep 26, 2022
@un33k
Copy link
Owner

un33k commented Sep 27, 2022

Test with care, some post slugify strings may end up with replacement words after the conversion, specially in non-english languages.

@un33k un33k closed this as completed Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question A question about the library or its code
Projects
None yet
Development

No branches or pull requests

2 participants