Skip to content
Snippets Groups Projects
Commit 8b00c8a6 authored by Bryan Brancotte's avatar Bryan Brancotte
Browse files

quoting labels to prevent error with symbole equal in labels

parent dfcb3616
No related branches found
No related tags found
1 merge request!3Improvements related to mermaid
Pipeline #13116 passed with stage
in 45 seconds
......@@ -45,22 +45,28 @@ def generate_graph_mermaid(filename, dico, label_node = True, label_edge = True,
import re
for match in re.finditer(r"object at (\w+)>", txt):
return match.group(1)
def quoted(label):
if not label.strip():
return label
return f'"{label}"'
def get_graph_wo_operations_mermaid_temp(dico, txt, count):
count+=1
for node in dico["nodes"]:
tab= count*"\t"
if(node['name']==''):
if(label_node):
txt+=f"{tab}{get_id(node['id'])}(({node['xlabel']}));\n"
txt+=f"{tab}{get_id(node['id'])}(({quoted(node['xlabel'])}));\n"
else:
txt+=f"{tab}{get_id(node['id'])}(({' '}));\n"
else:
txt+=f"{tab}{get_id(node['id'])}({node['name']});\n"
txt+=f"{tab}{get_id(node['id'])}({quoted(node['name'])});\n"
for edge in dico["edges"]:
tab= count*"\t"
if(label_edge):
txt+=f"{tab}{get_id(edge['A'])}--{edge['label']}-->{get_id(edge['B'])};\n"
txt+=f"{tab}{get_id(edge['A'])}--{quoted(edge['label'])}-->{get_id(edge['B'])};\n"
else:
txt+=f"{tab}{get_id(edge['A'])}-->{get_id(edge['B'])};\n"
for subworkflow in dico["subworkflows"]:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment