mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
Keep (add if not existing) xmlns attribute for generated SVG images (#23410)
Fix #23409 Developers could browse & preview the local SVG images files directly. It still has clear output.   --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: delvh <leon@kske.dev>
This commit is contained in:
parent
34a2cf5079
commit
a797b8458e
343 changed files with 357 additions and 343 deletions
|
@ -25,6 +25,12 @@ const defaultSize = 16
|
|||
// Init discovers SVGs and populates the `SVGs` variable
|
||||
func Init() {
|
||||
SVGs = Discover()
|
||||
|
||||
// Remove `xmlns` because inline SVG does not need it
|
||||
r := regexp.MustCompile(`(<svg\b[^>]*?)\s+xmlns="[^"]*"`)
|
||||
for name, svg := range SVGs {
|
||||
SVGs[name] = r.ReplaceAllString(svg, "$1")
|
||||
}
|
||||
}
|
||||
|
||||
// Render render icons - arguments icon name (string), size (int), class (string)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue