Add suggestion by @kvid
This commit is contained in:
parent
0a59e97d29
commit
d00cc8362d
@ -45,11 +45,11 @@ def parse(yaml_input: str, base_path: (str, Path) = None, file_out: (str, Path)
|
|||||||
if len(yaml_data[sec]) > 0:
|
if len(yaml_data[sec]) > 0:
|
||||||
if ty == dict:
|
if ty == dict:
|
||||||
for key, attribs in yaml_data[sec].items():
|
for key, attribs in yaml_data[sec].items():
|
||||||
if attribs.get('image'):
|
image = attribs.get('image')
|
||||||
image_path = attribs['image']['src']
|
if isinstance(image, dict):
|
||||||
if not Path(image_path).is_absolute(): # resolve relative image path
|
image_path = image['src']
|
||||||
image_path = (Path(base_path) / image_path).resolve()
|
if image_path and not Path(image_path).is_absolute(): # resolve relative image path
|
||||||
attribs['image']['src'] = image_path
|
image['src'] = (Path(base_path) / image_path).resolve()
|
||||||
|
|
||||||
if sec == 'connectors':
|
if sec == 'connectors':
|
||||||
if not attribs.get('autogenerate', False):
|
if not attribs.get('autogenerate', False):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user