feat: interpret usual backslash escapes in quoted include filename
This commit is contained in:
parent
d0028497dc
commit
10f73a4828
@ -91,9 +91,12 @@ is checked for `{! ... !}`.
|
||||
# OK, we have found (the start of) an inclusion and must process it
|
||||
preamble = line[:include_match.start()]
|
||||
remainder = line[include_match.end(1):]
|
||||
doublequoted = False
|
||||
body_pattern = StreamInclusion.include_quoted_file
|
||||
if include_match[2].isspace():
|
||||
body_pattern = StreamInclusion.include_bare_file
|
||||
elif include_match[2] == '"':
|
||||
doublequoted = True
|
||||
body_match = body_pattern.search(remainder)
|
||||
if not body_match:
|
||||
for extra_line in self.input_stream:
|
||||
@ -105,7 +108,12 @@ is checked for `{! ... !}`.
|
||||
errmsg = "semiliterate: End of file while scanning for `!}`"
|
||||
utils.log.error(errmsg)
|
||||
raise EOFError(errmsg)
|
||||
include_path = self.include_root + '/' + body_match['fn']
|
||||
filename = body_match['fn']
|
||||
if doublequoted:
|
||||
filename = (filename.encode('latin-1', 'backslashreplace')
|
||||
.decode('unicode-escape'))
|
||||
include_path = self.include_root + '/' + filename
|
||||
print(f"Including |{include_path}|")
|
||||
new_root = re.match(r'(.*)/', include_path)[1]
|
||||
try:
|
||||
include_parameters = yaml.safe_load(body_match['yml'])
|
||||
|
Loading…
Reference in New Issue
Block a user