-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add special pre translation file, more unit test, updated readme
- Loading branch information
Showing
5 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from .special import * | ||
from .slugify import * | ||
|
||
|
||
__author__ = 'Val Neekman @ Neekware Inc. [@vneekman]' | ||
__description__ = 'A Python slugify application that also handles Unicode' | ||
__version__ = '3.0.4' | ||
__version__ = '3.0.5' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
def add_uppercase_char(char_list): | ||
""" Given a replacement char list, this adds uppercase chars to the list """ | ||
|
||
for item in char_list: | ||
char, xlate = item | ||
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 | ||
|
||
|
||
# Language specific pre translations | ||
# Source awesome-slugify | ||
|
||
_CYRILLIC = [ # package defaults: | ||
(u'ё', u'e'), # io / yo | ||
(u'я', u'ya'), # ia | ||
(u'х', u'h'), # kh | ||
(u'у', u'y'), # u | ||
(u'щ', u'sch'), # shch | ||
(u'ю', u'u'), # iu / yu | ||
] | ||
CYRILLIC = add_uppercase_char(_CYRILLIC) | ||
|
||
_GERMAN = [ # package defaults: | ||
(u'ä', u'ae'), # a | ||
(u'ö', u'oe'), # o | ||
(u'ü', u'ue'), # u | ||
] | ||
GERMAN = add_uppercase_char(_GERMAN) | ||
|
||
_GREEK = [ # package defaults: | ||
(u'χ', u'ch'), # kh | ||
(u'Ξ', u'X'), # Ks | ||
(u'ϒ', u'Y'), # U | ||
(u'υ', u'y'), # u | ||
(u'ύ', u'y'), | ||
(u'ϋ', u'y'), | ||
(u'ΰ', u'y'), | ||
] | ||
GREEK = add_uppercase_char(_GREEK) | ||
|
||
# Pre translations | ||
PRE_TRANSLATIONS = CYRILLIC + GERMAN + GREEK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters