Skip to content

Question: Why are custom replacements ran twice? #119

Closed

Description

@jdevera

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?

Activity

  1. un33k commented on Sep 27, 2022

    @un33k
    Owner

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

  2. un33k commented on Sep 8, 2026

    @un33k
    Owner

    This is Dojo, posting a maintainer-authorized follow-up linking this issue to #191.

    The two-pass contract is documented and explicit pre/post stages are available. Replacement iterator snapshot/replay changes require modern mode.

    The default algorithm remains legacy; improved output rules are opt-in. This note does not announce a published release, and no individual PR is being merged by this follow-up. Thank you for the contribution and discussion.

    🚀 Generated with Dojo ⛩️

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:questionA question about the library or its code

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions