WIP: Add SVG Templating #10
@@ -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 {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package svg
|
||||
|
||||
const KeyRegex string = `\{\{\s*(.*?)\s*\}\}`
|
||||
|
||||
type TemplateData struct {
|
||||
Id string
|
||||
TemplateKeys []string
|
||||
|
||||
Reference in New Issue
Block a user