Merge pull request #2731 from avaris/unicode-slugify

Add support for Unicode slugs
This commit is contained in:
Justin Mayer 2020-04-21 05:31:51 +02:00 committed by GitHub
commit 7e24886190
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 141 additions and 40 deletions

View file

@ -320,12 +320,6 @@ Basic settings
A list of default Pygments settings for your reStructuredText code blocks.
See :ref:`internal_pygments_options` for a list of supported options.
.. data:: SLUGIFY_SOURCE = 'title'
Specifies where you want the slug to be automatically generated from. Can be
set to ``title`` to use the 'Title:' metadata tag or ``basename`` to use the
article's file name when creating the slug.
.. data:: CACHE_CONTENT = False
If ``True``, saves content in caches. See
@ -621,6 +615,25 @@ corresponding ``*_URL`` setting as string, while others hard-code them:
``'archives.html'``, ``'authors.html'``, ``'categories.html'``,
``'tags.html'``.
.. data:: SLUGIFY_SOURCE = 'title'
Specifies where you want the slug to be automatically generated from. Can be
set to ``title`` to use the 'Title:' metadata tag or ``basename`` to use the
article's file name when creating the slug.
.. data:: SLUGIFY_USE_UNICODE = False
Allow unicode characters in slugs. Set ``True`` to keep unicode characters
in auto-generated slugs. Otherwise, unicode characters will be replaced
with ASCII equivalents.
.. data:: SLUGIFY_PRESERVE_CASE = False
Preserve uppercase characters in the slugs. Set ``True`` to keep the
uppercase characters in the ``SLUGIFY_SOURCE`` as is.
.. data:: SLUG_REGEX_SUBSTITUTIONS = [
(r'[^\\w\\s-]', ''), # remove non-alphabetical/whitespace/'-' chars
(r'(?u)\\A\\s*', ''), # strip leading whitespace