Skip to content

Commit

Permalink
Uppercase handling of special chars (#149)
Browse files Browse the repository at this point in the history
* Remove compatibility with unsupported Python versions (#146)
* fix uppercase pre-translations (#148)

Co-authored-by: Viicos <[email protected]>
Co-authored-by: Michael <[email protected]>
  • Loading branch information
3 people authored Feb 8, 2024
1 parent 26b81c2 commit 2433548
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 8.0.4

- Properly handle uppercase special characters (@mib1185 - thx)

## 8.0.3

- Drop compatibility for unsupported Python Version (@Viicos - thx)
Expand Down
2 changes: 1 addition & 1 deletion slugify/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
__url__ = 'https://github.com/un33k/python-slugify'
__license__ = 'MIT'
__copyright__ = 'Copyright 2022 Val Neekman @ Neekware Inc.'
__version__ = '8.0.3'
__version__ = '8.0.4'
1 change: 0 additions & 1 deletion slugify/special.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ def add_uppercase_char(char_list: list[tuple[str, str]]) -> list[tuple[str, str]
upper_dict = char.upper(), xlate.capitalize()
if upper_dict not in char_list and char != upper_dict[0]:
char_list.insert(0, upper_dict)
return char_list
return char_list


Expand Down
5 changes: 4 additions & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import unittest
from contextlib import contextmanager

from slugify import PRE_TRANSLATIONS
from slugify import slugify
from slugify import smart_truncate
from slugify.__main__ import slugify_params, parse_args
Expand Down Expand Up @@ -236,9 +237,11 @@ def test_replacements_german_umlaut_custom(self):
r = slugify(txt, replacements=[['Ü', 'UE'], ['ü', 'ue']])
self.assertEqual(r, "ueber-ueber-german-umlaut")

def test_pre_translation(self):
self.assertEqual(PRE_TRANSLATIONS, [('Ю', 'U'), ('Щ', 'Sch'), ('У', 'Y'), ('Х', 'H'), ('Я', 'Ya'), ('Ё', 'E'), ('ё', 'e'), ('я', 'ya'), ('х', 'h'), ('у', 'y'), ('щ', 'sch'), ('ю', 'u'), ('Ü', 'Ue'), ('Ö', 'Oe'), ('Ä', 'Ae'), ('ä', 'ae'), ('ö', 'oe'), ('ü', 'ue'), ('Ϋ́', 'Y'), ('Ϋ', 'Y'), ('Ύ', 'Y'), ('Υ', 'Y'), ('Χ', 'Ch'), ('χ', 'ch'), ('Ξ', 'X'), ('ϒ', 'Y'), ('υ', 'y'), ('ύ', 'y'), ('ϋ', 'y'), ('ΰ', 'y')])

class TestSlugifyUnicode(unittest.TestCase):

class TestSlugifyUnicode(unittest.TestCase):
def test_extraneous_seperators(self):

txt = "This is a test ---"
Expand Down

0 comments on commit 2433548

Please sign in to comment.