Python flexible slugify module
Project description
Python flexible slugify module
Install
pip install awesome-slugify
Function args
slugify
text # text for translate. position arg
max_length = None # output string max length
separator = '-' # separator string
capitalize = False # upper first letter if True
Retuns translated text.
get_slugify
pretranslate = None # function or dict for replace before translation
translate = unidecode.unidecode # function for slugifying or None
# + slugify's keyword args
Returns slugify function.
Examples
from slugify import slugify, get_slugify, slugify_unicode, slugify_ru
slugify('one kožušček') # one-kozuscek
slugify('one-=-two-%-three', separator='.') # one.two.three
slugify('one two Three', capitalize=True) # One-two-Three
slugify('one two three four', max_length=12) # one-two-four (12 chars)
slugify('я ♥ борщ') # ia-borshch
slugify_unicode('я ♥ борщ') # я-борщ (sanitize only)
my_slugify = get_slugify(pretranslate={'я': 'i', '♥': 'love', 'щ': 'sch'}, separator='.')
my_slugify('я ♥ щи') # i.love.borsch (custom translate)
slugify_ru('я ♥ щи') # ya-borsch (alternative russian translate)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
awesome-slugify-1.0.1.tar.gz
(3.8 kB
view details)
File details
Details for the file awesome-slugify-1.0.1.tar.gz
.
File metadata
- Download URL: awesome-slugify-1.0.1.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a05fa171a4e613d785563113774afa4a949c383bc18b48a4ee27f48f859b64b4 |
|
MD5 | c5a51c4929e1cd31dfe7c63d4dbdd0b7 |
|
BLAKE2b-256 | 5e9533e3d0de65b1c4bcd30ac9067b5ef432c908915456dd91981ff1a4ef6efe |