diff --git a/__init__.py b/__init__.py index c1a56a6..f6811dd 100644 --- a/__init__.py +++ b/__init__.py @@ -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" ) diff --git a/log.py b/log.py index 06473ac..76b42e4 100644 --- a/log.py +++ b/log.py @@ -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()