Auto transform SVGs into template portions

This means I don't have to modify the files correctly by hand
This commit is contained in:
Eli Ribble 2026-01-30 18:58:50 +00:00
parent bb9dd1754f
commit 38b1cdbbad
No known key found for this signature in database
7 changed files with 55 additions and 25 deletions

View file

@ -26,6 +26,7 @@ var TemplatesByFilename = make(map[string]BuiltTemplate, 0)
type BuiltTemplate struct {
files []string
subdir string
svgs []string
// Nil if we are going to read templates off disk every time we render
// because we are in development mode.
template *template.Template
@ -34,7 +35,7 @@ type BuiltTemplate struct {
func (bt *BuiltTemplate) executeTemplate(w io.Writer, data any) error {
if bt.template == nil {
name := path.Base(bt.files[0])
templ, err := parseFromDisk(bt.files)
templ, err := parseFromDisk(bt.svgs, bt.files)
if err != nil {
return fmt.Errorf("Failed to parse template file: %w", err)
}
@ -50,7 +51,7 @@ func (bt *BuiltTemplate) executeTemplate(w io.Writer, data any) error {
}
}
func NewBuiltTemplate(embeddedFiles embed.FS, subdir string, files ...string) *BuiltTemplate {
func NewBuiltTemplate(embeddedFiles embed.FS, subdir string, svgs []string, files ...string) *BuiltTemplate {
files_on_disk := true
for _, f := range files {
_, err := os.Stat(f)
@ -67,13 +68,15 @@ func NewBuiltTemplate(embeddedFiles embed.FS, subdir string, files ...string) *B
result = BuiltTemplate{
files: files,
subdir: subdir,
svgs: svgs,
template: nil,
}
} else {
result = BuiltTemplate{
files: files,
subdir: subdir,
template: parseEmbedded(embeddedFiles, subdir, files),
svgs: svgs,
template: parseEmbedded(embeddedFiles, subdir, svgs, files),
}
}
TemplatesByFilename[path.Base(files[0])] = result
@ -125,7 +128,7 @@ func makeFuncMap() template.FuncMap {
}
return funcMap
}
func parseEmbedded(embeddedFiles embed.FS, subdir string, files []string) *template.Template {
func parseEmbedded(embeddedFiles embed.FS, subdir string, svgs []string, files []string) *template.Template {
funcMap := makeFuncMap()
// Remap the file names to embedded paths
embeddedFilePaths := make([]string, 0)
@ -134,11 +137,31 @@ func parseEmbedded(embeddedFiles embed.FS, subdir string, files []string) *templ
}
name := path.Base(embeddedFilePaths[0])
log.Debug().Str("name", name).Strs("paths", embeddedFilePaths).Msg("Parsing embedded template")
return template.Must(
template.New(name).Funcs(funcMap).ParseFS(embeddedFiles, embeddedFilePaths...))
t, err := template.New(name).Funcs(funcMap).ParseFS(embeddedFiles, embeddedFilePaths...)
if err != nil {
panic(fmt.Sprintf("Failed to parse embedded template %s: %v", name, err))
}
for _, svg := range svgs {
svg_path := strings.TrimPrefix(svg, subdir)
content, err := embeddedFiles.ReadFile(svg_path)
if err != nil {
panic(fmt.Sprintf("Failed to read svg '%s' from embedded filesystem: %v", svg, err))
}
svg_name := path.Base(svg)
svg_template := fmt.Sprintf("{{define \"%s\"}}%s{{end}}", svg_name, string(content))
svg_t, err := template.New(svg_name).Parse(svg_template)
if err != nil {
panic(fmt.Sprintf("Failed to parse svg '%s' from embedded filesystem: %v", svg, err))
}
_, err = t.AddParseTree(svg_t.Name(), svg_t.Tree)
if err != nil {
panic(fmt.Sprintf("Failed to add svg '%s' to embedded template: %v", svg, err))
}
}
return t
}
func parseFromDisk(files []string) (*template.Template, error) {
func parseFromDisk(svgs []string, files []string) (*template.Template, error) {
funcMap := makeFuncMap()
name := path.Base(files[0])
//log.Debug().Str("name", name).Strs("files", files).Msg("parsing from disk")
@ -146,6 +169,24 @@ func parseFromDisk(files []string) (*template.Template, error) {
if err != nil {
return nil, fmt.Errorf("Failed to parse %s: %w", files, err)
}
for _, svg := range svgs {
content, err := os.ReadFile(svg)
if err != nil {
return nil, fmt.Errorf("Failed to read svg '%s' from filesystem: %w", svg, err)
}
svg_name := path.Base(svg)
svg_template := fmt.Sprintf("{{define \"%s\"}}%s{{end}}", svg_name, string(content))
svg_t, err := template.New(svg_name).Parse(svg_template)
if err != nil {
log.Debug().Str("svg", svg).Str("svg_name", svg_name).Str("template", svg_template).Msg("failed to parse")
return nil, fmt.Errorf("Failed to parse svg '%s' from filesystem: %w", svg, err)
}
_, err = templ.AddParseTree(svg_t.Name(), svg_t.Tree)
if err != nil {
return nil, fmt.Errorf("Failed to add svg '%s' to template: %w", svg, err)
}
log.Debug().Str("name", svg_t.Name()).Str("svg_name", svg_name).Msg("Added svg template")
}
return templ, nil
}

View file

@ -22,8 +22,9 @@ func buildTemplate(files ...string) *html.BuiltTemplate {
for _, c := range components {
full_files = append(full_files, fmt.Sprintf("%s/template/component/%s.html", subdir, c))
}
full_svgs := make([]string, 0)
for _, c := range svgs {
full_files = append(full_files, fmt.Sprintf("%s/template/svg/%s.svg", subdir, c))
full_svgs = append(full_svgs, fmt.Sprintf("%s/template/svg/%s.svg", subdir, c))
}
return html.NewBuiltTemplate(embeddedFiles, "rmo/", full_files...)
return html.NewBuiltTemplate(embeddedFiles, "rmo/", full_svgs, full_files...)
}

View file

@ -66,9 +66,7 @@
<div class="card service-card h-100">
<div class="card-body text-center">
<div class="mb-3">
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
{{ template "mosquito.svg" }}
</div>
<h4 class="card-title">Follow-up or Check Status</h4>
<p class="card-text">Check on a previous request or view current mosquito activity in your area.</p>
@ -82,9 +80,7 @@
<div class="card service-card h-100">
<div class="card-body text-center">
<div class="mb-3">
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" class="bi bi-water" viewBox="0 0 16 16">
<path d="M.036 3.314a.5.5 0 0 1 .65-.278l1.757.703a1.5 1.5 0 0 0 1.114 0l1.014-.406a2.5 2.5 0 0 1 1.857 0l1.015.406a1.5 1.5 0 0 0 1.114 0l1.014-.406a2.5 2.5 0 0 1 1.857 0l1.015.406a1.5 1.5 0 0 0 1.114 0l1.757-.703a.5.5 0 1 1 .372.928l-1.758.703a2.5 2.5 0 0 1-1.857 0l-1.014-.406a1.5 1.5 0 0 0-1.114 0l-1.015.406a2.5 2.5 0 0 1-1.857 0l-1.014-.406a1.5 1.5 0 0 0-1.114 0l-1.015.406a2.5 2.5 0 0 1-1.857 0L.664 3.964a.5.5 0 0 1-.278-.65zm0 3a.5.5 0 0 1 .65-.278l1.757.703a1.5 1.5 0 0 0 1.114 0l1.014-.406a2.5 2.5 0 0 1 1.857 0l1.015.406a1.5 1.5 0 0 0 1.114 0l1.014-.406a2.5 2.5 0 0 1 1.857 0l1.015.406a1.5 1.5 0 0 0 1.114 0l1.757-.703a.5.5 0 1 1 .372.928l-1.758.703a2.5 2.5 0 0 1-1.857 0l-1.014-.406a1.5 1.5 0 0 0-1.114 0l-1.015.406a2.5 2.5 0 0 1-1.857 0l-1.014-.406a1.5 1.5 0 0 0-1.114 0l-1.015.406a2.5 2.5 0 0 1-1.857 0L.664 6.964a.5.5 0 0 1-.278-.65zm0 3a.5.5 0 0 1 .65-.278l1.757.703a1.5 1.5 0 0 0 1.114 0l1.014-.406a2.5 2.5 0 0 1 1.857 0l1.015.406a1.5 1.5 0 0 0 1.114 0l1.014-.406a2.5 2.5 0 0 1 1.857 0l1.015.406a1.5 1.5 0 0 0 1.114 0l1.757-.703a.5.5 0 1 1 .372.928l-1.758.703a2.5 2.5 0 0 1-1.857 0l-1.014-.406a1.5 1.5 0 0 0-1.114 0l-1.015.406a2.5 2.5 0 0 1-1.857 0l-1.014-.406a1.5 1.5 0 0 0-1.114 0l-1.015.406a2.5 2.5 0 0 1-1.857 0L.664 9.964a.5.5 0 0 1-.278-.65z"/>
</svg>
{{ template "pond.svg" }}
</div>
<h4 class="card-title">Report a Green Pool</h4>
<p class="card-text">Report stagnant water sources like abandoned pools that may breed mosquitoes.</p>
@ -98,9 +94,7 @@
<div class="card service-card h-100">
<div class="card-body text-center">
<div class="mb-3">
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" class="bi bi-bug" viewBox="0 0 16 16">
<path d="M4.355.522a.5.5 0 0 1 .623.333l.291.956A4.979 4.979 0 0 1 8 1c1.007 0 1.946.298 2.731.811l.29-.956a.5.5 0 1 1 .957.29l-.41 1.352A4.985 4.985 0 0 1 13 6h.5a.5.5 0 0 0 .5-.5V5a.5.5 0 0 1 1 0v.5A1.5 1.5 0 0 1 13.5 7H13v1h1.5a.5.5 0 0 1 0 1H13v1h.5a1.5 1.5 0 0 1 1.5 1.5v.5a.5.5 0 1 1-1 0v-.5a.5.5 0 0 0-.5-.5H13a5 5 0 0 1-10 0h-.5a.5.5 0 0 0-.5.5v.5a.5.5 0 1 1-1 0v-.5A1.5 1.5 0 0 1 2.5 10H3V9H1.5a.5.5 0 0 1 0-1H3V7h-.5A1.5 1.5 0 0 1 1 5.5V5a.5.5 0 0 1 1 0v.5a.5.5 0 0 0 .5.5H3c0-1.364.547-2.601 1.432-3.503l-.41-1.352a.5.5 0 0 1 .333-.623zM4 7v4a4 4 0 0 0 3.5 3.97V7H4zm4.5 0v7.97A4 4 0 0 0 12 11V7H8.5zM12 6a3.989 3.989 0 0 0-1.334-2.982A3.983 3.983 0 0 0 8 2a3.983 3.983 0 0 0-2.667 1.018A3.989 3.989 0 0 0 4 6h8z"/>
</svg>
{{ template "check-report.svg" }}
</div>
<h4 class="card-title">Report Mosquito Nuisance</h4>
<p class="card-text">Report areas with high adult mosquito activity causing discomfort or concern.</p>

View file

@ -1,3 +1 @@
{{define "svg/check-report"}}
<svg height="48" viewBox="0 0 512 512" width="48" xmlns="http://www.w3.org/2000/svg"><path d="M306.01 322.648c6.337 0 12.264-2.498 16.689-7.034l39.311-40.304c8.972-9.2 8.786-23.984-.415-32.957-9.201-8.971-23.988-8.785-32.96.414l-23.061 23.642-4.04-3.928c-9.214-8.956-24-8.751-32.961.462-8.958 9.213-8.751 23.997.463 32.956l20.726 20.152a23.2 23.2 0 0 0 16.248 6.597m-26.659-49.227c3.184-3.274 8.437-3.342 11.706-.163l9.419 9.159a7.517 7.517 0 0 0 10.62-.141l28.3-29.014c3.188-3.269 8.439-3.332 11.705-.148 3.268 3.187 3.333 8.437.148 11.704l-39.311 40.303c-3.038 3.249-8.572 3.318-11.697.156l-20.726-20.152c-3.271-3.182-3.346-8.433-.164-11.704"/><path d="M247.915 327.763a7.517 7.517 0 0 0-12 9.052 99 99 0 0 0 8.997 10.337c18.479 18.477 43.048 28.652 69.181 28.652s50.701-10.175 69.18-28.652c18.48-18.476 28.656-43.042 28.656-69.171s-10.177-50.695-28.656-69.171c-38.147-38.141-100.214-38.14-138.361 0-26.007 26.003-35.21 63.936-24.017 98.996a7.52 7.52 0 0 0 9.445 4.874 7.514 7.514 0 0 0 4.874-9.444c-9.475-29.678-1.686-61.788 20.328-83.798 32.284-32.281 84.818-32.281 117.102 0 15.64 15.638 24.254 36.429 24.254 58.544s-8.614 42.906-24.254 58.544c-15.639 15.637-36.433 24.25-58.551 24.25-22.117 0-42.912-8.612-58.552-24.25a84 84 0 0 1-7.626-8.763"/><path d="m501.66 415.271-47.415-47.409a7.52 7.52 0 0 0-10.63 0l-.29.29-18.247-18.244a132 132 0 0 0 21.012-63.562 7.516 7.516 0 0 0-7.028-7.973c-4.139-.252-7.711 2.886-7.974 7.027a117.08 117.08 0 0 1-34.102 75.462c-22.824 22.822-52.797 34.246-82.779 34.275-.038-.001-.075-.006-.114-.006h-.597c-29.82-.15-59.594-11.57-82.296-34.269-22.142-22.138-34.336-51.573-34.336-82.882s12.194-60.744 34.336-82.882c45.707-45.702 120.079-45.702 165.786 0 17.024 17.022 28.258 38.493 32.489 62.094.733 4.085 4.641 6.799 8.724 6.071a7.515 7.515 0 0 0 6.072-8.723c-4.776-26.637-17.451-50.867-36.656-70.07a131.8 131.8 0 0 0-31.449-23.271v-60.566a7.6 7.6 0 0 0-2.201-5.314l-93.13-93.118A7.62 7.62 0 0 0 275.519 0H22.547C10.115 0 0 10.113 0 22.544v63.163a7.515 7.515 0 0 0 7.516 7.515 7.515 7.515 0 0 0 7.516-7.515V22.544c0-4.144 3.371-7.515 7.516-7.515h245.458v70.575c0 12.431 10.115 22.544 22.547 22.544h70.584v46.245c-14.664-5.556-30.124-8.41-45.609-8.577-.074-.01-.146-.025-.223-.025h-167.8a7.516 7.516 0 1 0 0 15.03h105.226a131.7 131.7 0 0 0-29.979 21.525h-75.247a7.516 7.516 0 1 0 0 15.03h61.72c-12.268 15.891-20.652 34.193-24.665 53.73h-37.054a7.516 7.516 0 1 0 0 15.03h34.859a135 135 0 0 0-.529 11.846q.001 4.897.352 9.733h-34.681a7.516 7.516 0 1 0 0 15.03h36.64c3.833 20.341 12.379 39.401 25.101 55.87h-61.741a7.515 7.515 0 1 0 0 15.03h75.275a131.7 131.7 0 0 0 29.931 21.49h-105.21a7.516 7.516 0 1 0 0 15.03h166.59a132.9 132.9 0 0 0 47.042-8.596v87.891c0 4.143-3.371 7.515-7.516 7.515H22.547c-4.144 0-7.516-3.371-7.516-7.515V115.77c0-4.15-3.365-7.515-7.516-7.515s-7.516 3.364-7.516 7.515v373.69C0 501.887 10.115 512 22.547 512H353.62c12.432 0 22.547-10.113 22.547-22.544v-94.697a131 131 0 0 0 9.867-5.804l18.243 18.24c-3.157 2.756-3.326 8.008-.291 10.918l47.416 47.41c13.227 13.785 37.031 13.784 50.257 0 13.788-13.226 13.787-37.027.001-50.252M290.552 93.119c-4.144 0-7.516-3.371-7.516-7.515V25.657l67.471 67.462zm107.742 286.839a133 133 0 0 0 9.321-8.468 133 133 0 0 0 8.468-9.32l16.612 16.609-17.79 17.787zm92.737 74.937c-7.632 7.955-21.367 7.953-29 0l-42.102-42.096 29.001-28.997 42.102 42.096c7.954 7.633 7.955 21.365-.001 28.997"/><path d="M68.204 204.803h32.88c9.27 0 16.812-7.54 16.812-16.808v-32.876c0-9.269-7.541-16.809-16.812-16.809h-32.88c-9.269 0-16.811 7.54-16.811 16.809v32.876c0 9.268 7.542 16.808 16.811 16.808m-1.779-49.684c0-.981.799-1.779 1.779-1.779h32.88c.982 0 1.78.798 1.78 1.779v32.876c0 .981-.799 1.779-1.78 1.779h-32.88a1.78 1.78 0 0 1-1.779-1.779zM51.393 293.362c0 9.268 7.541 16.808 16.811 16.808h32.88c9.27 0 16.812-7.54 16.812-16.808v-32.876c0-9.268-7.541-16.808-16.812-16.808h-32.88c-9.269 0-16.811 7.54-16.811 16.808zm15.032-32.876c0-.981.799-1.779 1.779-1.779h32.88c.982 0 1.78.798 1.78 1.779v32.876c0 .981-.799 1.779-1.78 1.779h-32.88a1.78 1.78 0 0 1-1.779-1.779zM51.393 400.87c0 9.268 7.541 16.808 16.811 16.808h32.88c9.27 0 16.812-7.54 16.812-16.808v-32.876c0-9.269-7.541-16.809-16.812-16.809h-32.88c-9.269 0-16.811 7.54-16.811 16.809zm15.032-32.876c0-.981.799-1.779 1.779-1.779h32.88c.982 0 1.78.798 1.78 1.779v32.876c0 .981-.799 1.779-1.78 1.779h-32.88a1.78 1.78 0 0 1-1.779-1.779z"/></svg>
{{end}}

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Before After
Before After

View file

@ -1,3 +1 @@
{{define "svg/mosquito"}}
<svg height="48" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 264.678 264.678" width="48" xml:space="preserve"><path d="M258.628 123.119c0-16.085-28.859-24.501-57.366-24.501-10.194 0-20.424 1.082-29.372 3.201l8.358-5.093a4.99 4.99 0 0 0 2.393-4.259l.009-24.538 26.084-26.963a4.99 4.99 0 1 0-7.173-6.939L174.074 62.44a5 5 0 0 0-1.404 3.467l-.009 23.754-23.045 14.044c-1.428-2.844-3.169-5.309-5.154-7.291 4.238-3.568 6.941-8.905 6.941-14.866 0-8.855-5.958-16.331-14.07-18.666l-.006-57.892a4.99 4.99 0 1 0-9.98 0l.007 57.702c-8.489 2.081-14.815 9.734-14.815 18.856 0 6.153 2.884 11.637 7.361 15.201-1.851 1.924-3.485 4.27-4.836 6.96l-23.05-14.048-.007-23.754a5 5 0 0 0-1.404-3.468l-27.49-28.413a4.99 4.99 0 0 0-7.173 6.939l26.087 26.962.007 24.538a4.99 4.99 0 0 0 2.393 4.259l8.357 5.093c-8.948-2.119-19.179-3.201-29.373-3.201-28.505 0-57.362 8.416-57.362 24.501 0 16.089 28.857 24.508 57.362 24.508 13.913 0 27.901-2.012 38.585-5.936l-16.672 13.933a4.99 4.99 0 0 0-1.79 3.829v23.614l-25.959 26.72a4.99 4.99 0 0 0 7.157 6.954l27.371-28.172a5 5 0 0 0 1.411-3.477v-23.306l22.015-18.399c.274.51.542 1.026.839 1.512a28 28 0 0 0 2.276 3.209l-20.22 16.884a5 5 0 0 0-1.792 3.83v44.042l-36.329 43.633a4.99 4.99 0 1 0 7.669 6.385l37.484-45.021a5 5 0 0 0 1.155-3.193v-43.513l7.711-6.439c-2.337 7.588-3.529 16.608-3.527 25.586 0 22.386 7.401 45.047 21.546 45.047 14.138 0 21.542-22.661 21.548-45.047-.001-8.976-1.196-17.993-3.536-25.58l7.705 6.433.002 43.513c0 1.167.408 2.296 1.155 3.193l37.481 45.021a4.98 4.98 0 0 0 3.838 1.797 4.989 4.989 0 0 0 3.831-8.182l-36.326-43.633-.002-44.042a4.99 4.99 0 0 0-1.792-3.83l-20.226-16.889c1.266-1.532 2.406-3.281 3.403-5.207l22.603 18.89v23.306c0 1.299.506 2.546 1.411 3.477l27.37 28.172a4.98 4.98 0 0 0 3.579 1.513 4.989 4.989 0 0 0 3.579-8.467l-25.96-26.72v-23.614a4.99 4.99 0 0 0-1.79-3.829l-16.022-13.391c10.472 3.569 23.804 5.393 37.063 5.393 28.514.002 57.373-8.416 57.373-24.505m-9.98 0c0 5.784-18.899 14.528-47.386 14.528-28.438 0-47.317-8.718-47.373-14.502v-.052c.056-5.781 18.934-14.495 47.373-14.495 28.487 0 47.386 8.74 47.386 14.521M132.35 145.25h-.013c-2.58.001-5.296-2.023-7.449-5.552-2.616-4.286-4.116-10.329-4.116-16.577.002-3.846.542-7.335 1.43-10.363.025-.069.037-.141.059-.211 2.142-7.12 6.26-11.565 10.076-11.565 3.762.003 7.821 4.301 9.99 11.224.049.201.092.401.166.597.878 3.007 1.412 6.468 1.415 10.28l-.002.036.002.035c-.014 13.023-6.097 22.096-11.558 22.096m-.377-73.156c5.211 0 9.45 4.241 9.45 9.455 0 5.212-4.239 9.453-9.45 9.453-5.213 0-9.454-4.241-9.454-9.453 0-5.214 4.241-9.455 9.454-9.455M16.031 123.119c0-5.781 18.898-14.521 47.382-14.521s47.38 8.74 47.38 14.521c0 5.784-18.897 14.528-47.38 14.528-28.484-.001-47.382-8.745-47.382-14.528m116.313 102.25c-3.925 0-11.566-12.377-11.566-35.068-.006-22.688 7.634-35.068 11.555-35.071 3.929.002 11.576 12.384 11.579 35.071-.006 22.691-7.645 35.068-11.568 35.068"/><g/><g/><g/><g/><g/><g/><g/><g/><g/><g/><g/><g/><g/><g/><g/></svg>
{{end}}

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Before After
Before After

View file

@ -1,3 +1 @@
{{define "svg/pond"}}
<svg height="48" viewBox="0 0 64 64" width="48" xmlns="http://www.w3.org/2000/svg"><path d="M20.297 53.908c-6.133-2.036-10.184-5.6-11.113-9.779a1 1 0 0 0-1.953.434c1.086 4.883 5.619 8.981 12.436 11.244a1 1 0 0 0 .63-1.9m35.416-14.168c-1.257.242-.67 1.633-.715 2.511a10.02 10.02 0 0 1-3.659 7.432 1 1 0 0 0 1.342 1.483A11.96 11.96 0 0 0 57 42.25c-.037-.934.087-2.664-1.286-2.511"/><path d="M40.408 50.665c-9.443 2.903-28.27-.618-27.38-9.017a1 1 0 0 0-.707-1.117c-12.33-3.97-4.72-11.596 6.661-11.466.835-.116 1.951.344 2.744-.145a19.2 19.2 0 0 1 7.488-3.213 1 1 0 0 0-.455-1.948 21.6 21.6 0 0 0-7.982 3.362c-.306-.019-.586-.019-.879-.028.101-5.037 2.57-6.454 2.7-6.524a1 1 0 0 0-.906-1.784c-.152.076-3.679 1.928-3.793 8.308q-.64.024-1.261.077v-6.213a3 3 0 0 0 2-2.817v-5.002a3 3 0 0 0-2-2.817V9.136a1 1 0 1 0-2.001 0v1.185a3 3 0 0 0-2.001 2.817v5.002a3 3 0 0 0 2 2.817v6.447q-.863.137-1.678.327c-.224-8.014-3.43-10.932-3.572-11.056a1 1 0 0 0-1.324 1.5c.029.027 2.833 2.684 2.91 10.126q-.664.225-1.28.485c-.356-5.796-3.621-7.506-3.768-7.58a1.001 1.001 0 0 0-.907 1.784c.11.059 2.7 1.51 2.71 6.804-6.39 3.881-4.08 10.159 3.252 12.411-.03 6.447 9.207 11.453 21.009 11.46a36.6 36.6 0 0 0 8.908-1.06 1 1 0 0 0-.488-1.94M14.637 13.138a1 1 0 0 1 2 0v5.002a1 1 0 0 1-2 0zm33.637 10.417c.258-4.6 2.555-5.92 2.68-5.987a1 1 0 0 0 .437-1.337c-.826-1.798-4.67 1.11-5.1 6.962a42 42 0 0 0-1.284-.188c.147-7.188 2.855-9.787 2.903-9.832a1 1 0 0 0-1.324-1.5c-.142.124-3.366 3.059-3.573 11.125q-.64-.05-1.295-.083c-.242-6.239-4.278-9.306-5.11-7.494a1.007 1.007 0 0 0 .423 1.345c.105.057 2.455 1.381 2.687 6.082-.243-.003-.481-.015-.727-.015a47 47 0 0 0-6.134.388 1 1 0 1 0 .263 1.984c9.657-1.604 24.885 1.652 24.879 6.791 0 2.128-2.936 4.306-7.663 5.683a1.007 1.007 0 0 0-.519 1.563c2.994 4.326-.014 7.874-5.554 10.341a1.006 1.006 0 0 0 .391 1.922c6.376-2.376 10.087-7.11 7.507-12.304C57.162 37.294 60 34.706 60 31.796c0-3.674-4.73-6.77-11.726-8.24"/><path d="M54.098 32.343a1 1 0 0 0 1.66-1.116c-1.281-1.907-7.331-4.593-16.767-4.593-8.345 0-13.834 2.066-16 3.835l-.923.755c-.95-.07-2.185-.168-3.086-.158-6.13 0-10.281 2.212-10.92 3.808a1.013 1.013 0 0 0 .93 1.388.98.98 0 0 0 .916-.618c.425-1 5.669-3.076 10.825-2.51l1.588.114c.574.114 1.514-.95 1.937-1.23 6.285-4.903 25.621-4.068 29.84.325m-29.113 4.806h-2.001a1 1 0 0 0 0 2h2a1 1 0 0 0 0-2m2.002 7.003h2a1 1 0 0 0 0-2.001h-2a1 1 0 0 0 0 2m-10.005-7.002h-2a1 1 0 0 0 0 2h2a1 1 0 0 0 0-2m2.001 7.003h2.001a1 1 0 0 0 0-2.001h-2a1 1 0 0 0 0 2m12.005 5.003h2a1 1 0 0 0 0-2.001h-2a1 1 0 0 0 0 2m5.002-5.001a1 1 0 0 0 0-2.001h-2.001a1 1 0 1 0 0 2zm2 5.002h2.001a1 1 0 1 0 0-2.001h-2a1 1 0 0 0 0 2"/><path d="M48.245 36.148c0-3.034-2.975-5.502-6.633-5.502a6.87 6.87 0 0 0-5.824 2.892A1.007 1.007 0 0 0 36.246 35l2.76 1.147-2.76 1.147a1.007 1.007 0 0 0-.458 1.465 6.87 6.87 0 0 0 5.824 2.89c3.658 0 6.633-2.468 6.633-5.502m-6.249.924a1.007 1.007 0 0 0 0-1.848l-3.675-1.527c2.462-2.114 7.953-.837 7.923 2.451.029 3.288-5.46 4.565-7.923 2.451z"/></svg>
{{end}}

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Before After
Before After

View file

@ -23,7 +23,7 @@ func buildTemplate(files ...string) *html.BuiltTemplate {
for _, c := range components {
full_files = append(full_files, fmt.Sprintf("%s/template/components/%s.html", subdir, c))
}
return html.NewBuiltTemplate(embeddedFiles, "sync/", full_files...)
return html.NewBuiltTemplate(embeddedFiles, "sync/", []string{}, full_files...)
}
// Respond with an error that is visible to the user