2022-11-28 02:21:50PM

This commit is contained in:
Alexander Wang 2022-11-28 14:21:50 -08:00
parent 1796dd9020
commit 3e6b3490bc
No known key found for this signature in database
GPG key ID: D89FA31966BDBECE
2 changed files with 52 additions and 52 deletions

View file

@ -1505,20 +1505,20 @@ dst.id <-> src.dst_id
name: "basic_sequence", name: "basic_sequence",
text: `x: { text: `x: {
shape: sequence shape: sequence_diagram
} }
`, `,
assertions: func(t *testing.T, g *d2graph.Graph) { assertions: func(t *testing.T, g *d2graph.Graph) {
diff.AssertStringEq(t, "sequence", g.Objects[0].Attributes.Shape.Value) diff.AssertStringEq(t, "sequence_diagram", g.Objects[0].Attributes.Shape.Value)
}, },
}, },
{ {
name: "root_sequence", name: "root_sequence",
text: `shape: sequence text: `shape: sequence_diagram
`, `,
assertions: func(t *testing.T, g *d2graph.Graph) { assertions: func(t *testing.T, g *d2graph.Graph) {
diff.AssertStringEq(t, "sequence", g.Root.Attributes.Shape.Value) diff.AssertStringEq(t, "sequence_diagram", g.Root.Attributes.Shape.Value)
}, },
}, },
} }

View file

@ -255,29 +255,29 @@ func NewPoint(x, y int) Point {
} }
const ( const (
ShapeRectangle = "rectangle" ShapeRectangle = "rectangle"
ShapeSquare = "square" ShapeSquare = "square"
ShapePage = "page" ShapePage = "page"
ShapeParallelogram = "parallelogram" ShapeParallelogram = "parallelogram"
ShapeDocument = "document" ShapeDocument = "document"
ShapeCylinder = "cylinder" ShapeCylinder = "cylinder"
ShapeQueue = "queue" ShapeQueue = "queue"
ShapePackage = "package" ShapePackage = "package"
ShapeStep = "step" ShapeStep = "step"
ShapeCallout = "callout" ShapeCallout = "callout"
ShapeStoredData = "stored_data" ShapeStoredData = "stored_data"
ShapePerson = "person" ShapePerson = "person"
ShapeDiamond = "diamond" ShapeDiamond = "diamond"
ShapeOval = "oval" ShapeOval = "oval"
ShapeCircle = "circle" ShapeCircle = "circle"
ShapeHexagon = "hexagon" ShapeHexagon = "hexagon"
ShapeCloud = "cloud" ShapeCloud = "cloud"
ShapeText = "text" ShapeText = "text"
ShapeCode = "code" ShapeCode = "code"
ShapeClass = "class" ShapeClass = "class"
ShapeSQLTable = "sql_table" ShapeSQLTable = "sql_table"
ShapeImage = "image" ShapeImage = "image"
ShapeSequence = "sequence" ShapeSequenceDiagram = "sequence_diagram"
) )
var Shapes = []string{ var Shapes = []string{
@ -303,7 +303,7 @@ var Shapes = []string{
ShapeClass, ShapeClass,
ShapeSQLTable, ShapeSQLTable,
ShapeImage, ShapeImage,
ShapeSequence, ShapeSequenceDiagram,
} }
func IsShape(s string) bool { func IsShape(s string) bool {
@ -347,30 +347,30 @@ func (text MText) GetColor(theme *d2themes.Theme, isItalic bool) string {
} }
var DSL_SHAPE_TO_SHAPE_TYPE = map[string]string{ var DSL_SHAPE_TO_SHAPE_TYPE = map[string]string{
"": shape.SQUARE_TYPE, "": shape.SQUARE_TYPE,
ShapeRectangle: shape.SQUARE_TYPE, ShapeRectangle: shape.SQUARE_TYPE,
ShapeSquare: shape.REAL_SQUARE_TYPE, ShapeSquare: shape.REAL_SQUARE_TYPE,
ShapePage: shape.PAGE_TYPE, ShapePage: shape.PAGE_TYPE,
ShapeParallelogram: shape.PARALLELOGRAM_TYPE, ShapeParallelogram: shape.PARALLELOGRAM_TYPE,
ShapeDocument: shape.DOCUMENT_TYPE, ShapeDocument: shape.DOCUMENT_TYPE,
ShapeCylinder: shape.CYLINDER_TYPE, ShapeCylinder: shape.CYLINDER_TYPE,
ShapeQueue: shape.QUEUE_TYPE, ShapeQueue: shape.QUEUE_TYPE,
ShapePackage: shape.PACKAGE_TYPE, ShapePackage: shape.PACKAGE_TYPE,
ShapeStep: shape.STEP_TYPE, ShapeStep: shape.STEP_TYPE,
ShapeCallout: shape.CALLOUT_TYPE, ShapeCallout: shape.CALLOUT_TYPE,
ShapeStoredData: shape.STORED_DATA_TYPE, ShapeStoredData: shape.STORED_DATA_TYPE,
ShapePerson: shape.PERSON_TYPE, ShapePerson: shape.PERSON_TYPE,
ShapeDiamond: shape.DIAMOND_TYPE, ShapeDiamond: shape.DIAMOND_TYPE,
ShapeOval: shape.OVAL_TYPE, ShapeOval: shape.OVAL_TYPE,
ShapeCircle: shape.CIRCLE_TYPE, ShapeCircle: shape.CIRCLE_TYPE,
ShapeHexagon: shape.HEXAGON_TYPE, ShapeHexagon: shape.HEXAGON_TYPE,
ShapeCloud: shape.CLOUD_TYPE, ShapeCloud: shape.CLOUD_TYPE,
ShapeText: shape.TEXT_TYPE, ShapeText: shape.TEXT_TYPE,
ShapeCode: shape.CODE_TYPE, ShapeCode: shape.CODE_TYPE,
ShapeClass: shape.CLASS_TYPE, ShapeClass: shape.CLASS_TYPE,
ShapeSQLTable: shape.TABLE_TYPE, ShapeSQLTable: shape.TABLE_TYPE,
ShapeImage: shape.IMAGE_TYPE, ShapeImage: shape.IMAGE_TYPE,
ShapeSequence: shape.SQUARE_TYPE, ShapeSequenceDiagram: shape.SQUARE_TYPE,
} }
var SHAPE_TYPE_TO_DSL_SHAPE map[string]string var SHAPE_TYPE_TO_DSL_SHAPE map[string]string