mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Expose use_unicode setting of slugify in settings and use it
This commit is contained in:
parent
03d9c38871
commit
97fe235e60
5 changed files with 48 additions and 24 deletions
|
|
@ -92,16 +92,17 @@ class Content(object):
|
|||
if not hasattr(self, 'slug'):
|
||||
if (settings['SLUGIFY_SOURCE'] == 'title' and
|
||||
hasattr(self, 'title')):
|
||||
self.slug = slugify(
|
||||
self.title,
|
||||
regex_subs=settings.get('SLUG_REGEX_SUBSTITUTIONS', []))
|
||||
value = self.title
|
||||
elif (settings['SLUGIFY_SOURCE'] == 'basename' and
|
||||
source_path is not None):
|
||||
basename = os.path.basename(
|
||||
os.path.splitext(source_path)[0])
|
||||
value = os.path.basename(os.path.splitext(source_path)[0])
|
||||
else:
|
||||
value = None
|
||||
if value is not None:
|
||||
self.slug = slugify(
|
||||
basename,
|
||||
regex_subs=settings.get('SLUG_REGEX_SUBSTITUTIONS', []))
|
||||
value,
|
||||
regex_subs=settings.get('SLUG_REGEX_SUBSTITUTIONS', []),
|
||||
use_unicode=settings['SLUGIFY_USE_UNICODE'])
|
||||
|
||||
self.source_path = source_path
|
||||
self.relative_source_path = self.get_relative_source_path()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue