chore: 🧹 better classname extraction
Allow for consecutive uppercase letters: - MTB_BatchFromHistoryV2 -> Batch From History V2 - MTB_CLIPInterpolate -> CLIP Interpolate
This commit is contained in:
+1
-1
@@ -179,7 +179,7 @@ for node_class in nodes:
|
||||
node_class.DESCRIPTION = node_class.__doc__
|
||||
if MTB_EXPORT:
|
||||
wiki_name = classname_to_wiki(class_name)
|
||||
(wiki / "nodes" / wiki_name + ".md").write_text(
|
||||
(wiki / "nodes" / (wiki_name + ".md")).write_text(
|
||||
node_class.__doc__, encoding="utf-8"
|
||||
)
|
||||
|
||||
|
||||
@@ -77,5 +77,11 @@ def cyan_text(text: str):
|
||||
def get_label(label: str):
|
||||
if label.startswith("MTB_"):
|
||||
label = label[4:]
|
||||
words = re.findall(r"(?:^|[A-Z])[a-z]*", label)
|
||||
|
||||
words = re.findall(
|
||||
r"(?:(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|(?<=[A-Za-z])(?=[0-9])|(?<=[0-9])(?=[A-Za-z]))",
|
||||
label,
|
||||
)
|
||||
reformatted_label = re.sub(r"([A-Z]+)", r" \1", label).strip()
|
||||
words = reformatted_label.split()
|
||||
return " ".join(words).strip()
|
||||
|
||||
Reference in New Issue
Block a user