commit
4e85eb711c
4 changed files with 80 additions and 0 deletions
|
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
- Compiler:
|
- Compiler:
|
||||||
- fixes panic when `sql_shape` shape value had mixed casing [#2349](https://github.com/terrastruct/d2/pull/2349)
|
- fixes panic when `sql_shape` shape value had mixed casing [#2349](https://github.com/terrastruct/d2/pull/2349)
|
||||||
|
- fixes panic when importing from a file with spread substitutions in `vars` [#2427](https://github.com/terrastruct/d2/pull/2427)
|
||||||
- fixes support for `center` in `d2-config` [#2360](https://github.com/terrastruct/d2/pull/2360)
|
- fixes support for `center` in `d2-config` [#2360](https://github.com/terrastruct/d2/pull/2360)
|
||||||
- fixes panic when comment lines appear in arrays [#2378](https://github.com/terrastruct/d2/pull/2378)
|
- fixes panic when comment lines appear in arrays [#2378](https://github.com/terrastruct/d2/pull/2378)
|
||||||
- fixes inconsistencies when objects were double quoted [#2390](https://github.com/terrastruct/d2/pull/2390)
|
- fixes inconsistencies when objects were double quoted [#2390](https://github.com/terrastruct/d2/pull/2390)
|
||||||
|
|
|
||||||
|
|
@ -3125,6 +3125,24 @@ x*: {
|
||||||
tassert.Equal(t, "x2.ok", g.Objects[3].AbsID())
|
tassert.Equal(t, "x2.ok", g.Objects[3].AbsID())
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "import-var-chain",
|
||||||
|
|
||||||
|
text: `...@dev
|
||||||
|
`,
|
||||||
|
files: map[string]string{
|
||||||
|
"dev.d2": `
|
||||||
|
vars: {
|
||||||
|
a: {
|
||||||
|
b
|
||||||
|
}
|
||||||
|
c: {
|
||||||
|
...${a}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "var_in_markdown",
|
name: "var_in_markdown",
|
||||||
text: `vars: {
|
text: `vars: {
|
||||||
|
|
|
||||||
|
|
@ -1134,6 +1134,10 @@ func (c *compiler) extendLinks(m *Map, importF *Field, importDir string) {
|
||||||
nodeBoardKind := NodeBoardKind(m)
|
nodeBoardKind := NodeBoardKind(m)
|
||||||
importIDA := IDA(importF)
|
importIDA := IDA(importF)
|
||||||
for _, f := range m.Fields {
|
for _, f := range m.Fields {
|
||||||
|
// A substitute or such
|
||||||
|
if f.Name == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if f.Name.ScalarString() == "link" && f.Name.IsUnquoted() {
|
if f.Name.ScalarString() == "link" && f.Name.IsUnquoted() {
|
||||||
if nodeBoardKind != "" {
|
if nodeBoardKind != "" {
|
||||||
c.errorf(f.LastRef().AST(), "a board itself cannot be linked; only objects within a board can be linked")
|
c.errorf(f.LastRef().AST(), "a board itself cannot be linked; only objects within a board can be linked")
|
||||||
|
|
|
||||||
57
testdata/d2compiler/TestCompile/import-var-chain.exp.json
generated
vendored
Normal file
57
testdata/d2compiler/TestCompile/import-var-chain.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
{
|
||||||
|
"graph": {
|
||||||
|
"name": "",
|
||||||
|
"isFolderOnly": true,
|
||||||
|
"ast": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-var-chain.d2,0:0:0-1:0:8",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"import": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-var-chain.d2,0:0:0-0:7:7",
|
||||||
|
"spread": true,
|
||||||
|
"pre": "",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-var-chain.d2,0:4:4-0:7:7",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "dev",
|
||||||
|
"raw_string": "dev"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"id": "",
|
||||||
|
"id_val": "",
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
"edges": null,
|
||||||
|
"objects": null
|
||||||
|
},
|
||||||
|
"err": null
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue