mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Preserve category case in importer
Adds a `preserve_case` parameter to the `slugify()` function and uses it to preserve capital letters in category names when using the Pelican importer.
This commit is contained in:
parent
79095f7bd3
commit
8ba00dd9f1
4 changed files with 16 additions and 7 deletions
|
|
@ -634,7 +634,8 @@ def get_out_filename(output_path, filename, ext, kind,
|
|||
typename = ''
|
||||
kind = 'article'
|
||||
if dircat and (len(categories) > 0):
|
||||
catname = slugify(categories[0], regex_subs=slug_subs)
|
||||
catname = slugify(
|
||||
categories[0], regex_subs=slug_subs, preserve_case=True)
|
||||
else:
|
||||
catname = ''
|
||||
out_filename = os.path.join(output_path, typename,
|
||||
|
|
@ -643,7 +644,8 @@ def get_out_filename(output_path, filename, ext, kind,
|
|||
os.makedirs(os.path.join(output_path, typename, catname))
|
||||
# option to put files in directories with categories names
|
||||
elif dircat and (len(categories) > 0):
|
||||
catname = slugify(categories[0], regex_subs=slug_subs)
|
||||
catname = slugify(
|
||||
categories[0], regex_subs=slug_subs, preserve_case=True)
|
||||
out_filename = os.path.join(output_path, catname, filename + ext)
|
||||
if not os.path.isdir(os.path.join(output_path, catname)):
|
||||
os.mkdir(os.path.join(output_path, catname))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue