1
0
Fork 0
forked from github/pelican
pelican-theme/pelican
Deniz Turgut 03d9c38871 Rewrite pelican.utils.slugify to use unicode and add tests
Adds a use_unicode kwarg to slugify to keep unicode
characters as is (no ASCII-fying) and add tests for
it. Also reworks how slugification logic.

slugify started with the Django method for slugiying:
 - Normalize to compatibility decomposed from (NFKD)
 - Encode and decode with 'ascii'

This works fine if the decomposed form contains ASCII
characters (i.e. ç can be changed in to c+CEDILLA and
ASCII would keep c only), but fails when decomposition
doesn't result in ASCII characters (i.e. Chinese). To
solve that 'unidecode' was added, which works fine for
both cases. However, old method is now redundant but
was kept. This commit removes the old method and
adjusts logic slightly.

Now slugify will normalize all text with composition
mode (NFKC) to unify format for regex substitutions.
And then if use_unicode is False, uses unidecode to
convert it to ASCII.
2020-04-19 20:10:46 +03:00
..
plugins Fix legacy plugin loading 2020-04-17 21:15:25 +03:00
tests Rewrite pelican.utils.slugify to use unicode and add tests 2020-04-19 20:10:46 +03:00
themes Remove Piwik from theme and settings docs 2020-04-16 08:26:09 +02:00
tools Flake8 fix 2020-04-16 08:10:30 +02:00
__init__.py Fix output directory deletion logic 2020-04-15 15:19:41 +02:00
__main__.py Initial pass of removing Python 2 support 2019-11-26 06:16:41 +09:00
cache.py Convert super() calls to py3 style 2019-11-26 06:17:04 +09:00
contents.py Set timezone when assigning max datetime to drafts 2020-04-14 13:48:03 +02:00
generators.py Add settings for custom Jinja globals and tests (#2715) 2020-04-12 17:03:53 +02:00
log.py Fix LOG_FILTER to act on exact messages 2020-04-12 21:00:27 +03:00
paginator.py Initial pass of removing Python 2 support 2019-11-26 06:16:41 +09:00
readers.py Add Typogrify/SmartyPants dashes config parameter (#2615) 2020-04-16 13:32:19 +02:00
rstdirectives.py Initial pass of removing Python 2 support 2019-11-26 06:16:41 +09:00
server.py Initial pass of removing Python 2 support 2019-11-26 06:16:41 +09:00
settings.py Add Typogrify/SmartyPants dashes config parameter (#2615) 2020-04-16 13:32:19 +02:00
urlwrappers.py Convert super() calls to py3 style 2019-11-26 06:17:04 +09:00
utils.py Rewrite pelican.utils.slugify to use unicode and add tests 2020-04-19 20:10:46 +03:00
writers.py remove pelican.signals in favor of pelican.plugins.signals 2019-12-01 18:14:13 +03:00