Skip to content

Commit 7ac4f54

Browse files
committed
fix
1 parent dad057b commit 7ac4f54

File tree

327 files changed

+332
-326
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

327 files changed

+332
-326
lines changed

build/generate-svg.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ async function processFile(file, {prefix, fullName} = {}) {
2525
if (prefix === 'octicon') name = name.replace(/-[0-9]+$/, ''); // chop of '-16' on octicons
2626
}
2727

28+
// keep the xmlns attribute to make the files could be displayed by local browsers/image-viewers
2829
const {data} = optimize(await readFile(file, 'utf8'), {
2930
plugins: [
3031
{name: 'preset-default'},
31-
{name: 'removeXMLNS'},
3232
{name: 'removeDimensions'},
3333
{name: 'prefixIds', params: {prefix: () => name}},
3434
{name: 'addClassesToSVGElement', params: {classNames: ['svg', name]}},

modules/svg/svg.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ const defaultSize = 16
2525
// Init discovers SVGs and populates the `SVGs` variable
2626
func Init() {
2727
SVGs = Discover()
28+
29+
// inline SVG rendering doesn't need `xmlns`
30+
r := regexp.MustCompile(`(<svg\b[^>]*?)\s+xmlns="[^"]*"`)
31+
for name, svg := range SVGs {
32+
SVGs[name] = r.ReplaceAllString(svg, "$1")
33+
}
2834
}
2935

3036
// Render render icons - arguments icon name (string), size (int), class (string)

public/img/svg/fontawesome-openid.svg

Lines changed: 1 addition & 1 deletion
Loading

public/img/svg/fontawesome-send.svg

Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading

public/img/svg/gitea-cargo.svg

Lines changed: 1 addition & 1 deletion
Loading

public/img/svg/gitea-chef.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)