From a910a4aaa4b14d8b494dfc2e09349f2ef2759c4b Mon Sep 17 00:00:00 2001 From: Gavin Nishizawa Date: Tue, 28 Feb 2023 13:32:56 -0800 Subject: [PATCH] cleanup --- d2renderers/d2svg/appendix/appendix.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/d2renderers/d2svg/appendix/appendix.go b/d2renderers/d2svg/appendix/appendix.go index 4d2b61ca1..df756e26c 100644 --- a/d2renderers/d2svg/appendix/appendix.go +++ b/d2renderers/d2svg/appendix/appendix.go @@ -92,9 +92,10 @@ func Append(diagram *d2target.Diagram, ruler *textmeasure.Ruler, in []byte) []by newOuterViewbox := fmt.Sprintf(`viewBox="0 0 %d %d"`, viewboxWidth, viewboxHeight) newViewbox := fmt.Sprintf(`viewBox="%s %s %s %s"`, viewboxSlice[0], viewboxSlice[1], strconv.Itoa(viewboxWidth), strconv.Itoa(viewboxHeight)) - // check if outer svg has dimensions set dimensionsToUpdate := 2 - if widthRegex.FindString(svgRegex.FindString(svg)) != "" { + outerSVG := svgRegex.FindString(svg) + // if outer svg has dimensions set we also need to update it + if widthRegex.FindString(outerSVG) != "" { dimensionsToUpdate++ }