python-python-slugify
Port variant v12
Summary Unicode-capable slug generator (3.12)
BROKEN
Package version 8.0.4
Homepage https://github.com/un33k/python-slugify
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v13
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 15 NOV 2024, 16:08:50 UTC
Port created 08 JAN 2023, 04:18:24 UTC
Subpackage Descriptions
single # Python Slugify **A Python slugify application that handles unicode**. [![status-image]][status-link] [![version-image]][version-link] [![coverage-image]][coverage-link] # Overview **Best attempt** to create slugs from unicode strings while keeping it **DRY**. # Notice This module, by default installs and uses [text-unidecode] _(GPL & Perl Artistic)_ for its decoding needs. However, there is an alternative decoding package called [Unidecode] _(GPL)_. It can be installed as `python-slugify[unidecode]` for those who prefer it. `Unidecode` is believed to be more [advanced]. ### `Official` Support Matrix | Python | Slugify | | -------------- | ------------------ | | `>= 2.7 < 3.6` | `< 5.0.0` | | `>= 3.6 < 3.7` | `>= 5.0.0 < 7.0.0` | | `>= 3.7` | `>= 7.0.0` | # How to install easy_install python-slugify |OR| easy_install python-slugify[unidecode] -- OR -- pip install python-slugify |OR| pip install python-slugify[unidecode] # Options ```python def slugify( text: str, entities: bool = True, decimal: bool = True, hexadecimal: bool = True, max_length: int = 0, word_boundary: bool = False, separator: str = DEFAULT_SEPARATOR, save_order: bool = False, stopwords: Iterable[str] = (), regex_pattern: str | None = None, lowercase: bool = True, replacements: Iterable[Iterable[str]] = (), allow_unicode: bool = False, ) -> str: """ Make a slug from the given text. :param text (str): initial text :param entities (bool): converts html entities to unicode (foo & bar -> foo-bar) :param decimal (bool): converts html decimal to unicode (Ž -> Ž -> z) :param hexadecimal (bool): converts html hexadecimal to unicode (Ž -> Ž -> z) :param max_length (int): output string length :param word_boundary (bool): truncates to end of full words (length may be shorter than max_length) :param save_order (bool): if parameter is True and max_length > 0 return whole words in the initial order :param separator (str): separator between words :param stopwords (iterable): words to discount :param regex_pattern (str): regex pattern for disallowed characters :param lowercase (bool): activate case sensitivity by setting it to False :param replacements (iterable): list of replacement rules e.g. [['|', 'or'], ['%', 'percent']] :param allow_unicode (bool): allow unicode characters :return (str): slugify text """ ``` # How to use ```python from slugify import slugify txt = "This is a test ---" r = slugify(txt) self.assertEqual(r, "this-is-a-test") txt = '影師嗎' r = slugify(txt) self.assertEqual(r, "ying-shi-ma") txt = '影師嗎' r = slugify(txt, allow_unicode=True) self.assertEqual(r, "影師嗎") txt = 'C\'est déjà l\'été.' r = slugify(txt) self.assertEqual(r, "c-est-deja-l-ete")
Configuration Switches (platform-specific settings discarded)
PY312 ON Build using Python 3.12 PY313 OFF Build using Python 3.13
Package Dependencies by Type
Build (only) python312:dev:std
python-pip:single:v12
autoselect-python:single:std
Build and Runtime python312:primary:std
Runtime (only) python-text-unidecode:single:v12
Download groups
main mirror://PYPIWHL/a4/62/02da182e544a51a5c3ccf4b03ab79df279f9c60c5e82d5e8bec7ca26ac11
Distribution File Information
276540b79961052b66b7d116620b36518847f52d5fd9e3a70164fc8c50faa6b8 10051 python-src/python_slugify-8.0.4-py2.py3-none-any.whl
Ports that require python-python-slugify:v12
python-netbox-agent:v12 NetBox agent for server (3.12)
python-netbox-network-importer:v12 Tool to import network into Netbox (3.12)
python-netdoc:v12 Network documentation plugin for NetBox (3.12)