Merge pull request #1894 from alixander/pdf-theme
cli: apply theme to pdf exports
This commit is contained in:
commit
d706e0cf9e
8 changed files with 18 additions and 4 deletions
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#### Bugfixes ⛑️
|
#### Bugfixes ⛑️
|
||||||
|
|
||||||
|
- Theme flags on CLI apply to PDFs [#1894](https://github.com/terrastruct/d2/pull/1894)
|
||||||
- Fixes styles in connections not overriding styles set by globs [#1857](https://github.com/terrastruct/d2/pull/1857)
|
- Fixes styles in connections not overriding styles set by globs [#1857](https://github.com/terrastruct/d2/pull/1857)
|
||||||
- Fixes `null` being set on a nested shape not working in certain cases when connections also pointed to that shape [#1830](https://github.com/terrastruct/d2/pull/1830)
|
- Fixes `null` being set on a nested shape not working in certain cases when connections also pointed to that shape [#1830](https://github.com/terrastruct/d2/pull/1830)
|
||||||
- Fixes edge case of bad import syntax crashing using d2 as a library [#1829](https://github.com/terrastruct/d2/pull/1829)
|
- Fixes edge case of bad import syntax crashing using d2 as a library [#1829](https://github.com/terrastruct/d2/pull/1829)
|
||||||
|
|
|
||||||
|
|
@ -936,10 +936,11 @@ func renderPDF(ctx context.Context, ms *xmain.State, plugin d2plugin.Plugin, opt
|
||||||
}
|
}
|
||||||
|
|
||||||
svg, err = d2svg.Render(diagram, &d2svg.RenderOpts{
|
svg, err = d2svg.Render(diagram, &d2svg.RenderOpts{
|
||||||
Pad: opts.Pad,
|
Pad: opts.Pad,
|
||||||
Sketch: opts.Sketch,
|
Sketch: opts.Sketch,
|
||||||
Center: opts.Center,
|
Center: opts.Center,
|
||||||
Scale: scale,
|
Scale: scale,
|
||||||
|
ThemeID: opts.ThemeID,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
|
|
@ -765,6 +765,18 @@ i used to read
|
||||||
assert.Testdata(t, ".svg", svg)
|
assert.Testdata(t, ".svg", svg)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "theme-pdf",
|
||||||
|
skipCI: true,
|
||||||
|
run: func(t *testing.T, ctx context.Context, dir string, env *xos.Env) {
|
||||||
|
writeFile(t, dir, "in.d2", `x -> y`)
|
||||||
|
err := runTestMain(t, ctx, dir, env, "--theme=5", "in.d2", "out.pdf")
|
||||||
|
assert.Success(t, err)
|
||||||
|
|
||||||
|
pdf := readFile(t, dir, "out.pdf")
|
||||||
|
testdataIgnoreDiff(t, ".pdf", pdf)
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "renamed-board",
|
name: "renamed-board",
|
||||||
skipCI: true,
|
skipCI: true,
|
||||||
|
|
|
||||||
Binary file not shown.
BIN
e2etests-cli/testdata/TestCLI_E2E/no-nav-pdf.exp.pdf
vendored
BIN
e2etests-cli/testdata/TestCLI_E2E/no-nav-pdf.exp.pdf
vendored
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
e2etests-cli/testdata/TestCLI_E2E/theme-pdf.exp.pdf
vendored
Normal file
BIN
e2etests-cli/testdata/TestCLI_E2E/theme-pdf.exp.pdf
vendored
Normal file
Binary file not shown.
Loading…
Reference in a new issue