chore: revert unintended linter formatting changes

This commit is contained in:
selemondev
2024-10-27 21:51:22 +03:00
parent cf2efef10a
commit 72507987c7
5 changed files with 153 additions and 3 deletions
+26
View File
@@ -0,0 +1,26 @@
export const parseSvgContent = (content: string, framework: 'Vue' | 'Svelte') => {
if (content.includes('<?xml')) {
content = content.replace(/<\?xml[^>]*\?>/i, '');
}
// Regular expression to match <style> tags in the SVG content
const styleTagRegex = /<style[^>]*>([\s\S]*?)<\/style>/gi;
// Extract styles and store them in an array
const styles = [];
let matched;
while ((matched = styleTagRegex.exec(content)) !== null) {
styles.push(matched[1]); // Add the style content (not including the style tag)
}
// Remove <style> tags from the SVG content
const templateContent = content.replace(styleTagRegex, '');
const componentStyle = styles.length
? `<style${framework === 'Vue' ? ' scoped' : ''}>\n${styles.join('\n')}\n</style>`
: '';
return {
componentStyle,
templateContent
};
};