This commit is contained in:
Alexander Wang 2023-02-18 16:15:14 -08:00
parent 6f81e9b96b
commit 315af7a2c2
No known key found for this signature in database
GPG key ID: D89FA31966BDBECE
2 changed files with 6 additions and 6 deletions

View file

@ -285,19 +285,19 @@ func (c *compiler) compileReserved(attrs *d2graph.Attributes, f *d2ir.Field) {
attrs.Height = &d2graph.Scalar{} attrs.Height = &d2graph.Scalar{}
attrs.Height.Value = scalar.ScalarString() attrs.Height.Value = scalar.ScalarString()
attrs.Height.MapKey = f.LastPrimaryKey() attrs.Height.MapKey = f.LastPrimaryKey()
case "position-top": case "pos-top":
_, err := strconv.Atoi(scalar.ScalarString()) _, err := strconv.Atoi(scalar.ScalarString())
if err != nil { if err != nil {
c.errorf(scalar, "non-integer position-top %#v: %s", scalar.ScalarString(), err) c.errorf(scalar, "non-integer pos-top %#v: %s", scalar.ScalarString(), err)
return return
} }
attrs.Top = &d2graph.Scalar{} attrs.Top = &d2graph.Scalar{}
attrs.Top.Value = scalar.ScalarString() attrs.Top.Value = scalar.ScalarString()
attrs.Top.MapKey = f.LastPrimaryKey() attrs.Top.MapKey = f.LastPrimaryKey()
case "position-left": case "pos-left":
_, err := strconv.Atoi(scalar.ScalarString()) _, err := strconv.Atoi(scalar.ScalarString())
if err != nil { if err != nil {
c.errorf(scalar, "non-integer position-left %#v: %s", scalar.ScalarString(), err) c.errorf(scalar, "non-integer pos-left %#v: %s", scalar.ScalarString(), err)
return return
} }
attrs.Left = &d2graph.Scalar{} attrs.Left = &d2graph.Scalar{}

View file

@ -116,8 +116,8 @@ x: {
{ {
name: "positions", name: "positions",
text: `hey: { text: `hey: {
top: 200 pos-top: 200
left: 230 pos-left: 230
} }
`, `,
assertions: func(t *testing.T, g *d2graph.Graph) { assertions: func(t *testing.T, g *d2graph.Graph) {