Clean up SVG files and update logos

- Removed unnecessary XML and DOCTYPE declarations from SVG files.
- Eliminated comments within SVG files for cleaner output.
- Trimmed leading and trailing whitespace from SVG content.
- Ensured all SVG files end with a newline character.
- Updated multiple logo SVG files including WireGuard, Wise, WOG, Yahoo, and others to conform to the new standards.
- Enhanced the update-data.js script to automate the cleanup process for SVG files.
This commit is contained in:
sHa
2025-06-19 16:54:55 +03:00
parent e86600b610
commit 1db0f1cbe9
528 changed files with 703 additions and 553 deletions

View File

@@ -190,6 +190,26 @@ function validateAndFixSvg(svgPath) {
let svgContent = fs.readFileSync(svgPath, 'utf8');
let modified = false;
// Clean up SVG content
const originalContent = svgContent;
// Remove XML declaration
svgContent = svgContent.replace(/<\?xml[^>]*\?>\s*/gi, '');
// Remove DOCTYPE declaration
svgContent = svgContent.replace(/<!DOCTYPE[^>]*>\s*/gi, '');
// Remove comments
svgContent = svgContent.replace(/<!--[\s\S]*?-->/g, '');
// Remove leading/trailing whitespace and ensure it starts with <svg
svgContent = svgContent.trim();
if (originalContent !== svgContent) {
modified = true;
console.log(`${path.basename(svgPath)}: Cleaned up SVG (removed XML/DOCTYPE/comments)`);
}
// Parse SVG tag attributes
const svgTagMatch = svgContent.match(/<svg[^>]*>/i);
if (!svgTagMatch) {