in pelican/plugins/asfgenid.py [0:0]
def expand_metadata(tag, metadata, debug):
this_string = str(tag.string)
m = 1
modified = False
while m:
m = METADATA_RE.search(this_string)
if m:
this_data = m.group(1).strip()
format_string = '{{{0}}}'.format(this_data)
try:
new_string = format_string.format(**metadata)
if debug:
print(f'{{{{{m.group(1)}}}}} -> {new_string}')
except Exception:
# the data expression was not found
print(f'{{{{{m.group(1)}}}}} is not found')
new_string = format_string
# replace the first pattern with the new_string
this_string = re.sub(METADATA_RE, new_string, this_string, count=1)
modified = True
if modified:
tag.string.replace_with(this_string)