diff options
| author | Val Neekman <val@neekware.com> | 2013-04-24 10:27:06 -0400 |
|---|---|---|
| committer | Val Neekman <val@neekware.com> | 2013-04-24 10:27:06 -0400 |
| commit | e951142f77402cd4e0bdca69ea4aea5bb466c310 (patch) | |
| tree | 26369e90d4a53ac5ff6807ef4833ff16a4a8e4a3 /slugify/__init__.py | |
| parent | a4c78fab0157d7da3ed77ca8b2f98cd0dbac5bf2 (diff) | |
| download | python-slugify-0.0.4.tar.gz | |
added non-dash separator option0.0.4
Diffstat (limited to 'slugify/__init__.py')
| -rw-r--r-- | slugify/__init__.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/slugify/__init__.py b/slugify/__init__.py index 8d0295a..f8de605 100644 --- a/slugify/__init__.py +++ b/slugify/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -__version__ = '0.0.3' +__version__ = '0.0.4' __all__ = ['slugify'] @@ -38,7 +38,7 @@ def smart_truncate(text, max_length=0, word_boundaries=False): return truncated.strip('-') -def slugify(text, entities=True, decimal=True, hexadecimal=True, max_length=0, word_boundary=False): +def slugify(text, entities=True, decimal=True, hexadecimal=True, max_length=0, word_boundary=False, separator='-'): """ Make a slug from the given text """ # text to unicode @@ -83,6 +83,9 @@ def slugify(text, entities=True, decimal=True, hexadecimal=True, max_length=0, w if max_length > 0: text = smart_truncate(text, max_length, word_boundary) + if separator != '-': + text = text.replace('-', separator) + return text |
