The underlying issue is the fact that node.c_sorted_children and node.children are not consistent when the documentation is generated. node.c_sorted_children is generated at the start of the handle_file function in layout.layout_cheby(t), but node.children is updated afterwards in expand_hdl.expand_hdl. Eventually, the HTML/Markdown generation crashes because some nodes don't have the c_name attribute:
File "python3.10/site-packages/cheby-1.6.dev0-py3.10.egg/cheby/print_markdown.py", line 79, in print_root
File "python3.10/site-packages/cheby-1.6.dev0-py3.10.egg/cheby/print_markdown.py", line 56, in print_map_summary
AttributeError: 'Block' object has no attribute 'c_name'. Did you mean: 'name'?
To fix this, I've added a function that re-generates the node.c_sorted_children in handle_file after unrolling. It might also make sense to add this call at the end of expand_hdl instead. It was also necessary to allow None for c_address, as this case occurs during the tests (not sure if this is intentional).
@tgingold-cern please let me know what you think.
Changes:
Re-generate node.c_sorted_children after unrolling repeat blocks.
Add a test based on Issue 67 to verify the correct behaviour in this case.
This MR is supposed to fix an issue when generating documentation for a block that has nested repeat blocks (see https://gitlab.cern.ch/be-cem-edl/common/cheby/-/issues/67 for an example).
The underlying issue is the fact that
node.c_sorted_children
andnode.children
are not consistent when the documentation is generated.node.c_sorted_children
is generated at the start of thehandle_file
function inlayout.layout_cheby(t)
, butnode.children
is updated afterwards inexpand_hdl.expand_hdl
. Eventually, the HTML/Markdown generation crashes because some nodes don't have thec_name
attribute:To fix this, I've added a function that re-generates the
node.c_sorted_children
inhandle_file
after unrolling. It might also make sense to add this call at the end ofexpand_hdl
instead. It was also necessary to allow None forc_address
, as this case occurs during the tests (not sure if this is intentional).@tgingold-cern please let me know what you think.
Changes:
node.c_sorted_children
after unrolling repeat blocks.Resolves https://gitlab.cern.ch/be-cem-edl/common/cheby/-/issues/67