From e5b575f3010cdbfa2ef0b703dbd5ba7a606b539c Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Sat, 18 Feb 2023 16:23:27 -0800 Subject: [PATCH] change back --- d2compiler/compile.go | 8 +-- d2compiler/compile_test.go | 4 +- d2graph/d2graph.go | 26 ++++---- e2etests/stable_test.go | 24 +++---- .../dagre/board.exp.json | 20 +++--- .../dagre/sketch.exp.svg | 2 +- .../elk/board.exp.json | 20 +++--- .../elk/sketch.exp.svg | 2 +- .../dagre/board.exp.json | 56 ++++++++-------- .../dagre/sketch.exp.svg | 8 +-- .../elk/board.exp.json | 64 +++++++++---------- .../elk/sketch.exp.svg | 12 ++-- 12 files changed, 123 insertions(+), 123 deletions(-) diff --git a/d2compiler/compile.go b/d2compiler/compile.go index 5a5ebd3ac..df5efd7cd 100644 --- a/d2compiler/compile.go +++ b/d2compiler/compile.go @@ -285,19 +285,19 @@ func (c *compiler) compileReserved(attrs *d2graph.Attributes, f *d2ir.Field) { attrs.Height = &d2graph.Scalar{} attrs.Height.Value = scalar.ScalarString() attrs.Height.MapKey = f.LastPrimaryKey() - case "pos-top": + case "top": _, err := strconv.Atoi(scalar.ScalarString()) if err != nil { - c.errorf(scalar, "non-integer pos-top %#v: %s", scalar.ScalarString(), err) + c.errorf(scalar, "non-integer top %#v: %s", scalar.ScalarString(), err) return } attrs.Top = &d2graph.Scalar{} attrs.Top.Value = scalar.ScalarString() attrs.Top.MapKey = f.LastPrimaryKey() - case "pos-left": + case "left": _, err := strconv.Atoi(scalar.ScalarString()) if err != nil { - c.errorf(scalar, "non-integer pos-left %#v: %s", scalar.ScalarString(), err) + c.errorf(scalar, "non-integer left %#v: %s", scalar.ScalarString(), err) return } attrs.Left = &d2graph.Scalar{} diff --git a/d2compiler/compile_test.go b/d2compiler/compile_test.go index c69c03195..537cec457 100644 --- a/d2compiler/compile_test.go +++ b/d2compiler/compile_test.go @@ -116,8 +116,8 @@ x: { { name: "positions", text: `hey: { - pos-top: 200 - pos-left: 230 + top: 200 + left: 230 } `, assertions: func(t *testing.T, g *d2graph.Graph) { diff --git a/d2graph/d2graph.go b/d2graph/d2graph.go index 4a983d439..30bdedcbf 100644 --- a/d2graph/d2graph.go +++ b/d2graph/d2graph.go @@ -1433,19 +1433,19 @@ var ReservedKeywords2 map[string]struct{} // Non Style/Holder keywords. var SimpleReservedKeywords = map[string]struct{}{ - "label": {}, - "desc": {}, - "shape": {}, - "icon": {}, - "constraint": {}, - "tooltip": {}, - "link": {}, - "near": {}, - "width": {}, - "height": {}, - "direction": {}, - "position-top": {}, - "position-left": {}, + "label": {}, + "desc": {}, + "shape": {}, + "icon": {}, + "constraint": {}, + "tooltip": {}, + "link": {}, + "near": {}, + "width": {}, + "height": {}, + "direction": {}, + "top": {}, + "left": {}, } // ReservedKeywordHolders are reserved keywords that are meaningless on its own and exist solely to hold a set of reserved keywords diff --git a/e2etests/stable_test.go b/e2etests/stable_test.go index a95a58450..a2d38b57f 100644 --- a/e2etests/stable_test.go +++ b/e2etests/stable_test.go @@ -165,9 +165,9 @@ d -> g.e -> f -> g -> d.h }, { name: "one_three_one_container", - script: `top.start -> a -top.start -> b -top.start -> c + script: `top2.start -> a +top2.start -> b +top2.start -> c a -> bottom.end b -> bottom.end c -> bottom.end @@ -1576,13 +1576,13 @@ container: { icon: https://icons.terrastruct.com/essentials/004-picture.svg } - left: { + left2: { root: { shape: image icon: https://icons.terrastruct.com/essentials/004-picture.svg } inner: { - left: { + left2: { shape: image icon: https://icons.terrastruct.com/essentials/004-picture.svg } @@ -1591,8 +1591,8 @@ container: { icon: https://icons.terrastruct.com/essentials/004-picture.svg } } - root -> inner.left: { - label: to inner left + root -> inner.left2: { + label: to inner left2 } root -> inner.right: { label: to inner right @@ -1605,7 +1605,7 @@ container: { icon: https://icons.terrastruct.com/essentials/004-picture.svg } inner: { - left: { + left2: { shape: image icon: https://icons.terrastruct.com/essentials/004-picture.svg } @@ -1614,16 +1614,16 @@ container: { icon: https://icons.terrastruct.com/essentials/004-picture.svg } } - root -> inner.left: { - label: to inner left + root -> inner.left2: { + label: to inner left2 } root -> inner.right: { label: to inner right } } - root -> left.root: { - label: to left container root + root -> left2.root: { + label: to left2 container root } root -> right.root: { diff --git a/e2etests/testdata/stable/one_three_one_container/dagre/board.exp.json b/e2etests/testdata/stable/one_three_one_container/dagre/board.exp.json index 3dd278592..7be26b11e 100644 --- a/e2etests/testdata/stable/one_three_one_container/dagre/board.exp.json +++ b/e2etests/testdata/stable/one_three_one_container/dagre/board.exp.json @@ -3,7 +3,7 @@ "fontFamily": "SourceSansPro", "shapes": [ { - "id": "top", + "id": "top2", "type": "rectangle", "pos": { "x": 0, @@ -29,7 +29,7 @@ "fields": null, "methods": null, "columns": null, - "label": "top", + "label": "top2", "fontSize": 28, "fontFamily": "DEFAULT", "language": "", @@ -37,14 +37,14 @@ "italic": false, "bold": false, "underline": false, - "labelWidth": 40, + "labelWidth": 54, "labelHeight": 36, "labelPosition": "OUTSIDE_TOP_CENTER", "zIndex": 0, "level": 1 }, { - "id": "top.start", + "id": "top2.start", "type": "rectangle", "pos": { "x": 123, @@ -292,8 +292,8 @@ ], "connections": [ { - "id": "(top.start -> a)[0]", - "src": "top.start", + "id": "(top2.start -> a)[0]", + "src": "top2.start", "srcArrow": "none", "srcLabel": "", "dst": "a", @@ -340,8 +340,8 @@ "zIndex": 0 }, { - "id": "(top.start -> b)[0]", - "src": "top.start", + "id": "(top2.start -> b)[0]", + "src": "top2.start", "srcArrow": "none", "srcLabel": "", "dst": "b", @@ -388,8 +388,8 @@ "zIndex": 0 }, { - "id": "(top.start -> c)[0]", - "src": "top.start", + "id": "(top2.start -> c)[0]", + "src": "top2.start", "srcArrow": "none", "srcLabel": "", "dst": "c", diff --git a/e2etests/testdata/stable/one_three_one_container/dagre/sketch.exp.svg b/e2etests/testdata/stable/one_three_one_container/dagre/sketch.exp.svg index c5bbec41f..614384cb9 100644 --- a/e2etests/testdata/stable/one_three_one_container/dagre/sketch.exp.svg +++ b/e2etests/testdata/stable/one_three_one_container/dagre/sketch.exp.svg @@ -39,7 +39,7 @@ width="530" height="800" viewBox="-102 -100 530 800">