chore: Fixes accents replacement regexp.
This commit is contained in:
parent
c42f1962c9
commit
ea44eeb52b
1 changed files with 5 additions and 1 deletions
|
@ -42,13 +42,17 @@ function replaceNameWithAccent(name: string, accentName: string): string {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
export function replaceSVGColour(filecontent: string, colour: string): string {
|
export function replaceSVGColour(filecontent: string, colour: string): string {
|
||||||
return filecontent.replace(new RegExp('.st0\{fill:\s{0,}#([a-zA-Z0-9]{6})\}|path fill="#([a-zA-Z0-9]{6})"'), ($0, $1, $2) => {
|
return filecontent.replace(new RegExp('.st0\{fill:\s{0,}#([a-zA-Z0-9]{6})|path fill="#([a-zA-Z0-9]{6})"'), ($0, $1, $2) => {
|
||||||
|
|
||||||
colour = colour.replace('#', '');
|
colour = colour.replace('#', '');
|
||||||
|
|
||||||
if (!$2) {
|
if (!$2) {
|
||||||
|
console.log(`Replacing colour ${ $1 } with ${ colour }`)
|
||||||
|
|
||||||
return $0.replace($1, colour);
|
return $0.replace($1, colour);
|
||||||
} else {
|
} else {
|
||||||
|
console.log(`Replacing colour ${ $2 } with ${ colour }`)
|
||||||
|
|
||||||
return $0.replace($2, colour);
|
return $0.replace($2, colour);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue