When using {! !} to insert a value in the file, it now escapes special
HTML characters.
import re
import tomllib
import time
import re
import tomllib
import time
else:
varspace = namespace + tuple(varspace)
repl_value = str(get_value(data, varspace[:-1], varspace[-1], False))
else:
varspace = namespace + tuple(varspace)
repl_value = str(get_value(data, varspace[:-1], varspace[-1], False))
+ repl_value = html.escape(repl_value)
start_pos = variable.start() + len(repl_value)
regex_variable_no_interpret.search(file_value, start_pos)
start_pos = variable.start() + len(repl_value)
regex_variable_no_interpret.search(file_value, start_pos)
- file_value = file_value.replace(
- variable.group(0),
- str(get_value(data, varspace[:-1], varspace[-1], False)),
- 1,
- )
+ file_value = file_value.replace(variable.group(0), repl_value, 1)