initial
This commit is contained in:
22
svg_utils.go
Normal file
22
svg_utils.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package gliffy2drawio
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
)
|
||||
|
||||
// SVGImporterUtils mirrors the Java helper but keeps a lightweight implementation.
|
||||
// It currently preserves the original SVG and only updates the viewBox attribute
|
||||
// if one is present.
|
||||
type SVGImporterUtils struct {
|
||||
}
|
||||
|
||||
var svgPattern = regexp.MustCompile(`viewBox="(.*?)"`)
|
||||
|
||||
func (s SVGImporterUtils) SetViewBox(svg string) string {
|
||||
m := svgPattern.FindStringSubmatch(svg)
|
||||
if len(m) == 0 {
|
||||
return svg
|
||||
}
|
||||
// No bounding-box calculation available here; keep the existing viewBox.
|
||||
return svg
|
||||
}
|
||||
Reference in New Issue
Block a user