Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: generalize dot attributes #283

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/rebdhuhn/graphviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ def convert_graph_to_dot(ebd_graph: EbdGraph) -> str:
f'<B><FONT POINT-SIZE="18">{ebd_graph.metadata.chapter}</FONT></B><BR/><BR/>'
f'<B><FONT POINT-SIZE="16">{ebd_graph.metadata.sub_chapter}</FONT></B><BR/><BR/><BR/><BR/>'
)
dot_code = "digraph D {\n" f'{ADD_INDENT}labelloc="t";\n{ADD_INDENT}label=<{header}>;\n'
dot_attributes: dict[str, str] = {f"'{ADD_INDENT}labelloc": '"t"', "label": f"<{header}>"}
dot_code = "digraph D {\n"
for dot_attr_key, dot_attr_value in dot_attributes.items():
dot_code += f"{dot_attr_key}={dot_attr_value};\n"
assert len(nx_graph["Start"]) == 1, "Start node must have exactly one outgoing edge."
dot_code += _convert_nodes_to_dot(ebd_graph, ADD_INDENT) + "\n\n"
dot_code += "\n".join(_convert_edges_to_dot(ebd_graph, ADD_INDENT)) + "\n"
Expand Down