This commit is contained in:
CodeRabbit 2025-03-30 19:07:09 +00:00 committed by Russell Ballestrini
parent 9b02c153dd
commit 045adcd528

View file

@ -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