mirror of
https://github.com/openwrt/packages.git
synced 2026-04-15 19:02:09 +00:00
Changes since 8.0.1: - Improved uppercase special character handling and text normalization before unicode conversion - Resolved pattern type issues - Various bug fixes for robust character handling Also add test.sh to verify slugification, unicode handling and options like separator and max_length. Link: https://github.com/un33k/python-slugify/blob/master/CHANGELOG.md Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
29 lines
774 B
Bash
29 lines
774 B
Bash
#!/bin/sh
|
|
|
|
[ "$1" = python3-slugify ] || exit 0
|
|
|
|
python3 - << 'EOF'
|
|
from slugify import slugify
|
|
|
|
# Basic ASCII
|
|
assert slugify('Hello World') == 'hello-world', f"got: {slugify('Hello World')}"
|
|
|
|
# Unicode transliteration
|
|
assert slugify('Héllo Wörld') == 'hello-world', f"got: {slugify('Héllo Wörld')}"
|
|
|
|
# Special characters stripped
|
|
assert slugify('Hello, World!') == 'hello-world', f"got: {slugify('Hello, World!')}"
|
|
|
|
# Numbers preserved
|
|
assert slugify('test 123') == 'test-123', f"got: {slugify('test 123')}"
|
|
|
|
# Custom separator
|
|
assert slugify('Hello World', separator='_') == 'hello_world'
|
|
|
|
# Max length
|
|
result = slugify('a very long title that should be truncated', max_length=10)
|
|
assert len(result) <= 10, f"length {len(result)} > 10"
|
|
|
|
print("python-slugify OK")
|
|
EOF
|