forked from github/pelican
Merge pull request #2015 from jpli/improve_path_metadata_processing
Improve path metadata processing
This commit is contained in:
commit
22861aa1c1
1 changed files with 2 additions and 2 deletions
|
|
@ -659,15 +659,15 @@ def parse_path_metadata(source_path, settings=None, process=None):
|
|||
('PATH_METADATA', source_path)]:
|
||||
checks.append((settings.get(key, None), data))
|
||||
if settings.get('USE_FOLDER_AS_CATEGORY', None):
|
||||
checks.insert(0, ('(?P<category>.*)', subdir))
|
||||
checks.append(('(?P<category>.*)', subdir))
|
||||
for regexp, data in checks:
|
||||
if regexp and data:
|
||||
match = re.match(regexp, data)
|
||||
if match:
|
||||
# .items() for py3k compat.
|
||||
for k, v in match.groupdict().items():
|
||||
k = k.lower() # metadata must be lowercase
|
||||
if k not in metadata:
|
||||
k = k.lower() # metadata must be lowercase
|
||||
if process:
|
||||
v = process(k, v)
|
||||
metadata[k] = v
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue