diff options
| author | Val Neekman <val@neekware.com> | 2019-01-03 17:40:15 -0500 |
|---|---|---|
| committer | Val Neekman <val@neekware.com> | 2019-01-03 17:40:15 -0500 |
| commit | 8aea5c49b960b66e5c81bf20f17ec23e41c8d157 (patch) | |
| tree | 72f41588ccc9ae7281220f12fba1f6aff2d5801f | |
| parent | 646761e5b4c73b9be7285c60eab4e10c30fe32f4 (diff) | |
| download | python-slugify-8aea5c49b960b66e5c81bf20f17ec23e41c8d157.tar.gz | |
clean up, up version
| -rw-r--r-- | CHANGELOG.md | 3 | ||||
| -rw-r--r-- | slugify/__init__.py | 2 | ||||
| -rw-r--r-- | slugify/slugify.py | 5 |
3 files changed, 9 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index cd80bf1..e2eed12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2.0.1 + - Add replacements option e.g. [['|', 'or'], ['%', 'percent'], ['-', '_']] (@andriyor) + ## 2.0.0 - Fix alternative dependency installation diff --git a/slugify/__init__.py b/slugify/__init__.py index 81849b9..7358b99 100644 --- a/slugify/__init__.py +++ b/slugify/__init__.py @@ -3,4 +3,4 @@ from .slugify import * __author__ = 'Val Neekman @ Neekware Inc. [@vneekman]' __description__ = 'A Python slugify application that also handles Unicode' -__version__ = '2.0.0' +__version__ = '2.0.1' diff --git a/slugify/slugify.py b/slugify/slugify.py index 1544aba..59e9672 100644 --- a/slugify/slugify.py +++ b/slugify/slugify.py @@ -165,6 +165,11 @@ def slugify(text, entities=True, decimal=True, hexadecimal=True, max_length=0, w words = [w for w in text.split(DEFAULT_SEPARATOR) if w not in stopwords] text = DEFAULT_SEPARATOR.join(words) + # finalize user-specific replacements + if replacements: + for old, new in replacements: + text = text.replace(old, new) + # smart truncate if requested if max_length > 0: text = smart_truncate(text, max_length, word_boundary, DEFAULT_SEPARATOR, save_order) |
