Browse Source

LibGfx/TIFF: Support tag names with capitalized acronym

We now turn 'ICCProfile' into 'icc_profile' instead of 'i_c_c_profile'.
Lucas CHOLLET 1 năm trước cách đây
mục cha
commit
5622e7d77c
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      Userland/Libraries/LibGfx/TIFFGenerator.py

+ 2 - 1
Userland/Libraries/LibGfx/TIFFGenerator.py

@@ -144,7 +144,8 @@ def retrieve_biggest_type(types: List[TIFFType]) -> TIFFType:
 
 
 def pascal_case_to_snake_case(name: str) -> str:
-    return re.sub(r'(?<!^)(?=[A-Z])', '_', name).lower()
+    name = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
+    return re.sub('([a-z0-9])([A-Z])', r'\1_\2', name).lower()
 
 
 def generate_getter(tag: Tag) -> str: