Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: fix animate + appendix #1258

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions d2cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ func compile(ctx context.Context, ms *xmain.State, plugin d2plugin.Plugin, rende
return nil, false, err
}
var out []byte
println("\033[1;31m--- DEBUG:", "=======================", "\033[m")
if len(boards) > 0 {
out = boards[0]
if animateInterval > 0 {
Expand Down
1 change: 1 addition & 0 deletions d2renderers/d2animate/d2animate.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func Wrap(rootDiagram *d2target.Diagram, svgs [][]byte, renderOpts d2svg.RenderO
)
fmt.Fprint(buf, fitToScreenWrapperOpening)

println("\033[1;31m--- DEBUG:", "=======================", "\033[m")
innerOpening := fmt.Sprintf(`<svg id="d2-svg" width="%d" height="%d" viewBox="%d %d %d %d">`,
width, height, left, top, width, height)
fmt.Fprint(buf, innerOpening)
Expand Down
1 change: 1 addition & 0 deletions d2renderers/d2svg/d2svg.go
Original file line number Diff line number Diff line change
Expand Up @@ -1719,6 +1719,7 @@ func Render(diagram *d2target.Diagram, opts *RenderOpts) ([]byte, error) {
// generate style elements that will be appended to the SVG tag
upperBuf := &bytes.Buffer{}
if opts.MasterID == "" {
println("\033[1;31m--- DEBUG:", "=======================", "\033[m")
EmbedFonts(upperBuf, diagramHash, buf.String(), diagram.FontFamily, diagram.GetCorpus()) // EmbedFonts *must* run before `d2sketch.DefineFillPatterns`, but after all elements are appended to `buf`
themeStylesheet, err := ThemeCSS(diagramHash, themeID, darkThemeID)
if err != nil {
Expand Down
11 changes: 11 additions & 0 deletions e2etests-cli/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ steps: {
assert.Testdata(t, ".svg", svg)
},
},
{
name: "animate-appendix",
run: func(t *testing.T, ctx context.Context, dir string, env *xos.Env) {
writeFile(t, dir, "animation.d2", `a: {link: http://www.google.com}
`)
err := runTestMain(t, ctx, dir, env, "--animate-interval=1400", "--force-appendix", "animation.d2")
assert.Success(t, err)
svg := readFile(t, dir, "animation.svg")
assert.Testdata(t, ".svg", svg)
},
},
{
name: "linked-path",
// TODO tempdir is random, resulting in different test results each time with the links
Expand Down