From 826bc050df95d2e37c4a38ca1db2b3631418d998 Mon Sep 17 00:00:00 2001 From: Andrii Rublov Date: Sun, 25 Jun 2023 22:23:44 +0200 Subject: [PATCH] Camel-case: Add '_' to a separator list Currently, `to_camel_case` takes into account only '-' as a separator (because of CSS' kebab-case). But there are also a lot of places where `_` is used (snake_case), it leads to inconsistent naming issues. --- GenerateIconFontCppHeaders.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GenerateIconFontCppHeaders.py b/GenerateIconFontCppHeaders.py index 7ee066d..4f121ec 100644 --- a/GenerateIconFontCppHeaders.py +++ b/GenerateIconFontCppHeaders.py @@ -131,6 +131,7 @@ import os import sys import logging +import re if sys.version_info[0] < 3: raise Exception( "Python 3 or a more recent version is required." ) @@ -643,7 +644,7 @@ def line_icon( cls, icon ): @classmethod def to_camelcase( cls, text ): - parts = text.split( '-' ) + parts = re.split('[-_]', text) # Split the text using either '-' or '_' as separators for i in range( len( parts ) ): p = parts[i] parts[ i ] = p[ 0 ].upper() + p[ 1: ].lower()