diff --git a/d2layouts/d2layouts.go b/d2layouts/d2layouts.go index a3001cf4f..8ef99f12e 100644 --- a/d2layouts/d2layouts.go +++ b/d2layouts/d2layouts.go @@ -171,7 +171,7 @@ func NestedGraphInfo(obj *d2graph.Object) (gi GraphInfo) { func ExtractSelf(container *d2graph.Object) *d2graph.Graph { nestedGraph := d2graph.NewGraph() nestedGraph.RootLevel = int(container.Level()) - 1 - // nestedGraph.Root.Box = &geo.Box{} + nestedGraph.Root.Box = &geo.Box{} // separate out nested edges g := container.Graph @@ -217,6 +217,7 @@ func ExtractSelf(container *d2graph.Object) *d2graph.Graph { func ExtractDescendants(container *d2graph.Object) *d2graph.Graph { nestedGraph := d2graph.NewGraph() nestedGraph.RootLevel = int(container.Level()) + nestedGraph.Root.Attributes = container.Attributes nestedGraph.Root.Box = &geo.Box{} // separate out nested edges diff --git a/e2etests/testdata/files/nested_diagram_types.d2 b/e2etests/testdata/files/nested_diagram_types.d2 index 701a8ff53..3333025ff 100644 --- a/e2etests/testdata/files/nested_diagram_types.d2 +++ b/e2etests/testdata/files/nested_diagram_types.d2 @@ -1,47 +1,48 @@ a -b -c +# b +# c a: { grid-rows: 3 1 2 - 3: { - shape: sequence_diagram - x - y - # TODO x -> y - } + 3 + # 3: { + # shape: sequence_diagram + # x + # y + # # TODO x -> y + # } near: top-right } -b: { - shape: sequence_diagram - 1 -> 2 +# b: { +# shape: sequence_diagram +# 1 -> 2 - # TODO This should work - near: bottom-right - # +# # TODO This should work +# near: bottom-right +# # - 2: { - # TODO compile error grid on sequence actor - # grid-rows: 3 - x - y - z - } +# 2: { +# # TODO compile error grid on sequence actor +# # grid-rows: 3 +# x +# y +# z +# } - 1: { - x: { - # TODO compile error grid in sequence (anywhere) - # grid-rows: 3 - u - v - w - } - y - z - } -} +# 1: { +# x: { +# # TODO compile error grid in sequence (anywhere) +# # grid-rows: 3 +# u +# v +# w +# } +# y +# z +# } +# }