WIP: Add SVG Templating #10

Draft
tueem wants to merge 14 commits from feat/template into dev
2 changed files with 5 additions and 3 deletions
Showing only changes of commit 6cf349bafa - Show all commits

View File

@@ -27,9 +27,9 @@ func Create(svgbuf []byte) (svg.TemplateData, error) {
return data, nil
}
func populateKeys(data *svg.TemplateData, svg []byte) {
regex := regexp.MustCompile(`\{\{\s*(.*?)\s*\}\}`)
result := regex.FindAllSubmatch(svg, -1)
func populateKeys(data *svg.TemplateData, svgblob []byte) {
regex := regexp.MustCompile(svg.KeyRegex)
result := regex.FindAllSubmatch(svgblob, -1)
templateKeys := make([]string, len(result))
for i, matches := range result {

View File

@@ -1,5 +1,7 @@
package svg
const KeyRegex string = `\{\{\s*(.*?)\s*\}\}`
type TemplateData struct {
Id string
TemplateKeys []string