mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Merge e061f2756e into 6fcb6d3766
This commit is contained in:
commit
a2447adc4d
1 changed files with 3 additions and 3 deletions
|
|
@ -367,6 +367,7 @@ def read_file(path, fmt=None, settings=None):
|
|||
|
||||
return content, metadata
|
||||
|
||||
|
||||
def parse_path_metadata(path, settings=None, process=None):
|
||||
"""Extract a metadata dictionary from a file's path
|
||||
|
||||
|
|
@ -389,9 +390,8 @@ def parse_path_metadata(path, settings=None, process=None):
|
|||
metadata = {}
|
||||
base, ext = os.path.splitext(os.path.basename(path))
|
||||
if settings:
|
||||
for key,data in [('FILENAME_METADATA', base),
|
||||
('PATH_METADATA', path),
|
||||
]:
|
||||
items = [('FILENAME_METADATA', base), ('PATH_METADATA', path), ]
|
||||
for key, data in items:
|
||||
regexp = settings.get(key)
|
||||
if regexp:
|
||||
match = re.match(regexp, data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue