This commit is contained in:
Alexander Wang 2023-02-18 16:10:44 -08:00
parent 641a6741ff
commit 6f81e9b96b
No known key found for this signature in database
GPG key ID: D89FA31966BDBECE
2 changed files with 17 additions and 17 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 "top": case "position-top":
_, err := strconv.Atoi(scalar.ScalarString()) _, err := strconv.Atoi(scalar.ScalarString())
if err != nil { if err != nil {
c.errorf(scalar, "non-integer top %#v: %s", scalar.ScalarString(), err) c.errorf(scalar, "non-integer position-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 "left": case "position-left":
_, err := strconv.Atoi(scalar.ScalarString()) _, err := strconv.Atoi(scalar.ScalarString())
if err != nil { if err != nil {
c.errorf(scalar, "non-integer left %#v: %s", scalar.ScalarString(), err) c.errorf(scalar, "non-integer position-left %#v: %s", scalar.ScalarString(), err)
return return
} }
attrs.Left = &d2graph.Scalar{} attrs.Left = &d2graph.Scalar{}

View file

@ -1433,19 +1433,19 @@ var ReservedKeywords2 map[string]struct{}
// Non Style/Holder keywords. // Non Style/Holder keywords.
var SimpleReservedKeywords = map[string]struct{}{ var SimpleReservedKeywords = map[string]struct{}{
"label": {}, "label": {},
"desc": {}, "desc": {},
"shape": {}, "shape": {},
"icon": {}, "icon": {},
"constraint": {}, "constraint": {},
"tooltip": {}, "tooltip": {},
"link": {}, "link": {},
"near": {}, "near": {},
"width": {}, "width": {},
"height": {}, "height": {},
"direction": {}, "direction": {},
"top": {}, "position-top": {},
"left": {}, "position-left": {},
} }
// ReservedKeywordHolders are reserved keywords that are meaningless on its own and exist solely to hold a set of reserved keywords // ReservedKeywordHolders are reserved keywords that are meaningless on its own and exist solely to hold a set of reserved keywords