added fallback
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"html"
|
||||
"math"
|
||||
"os"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strconv"
|
||||
@@ -27,6 +28,7 @@ type GliffyDiagramConverter struct {
|
||||
}
|
||||
|
||||
func NewGliffyDiagramConverter(gliffyDiagramString string) (*GliffyDiagramConverter, error) {
|
||||
customTrans := os.Getenv("GLIFFY_TRANSLATIONS_JSON")
|
||||
c := &GliffyDiagramConverter{
|
||||
diagramString: gliffyDiagramString,
|
||||
drawioDiagram: NewMxGraph(),
|
||||
@@ -35,7 +37,7 @@ func NewGliffyDiagramConverter(gliffyDiagramString string) (*GliffyDiagramConver
|
||||
rotationPattern: regexp.MustCompile(`rotation=(\-?\w+)`),
|
||||
pageIDPattern: regexp.MustCompile(`pageId=([^&]+)`),
|
||||
namePattern: regexp.MustCompile(`name=([^&]+)`),
|
||||
translator: NewStencilTranslator(""),
|
||||
translator: NewStencilTranslator("").WithCustomMapping(customTrans),
|
||||
}
|
||||
if err := c.start(); err != nil {
|
||||
return nil, err
|
||||
@@ -331,6 +333,9 @@ func (c *GliffyDiagramConverter) convertGliffyObject(obj *GliffyObject, parent *
|
||||
isChevron := strings.Contains(obj.UID, "chevron")
|
||||
if translatedStyle != "" {
|
||||
style.WriteString("shape=" + translatedStyle + ";")
|
||||
} else {
|
||||
// Fallback if stencil translation is missing: render as a basic rect so the shape is visible.
|
||||
style.WriteString("shape=rect;")
|
||||
}
|
||||
if !strings.Contains(style.String(), "shadow=") {
|
||||
style.WriteString("shadow=" + intToString(boolToInt(shape.DropShadow)) + ";")
|
||||
|
||||
Reference in New Issue
Block a user