Thanks
This commit is contained in:
parent
9b02c153dd
commit
045adcd528
1 changed files with 8 additions and 3 deletions
|
|
@ -75,16 +75,21 @@ def replace_special_content(content):
|
|||
replaced_content = content
|
||||
for pattern, template in patterns:
|
||||
if "CODE" in template:
|
||||
for pattern, template in patterns:
|
||||
if "CODE" in template:
|
||||
current_template = template # Create a local variable that will be properly captured
|
||||
replaced_content = pattern.sub(
|
||||
lambda m: replacer(m, template, "code"), replaced_content
|
||||
lambda m: replacer(m, current_template, "code"), replaced_content
|
||||
)
|
||||
elif "URI" in template:
|
||||
current_template = template
|
||||
replaced_content = pattern.sub(
|
||||
lambda m: replacer(m, template, "uri"), replaced_content
|
||||
lambda m: replacer(m, current_template, "uri"), replaced_content
|
||||
)
|
||||
elif "IMG" in template:
|
||||
current_template = template
|
||||
replaced_content = pattern.sub(
|
||||
lambda m: replacer(m, template, "img"), replaced_content
|
||||
lambda m: replacer(m, current_template, "img"), replaced_content
|
||||
)
|
||||
|
||||
return replaced_content, placeholders
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue