You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
683 B

  1. // Copyright 2020 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. // +build bindata
  5. package svg
  6. import (
  7. "path/filepath"
  8. "code.gitea.io/gitea/modules/public"
  9. )
  10. // Discover returns a map of discovered SVG icons in bindata
  11. func Discover() map[string]string {
  12. svgs := make(map[string]string)
  13. for _, file := range public.AssetNames() {
  14. matched, _ := filepath.Match("img/svg/*.svg", file)
  15. if matched {
  16. content, err := public.Asset(file)
  17. if err == nil {
  18. filename := filepath.Base(file)
  19. svgs[filename[:len(filename)-4]] = string(content)
  20. }
  21. }
  22. }
  23. return svgs
  24. }