Slugifier
slugany.Slugifier ¶
Stateless slugifier bound to a fixed configuration.
Created via :meth:Slugifier.style or the constructor with a
:class:SlugConfig. The instance is callable — calling it with
a string runs the slugify pipeline using the stored config.
The config attribute is read-only; the underlying
:class:SlugConfig is frozen and cannot be mutated.
Examples:
Source code in slugany/_slugifier.py
__call__ ¶
Slugify text using this slugifier's configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The text to slugify. Must be a string. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The slugified string. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
Source code in slugany/_slugifier.py
__init__ ¶
Initialize the Slugifier with an optional configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
SlugConfig | None
|
A :class: |
None
|
Source code in slugany/_slugifier.py
style
classmethod
¶
Create a Slugifier from a named style preset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
style
|
str
|
One of |
required |
**overrides
|
Any
|
Additional keyword arguments forwarded to
:meth: |
{}
|
Returns:
| Type | Description |
|---|---|
Slugifier
|
A Slugifier bound to the resolved configuration. |