From bac73e2f29454c4b1471c4c7d0f835dddf405482 Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Thu, 30 Mar 2023 17:37:55 -0700 Subject: [PATCH 1/3] link SVGs --- ci/release/changelogs/next.md | 2 + d2cli/main.go | 102 +++++++++++++++ e2etests-cli/main_test.go | 27 ++++ .../TestCLI_E2E/internal_linked_pdf.exp.pdf | Bin 79806 -> 79806 bytes .../linked-path/cat/big cat.exp.svg | 102 +++++++++++++++ .../TestCLI_E2E/linked-path/cat/index.exp.svg | 117 ++++++++++++++++++ .../TestCLI_E2E/linked-path/index.exp.svg | 110 ++++++++++++++++ 7 files changed, 460 insertions(+) create mode 100644 e2etests-cli/testdata/TestCLI_E2E/linked-path/cat/big cat.exp.svg create mode 100644 e2etests-cli/testdata/TestCLI_E2E/linked-path/cat/index.exp.svg create mode 100644 e2etests-cli/testdata/TestCLI_E2E/linked-path/index.exp.svg diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index 4aa513a11..a312ab5be 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -1,5 +1,7 @@ #### Features ๐Ÿš€ +- Multi-board SVG outputs with internal links go to their output paths [#1116](https://github.com/terrastruct/d2/pull/1116) + #### Improvements ๐Ÿงน #### Bugfixes โ›‘๏ธ diff --git a/d2cli/main.go b/d2cli/main.go index ae2446c95..400d81aa5 100644 --- a/d2cli/main.go +++ b/d2cli/main.go @@ -358,6 +358,15 @@ func compile(ctx context.Context, ms *xmain.State, plugin d2plugin.Plugin, rende return pdf, true, nil } else { compileDur := time.Since(start) + if animateInterval <= 0 { + // Rename all the "root.layers.x" to the paths that the boards get output to + linkToOutput, err := resolveLinks("root", outputPath, diagram) + if err != nil { + return nil, false, err + } + relink(diagram, linkToOutput) + } + boards, err := render(ctx, ms, compileDur, plugin, renderOpts, inputPath, outputPath, bundle, forceAppendix, page, ruler, diagram) if err != nil { return nil, false, err @@ -382,6 +391,99 @@ func compile(ctx context.Context, ms *xmain.State, plugin d2plugin.Plugin, rende } } +func resolveLinks(currDiagramPath, outputPath string, diagram *d2target.Diagram) (linkToOutput map[string]string, err error) { + if diagram.Name != "" { + ext := filepath.Ext(outputPath) + outputPath = strings.TrimSuffix(outputPath, ext) + outputPath = filepath.Join(outputPath, diagram.Name) + outputPath += ext + } + + boardOutputPath := outputPath + if len(diagram.Layers) > 0 || len(diagram.Scenarios) > 0 || len(diagram.Steps) > 0 { + ext := filepath.Ext(boardOutputPath) + boardOutputPath = strings.TrimSuffix(boardOutputPath, ext) + boardOutputPath = filepath.Join(boardOutputPath, "index") + boardOutputPath += ext + } + + layersOutputPath := outputPath + if len(diagram.Scenarios) > 0 || len(diagram.Steps) > 0 { + ext := filepath.Ext(layersOutputPath) + layersOutputPath = strings.TrimSuffix(layersOutputPath, ext) + layersOutputPath = filepath.Join(layersOutputPath, "layers") + layersOutputPath += ext + } + scenariosOutputPath := outputPath + if len(diagram.Layers) > 0 || len(diagram.Steps) > 0 { + ext := filepath.Ext(scenariosOutputPath) + scenariosOutputPath = strings.TrimSuffix(scenariosOutputPath, ext) + scenariosOutputPath = filepath.Join(scenariosOutputPath, "scenarios") + scenariosOutputPath += ext + } + stepsOutputPath := outputPath + if len(diagram.Layers) > 0 || len(diagram.Scenarios) > 0 { + ext := filepath.Ext(stepsOutputPath) + stepsOutputPath = strings.TrimSuffix(stepsOutputPath, ext) + stepsOutputPath = filepath.Join(stepsOutputPath, "steps") + stepsOutputPath += ext + } + + linkToOutput = map[string]string{currDiagramPath: boardOutputPath} + + for _, dl := range diagram.Layers { + m, err := resolveLinks(strings.Join([]string{currDiagramPath, "layers", dl.Name}, "."), layersOutputPath, dl) + if err != nil { + return nil, err + } + for k, v := range m { + linkToOutput[k] = v + } + } + for _, dl := range diagram.Scenarios { + m, err := resolveLinks(strings.Join([]string{currDiagramPath, "scenarios", dl.Name}, "."), scenariosOutputPath, dl) + if err != nil { + return nil, err + } + for k, v := range m { + linkToOutput[k] = v + } + } + for _, dl := range diagram.Steps { + m, err := resolveLinks(strings.Join([]string{currDiagramPath, "steps", dl.Name}, "."), stepsOutputPath, dl) + if err != nil { + return nil, err + } + for k, v := range m { + linkToOutput[k] = v + } + } + + return linkToOutput, nil +} + +func relink(d *d2target.Diagram, linkToOutput map[string]string) { + for i, shape := range d.Shapes { + if shape.Link != "" { + for k, v := range linkToOutput { + if shape.Link == k { + d.Shapes[i].Link = v + break + } + } + } + } + for _, board := range d.Layers { + relink(board, linkToOutput) + } + for _, board := range d.Scenarios { + relink(board, linkToOutput) + } + for _, board := range d.Steps { + relink(board, linkToOutput) + } +} + func render(ctx context.Context, ms *xmain.State, compileDur time.Duration, plugin d2plugin.Plugin, opts d2svg.RenderOpts, inputPath, outputPath string, bundle, forceAppendix bool, page playwright.Page, ruler *textmeasure.Ruler, diagram *d2target.Diagram) ([][]byte, error) { if diagram.Name != "" { ext := filepath.Ext(outputPath) diff --git a/e2etests-cli/main_test.go b/e2etests-cli/main_test.go index 402ce7f3e..6bad9de65 100644 --- a/e2etests-cli/main_test.go +++ b/e2etests-cli/main_test.go @@ -82,6 +82,33 @@ steps: { assert.Testdata(t, ".svg", svg) }, }, + { + name: "linked-path", + run: func(t *testing.T, ctx context.Context, dir string, env *xos.Env) { + writeFile(t, dir, "linked.d2", `cat: how does the cat go? { + link: layers.cat +} +layers: { + cat: { + home: { + link: _ + } + the cat -> meow: goes + + scenarios: { + big cat: { + the cat -> roar: goes + } + } + } +} +`) + err := runTestMain(t, ctx, dir, env, "linked.d2") + assert.Success(t, err) + + assert.TestdataDir(t, filepath.Join(dir, "linked")) + }, + }, { name: "with-font", run: func(t *testing.T, ctx context.Context, dir string, env *xos.Env) { diff --git a/e2etests-cli/testdata/TestCLI_E2E/internal_linked_pdf.exp.pdf b/e2etests-cli/testdata/TestCLI_E2E/internal_linked_pdf.exp.pdf index 5842a8b8322292906d49fe674a0848520145d1b0..4f63dfc5b51fe766a5db6c7827f6364ba9411423 100644 GIT binary patch delta 191 zcmdn@o@L*AmJQ|dlkd%3JXunKfAfS{E0ZT%6&e5qR5thi+hsC&-AseYS%u1zXUW$y znrxO*PzaoC`Ojc;R-uc=ba!J$=jnTl8TF@k7&978e{IZY&1gJb-GtGQ(QtaC31gay zv4Nq9iIJ(9CYQc%eu_(CNveW|iOm6#Q6Gl@eU1MW&6H^5P5Kzcd-~uyD V%#DrA(ZtLwj1A1DyP7jr0sv(`I`04g delta 193 zcmdn@o@L*AmJQ|dlLdAznk=Qjzxm)!p}@(Pnhk&g%G=er85K1qKiFX~xmthe catroar goes + + + diff --git a/e2etests-cli/testdata/TestCLI_E2E/linked-path/cat/index.exp.svg b/e2etests-cli/testdata/TestCLI_E2E/linked-path/cat/index.exp.svg new file mode 100644 index 000000000..0e66f755b --- /dev/null +++ b/e2etests-cli/testdata/TestCLI_E2E/linked-path/cat/index.exp.svg @@ -0,0 +1,117 @@ +home + + + + + + + + + + + +the catmeow goes + + + diff --git a/e2etests-cli/testdata/TestCLI_E2E/linked-path/index.exp.svg b/e2etests-cli/testdata/TestCLI_E2E/linked-path/index.exp.svg new file mode 100644 index 000000000..c5328ae3b --- /dev/null +++ b/e2etests-cli/testdata/TestCLI_E2E/linked-path/index.exp.svg @@ -0,0 +1,110 @@ +how does the cat go? + + + + + + + + + + + + + + + From 1e7e44ed45d3b64631a06508bb08aa87a7eaad5d Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Thu, 30 Mar 2023 20:27:02 -0700 Subject: [PATCH 2/3] test --- .../TestCLI_E2E/linked-path/cat/index.exp.svg | 164 +++++++++--------- .../TestCLI_E2E/linked-path/index.exp.svg | 156 ++++++++--------- 2 files changed, 160 insertions(+), 160 deletions(-) diff --git a/e2etests-cli/testdata/TestCLI_E2E/linked-path/cat/index.exp.svg b/e2etests-cli/testdata/TestCLI_E2E/linked-path/cat/index.exp.svg index 0e66f755b..5684cad0f 100644 --- a/e2etests-cli/testdata/TestCLI_E2E/linked-path/cat/index.exp.svg +++ b/e2etests-cli/testdata/TestCLI_E2E/linked-path/cat/index.exp.svg @@ -1,20 +1,20 @@ -home + .d2-3054347393 .fill-N1{fill:#0A0F25;} + .d2-3054347393 .fill-N2{fill:#676C7E;} + .d2-3054347393 .fill-N3{fill:#9499AB;} + .d2-3054347393 .fill-N4{fill:#CFD2DD;} + .d2-3054347393 .fill-N5{fill:#DEE1EB;} + .d2-3054347393 .fill-N6{fill:#EEF1F8;} + .d2-3054347393 .fill-N7{fill:#FFFFFF;} + .d2-3054347393 .fill-B1{fill:#0D32B2;} + .d2-3054347393 .fill-B2{fill:#0D32B2;} + .d2-3054347393 .fill-B3{fill:#E3E9FD;} + .d2-3054347393 .fill-B4{fill:#E3E9FD;} + .d2-3054347393 .fill-B5{fill:#EDF0FD;} + .d2-3054347393 .fill-B6{fill:#F7F8FE;} + .d2-3054347393 .fill-AA2{fill:#4A6FF3;} + .d2-3054347393 .fill-AA4{fill:#EDF0FD;} + .d2-3054347393 .fill-AA5{fill:#F7F8FE;} + .d2-3054347393 .fill-AB4{fill:#EDF0FD;} + .d2-3054347393 .fill-AB5{fill:#F7F8FE;} + .d2-3054347393 .stroke-N1{stroke:#0A0F25;} + .d2-3054347393 .stroke-N2{stroke:#676C7E;} + .d2-3054347393 .stroke-N3{stroke:#9499AB;} + .d2-3054347393 .stroke-N4{stroke:#CFD2DD;} + .d2-3054347393 .stroke-N5{stroke:#DEE1EB;} + .d2-3054347393 .stroke-N6{stroke:#EEF1F8;} + .d2-3054347393 .stroke-N7{stroke:#FFFFFF;} + .d2-3054347393 .stroke-B1{stroke:#0D32B2;} + .d2-3054347393 .stroke-B2{stroke:#0D32B2;} + .d2-3054347393 .stroke-B3{stroke:#E3E9FD;} + .d2-3054347393 .stroke-B4{stroke:#E3E9FD;} + .d2-3054347393 .stroke-B5{stroke:#EDF0FD;} + .d2-3054347393 .stroke-B6{stroke:#F7F8FE;} + .d2-3054347393 .stroke-AA2{stroke:#4A6FF3;} + .d2-3054347393 .stroke-AA4{stroke:#EDF0FD;} + .d2-3054347393 .stroke-AA5{stroke:#F7F8FE;} + .d2-3054347393 .stroke-AB4{stroke:#EDF0FD;} + .d2-3054347393 .stroke-AB5{stroke:#F7F8FE;} + .d2-3054347393 .background-color-N1{background-color:#0A0F25;} + .d2-3054347393 .background-color-N2{background-color:#676C7E;} + .d2-3054347393 .background-color-N3{background-color:#9499AB;} + .d2-3054347393 .background-color-N4{background-color:#CFD2DD;} + .d2-3054347393 .background-color-N5{background-color:#DEE1EB;} + .d2-3054347393 .background-color-N6{background-color:#EEF1F8;} + .d2-3054347393 .background-color-N7{background-color:#FFFFFF;} + .d2-3054347393 .background-color-B1{background-color:#0D32B2;} + .d2-3054347393 .background-color-B2{background-color:#0D32B2;} + .d2-3054347393 .background-color-B3{background-color:#E3E9FD;} + .d2-3054347393 .background-color-B4{background-color:#E3E9FD;} + .d2-3054347393 .background-color-B5{background-color:#EDF0FD;} + .d2-3054347393 .background-color-B6{background-color:#F7F8FE;} + .d2-3054347393 .background-color-AA2{background-color:#4A6FF3;} + .d2-3054347393 .background-color-AA4{background-color:#EDF0FD;} + .d2-3054347393 .background-color-AA5{background-color:#F7F8FE;} + .d2-3054347393 .background-color-AB4{background-color:#EDF0FD;} + .d2-3054347393 .background-color-AB5{background-color:#F7F8FE;} + .d2-3054347393 .color-N1{color:#0A0F25;} + .d2-3054347393 .color-N2{color:#676C7E;} + .d2-3054347393 .color-N3{color:#9499AB;} + .d2-3054347393 .color-N4{color:#CFD2DD;} + .d2-3054347393 .color-N5{color:#DEE1EB;} + .d2-3054347393 .color-N6{color:#EEF1F8;} + .d2-3054347393 .color-N7{color:#FFFFFF;} + .d2-3054347393 .color-B1{color:#0D32B2;} + .d2-3054347393 .color-B2{color:#0D32B2;} + .d2-3054347393 .color-B3{color:#E3E9FD;} + .d2-3054347393 .color-B4{color:#E3E9FD;} + .d2-3054347393 .color-B5{color:#EDF0FD;} + .d2-3054347393 .color-B6{color:#F7F8FE;} + .d2-3054347393 .color-AA2{color:#4A6FF3;} + .d2-3054347393 .color-AA4{color:#EDF0FD;} + .d2-3054347393 .color-AA5{color:#F7F8FE;} + .d2-3054347393 .color-AB4{color:#EDF0FD;} + .d2-3054347393 .color-AB5{color:#F7F8FE;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#0D32B2;--color-border-muted:#0D32B2;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0D32B2;--color-accent-emphasis:#0D32B2;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]>home @@ -111,7 +111,7 @@ -the catmeow goes +the catmeow goes diff --git a/e2etests-cli/testdata/TestCLI_E2E/linked-path/index.exp.svg b/e2etests-cli/testdata/TestCLI_E2E/linked-path/index.exp.svg index c5328ae3b..d63109239 100644 --- a/e2etests-cli/testdata/TestCLI_E2E/linked-path/index.exp.svg +++ b/e2etests-cli/testdata/TestCLI_E2E/linked-path/index.exp.svg @@ -1,13 +1,13 @@ -how does the cat go? + .d2-1860590495 .fill-N1{fill:#0A0F25;} + .d2-1860590495 .fill-N2{fill:#676C7E;} + .d2-1860590495 .fill-N3{fill:#9499AB;} + .d2-1860590495 .fill-N4{fill:#CFD2DD;} + .d2-1860590495 .fill-N5{fill:#DEE1EB;} + .d2-1860590495 .fill-N6{fill:#EEF1F8;} + .d2-1860590495 .fill-N7{fill:#FFFFFF;} + .d2-1860590495 .fill-B1{fill:#0D32B2;} + .d2-1860590495 .fill-B2{fill:#0D32B2;} + .d2-1860590495 .fill-B3{fill:#E3E9FD;} + .d2-1860590495 .fill-B4{fill:#E3E9FD;} + .d2-1860590495 .fill-B5{fill:#EDF0FD;} + .d2-1860590495 .fill-B6{fill:#F7F8FE;} + .d2-1860590495 .fill-AA2{fill:#4A6FF3;} + .d2-1860590495 .fill-AA4{fill:#EDF0FD;} + .d2-1860590495 .fill-AA5{fill:#F7F8FE;} + .d2-1860590495 .fill-AB4{fill:#EDF0FD;} + .d2-1860590495 .fill-AB5{fill:#F7F8FE;} + .d2-1860590495 .stroke-N1{stroke:#0A0F25;} + .d2-1860590495 .stroke-N2{stroke:#676C7E;} + .d2-1860590495 .stroke-N3{stroke:#9499AB;} + .d2-1860590495 .stroke-N4{stroke:#CFD2DD;} + .d2-1860590495 .stroke-N5{stroke:#DEE1EB;} + .d2-1860590495 .stroke-N6{stroke:#EEF1F8;} + .d2-1860590495 .stroke-N7{stroke:#FFFFFF;} + .d2-1860590495 .stroke-B1{stroke:#0D32B2;} + .d2-1860590495 .stroke-B2{stroke:#0D32B2;} + .d2-1860590495 .stroke-B3{stroke:#E3E9FD;} + .d2-1860590495 .stroke-B4{stroke:#E3E9FD;} + .d2-1860590495 .stroke-B5{stroke:#EDF0FD;} + .d2-1860590495 .stroke-B6{stroke:#F7F8FE;} + .d2-1860590495 .stroke-AA2{stroke:#4A6FF3;} + .d2-1860590495 .stroke-AA4{stroke:#EDF0FD;} + .d2-1860590495 .stroke-AA5{stroke:#F7F8FE;} + .d2-1860590495 .stroke-AB4{stroke:#EDF0FD;} + .d2-1860590495 .stroke-AB5{stroke:#F7F8FE;} + .d2-1860590495 .background-color-N1{background-color:#0A0F25;} + .d2-1860590495 .background-color-N2{background-color:#676C7E;} + .d2-1860590495 .background-color-N3{background-color:#9499AB;} + .d2-1860590495 .background-color-N4{background-color:#CFD2DD;} + .d2-1860590495 .background-color-N5{background-color:#DEE1EB;} + .d2-1860590495 .background-color-N6{background-color:#EEF1F8;} + .d2-1860590495 .background-color-N7{background-color:#FFFFFF;} + .d2-1860590495 .background-color-B1{background-color:#0D32B2;} + .d2-1860590495 .background-color-B2{background-color:#0D32B2;} + .d2-1860590495 .background-color-B3{background-color:#E3E9FD;} + .d2-1860590495 .background-color-B4{background-color:#E3E9FD;} + .d2-1860590495 .background-color-B5{background-color:#EDF0FD;} + .d2-1860590495 .background-color-B6{background-color:#F7F8FE;} + .d2-1860590495 .background-color-AA2{background-color:#4A6FF3;} + .d2-1860590495 .background-color-AA4{background-color:#EDF0FD;} + .d2-1860590495 .background-color-AA5{background-color:#F7F8FE;} + .d2-1860590495 .background-color-AB4{background-color:#EDF0FD;} + .d2-1860590495 .background-color-AB5{background-color:#F7F8FE;} + .d2-1860590495 .color-N1{color:#0A0F25;} + .d2-1860590495 .color-N2{color:#676C7E;} + .d2-1860590495 .color-N3{color:#9499AB;} + .d2-1860590495 .color-N4{color:#CFD2DD;} + .d2-1860590495 .color-N5{color:#DEE1EB;} + .d2-1860590495 .color-N6{color:#EEF1F8;} + .d2-1860590495 .color-N7{color:#FFFFFF;} + .d2-1860590495 .color-B1{color:#0D32B2;} + .d2-1860590495 .color-B2{color:#0D32B2;} + .d2-1860590495 .color-B3{color:#E3E9FD;} + .d2-1860590495 .color-B4{color:#E3E9FD;} + .d2-1860590495 .color-B5{color:#EDF0FD;} + .d2-1860590495 .color-B6{color:#F7F8FE;} + .d2-1860590495 .color-AA2{color:#4A6FF3;} + .d2-1860590495 .color-AA4{color:#EDF0FD;} + .d2-1860590495 .color-AA5{color:#F7F8FE;} + .d2-1860590495 .color-AB4{color:#EDF0FD;} + .d2-1860590495 .color-AB5{color:#F7F8FE;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#0D32B2;--color-border-muted:#0D32B2;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0D32B2;--color-accent-emphasis:#0D32B2;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]>how does the cat go? @@ -104,7 +104,7 @@ - + From 1646fc06f92ef302072ad6bbb030d71388174677 Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Thu, 30 Mar 2023 20:39:01 -0700 Subject: [PATCH 3/3] skip --- e2etests-cli/main_test.go | 6 + .../TestCLI_E2E/internal_linked_pdf.exp.pdf | Bin 79806 -> 79806 bytes .../linked-path/cat/big cat.exp.svg | 102 --------------- .../TestCLI_E2E/linked-path/cat/index.exp.svg | 117 ------------------ .../TestCLI_E2E/linked-path/index.exp.svg | 110 ---------------- 5 files changed, 6 insertions(+), 329 deletions(-) delete mode 100644 e2etests-cli/testdata/TestCLI_E2E/linked-path/cat/big cat.exp.svg delete mode 100644 e2etests-cli/testdata/TestCLI_E2E/linked-path/cat/index.exp.svg delete mode 100644 e2etests-cli/testdata/TestCLI_E2E/linked-path/index.exp.svg diff --git a/e2etests-cli/main_test.go b/e2etests-cli/main_test.go index 6bad9de65..dc75a4f22 100644 --- a/e2etests-cli/main_test.go +++ b/e2etests-cli/main_test.go @@ -21,6 +21,7 @@ func TestCLI_E2E(t *testing.T) { tca := []struct { name string skipCI bool + skip bool run func(t *testing.T, ctx context.Context, dir string, env *xos.Env) }{ { @@ -84,6 +85,8 @@ steps: { }, { name: "linked-path", + // TODO tempdir is random, resulting in different test results each time with the links + skip: true, run: func(t *testing.T, ctx context.Context, dir string, env *xos.Env) { writeFile(t, dir, "linked.d2", `cat: how does the cat go? { link: layers.cat @@ -268,6 +271,9 @@ layers: { if tc.skipCI && os.Getenv("CI") != "" { t.SkipNow() } + if tc.skip { + t.SkipNow() + } ctx, cancel := context.WithTimeout(ctx, time.Minute*5) defer cancel() diff --git a/e2etests-cli/testdata/TestCLI_E2E/internal_linked_pdf.exp.pdf b/e2etests-cli/testdata/TestCLI_E2E/internal_linked_pdf.exp.pdf index 4f63dfc5b51fe766a5db6c7827f6364ba9411423..64ceca2ea4d3658c4e4cb54690b4af536e5b0cfc 100644 GIT binary patch delta 176 zcmdn@o@L*AmJQ|dlLdAznk=Qjzxm)!p}@(Pnhk&g%G=er85K1qKiFX~xmGq(T$ delta 174 zcmdn@o@L*AmJQ|dlkd%3JXunKfAfS{E0ZT%6&e5qR5thi+hsC&-AseYS%u1zXUW$y znrxO*PzaoC`Ojc;R-uc=ba!LM`;5lZ)lC=;84agLnlNT48Jd_FnVM;G>HFrVxFnXO zDrmS^85tNE8yFiKK;*VRHeobn(ls_VH!)Q(00D(O1uihd#N61(98Jv3!q~uUx~n;3 FB>*5)HT(bo diff --git a/e2etests-cli/testdata/TestCLI_E2E/linked-path/cat/big cat.exp.svg b/e2etests-cli/testdata/TestCLI_E2E/linked-path/cat/big cat.exp.svg deleted file mode 100644 index 9e77770f3..000000000 --- a/e2etests-cli/testdata/TestCLI_E2E/linked-path/cat/big cat.exp.svg +++ /dev/null @@ -1,102 +0,0 @@ -the catroar goes - - - diff --git a/e2etests-cli/testdata/TestCLI_E2E/linked-path/cat/index.exp.svg b/e2etests-cli/testdata/TestCLI_E2E/linked-path/cat/index.exp.svg deleted file mode 100644 index 5684cad0f..000000000 --- a/e2etests-cli/testdata/TestCLI_E2E/linked-path/cat/index.exp.svg +++ /dev/null @@ -1,117 +0,0 @@ -home - - - - - - - - - - - -the catmeow goes - - - diff --git a/e2etests-cli/testdata/TestCLI_E2E/linked-path/index.exp.svg b/e2etests-cli/testdata/TestCLI_E2E/linked-path/index.exp.svg deleted file mode 100644 index d63109239..000000000 --- a/e2etests-cli/testdata/TestCLI_E2E/linked-path/index.exp.svg +++ /dev/null @@ -1,110 +0,0 @@ -how does the cat go? - - - - - - - - - - - - - - -