Make Print\ Classes.py print all lines

This commit is contained in:
Out Of Ideas 2024-05-21 21:44:26 -05:00
parent f095f230e3
commit e0d17d68c8

View file

@ -11,12 +11,13 @@ def get_class_definitions():
def parse_class_definitions(class_definitions):
class_colors = {}
pattern = r'\s*\.(.*?) {.*?color: (.*?);.*?/\* (.*?) \*/'
pattern = r'\s*\.(.*?) {.*?color: (#[0-9A-Fa-f]+).*?}(?: /\* (.*?) \*/)?'
matches = re.findall(pattern, class_definitions)
for match in matches:
class_name, color, comment = match
if not class_name.startswith("linenos"):
class_colors[class_name] = (color, comment.strip())
comment = comment.strip() if comment else ""
class_colors[class_name] = (color, comment)
return class_colors
def main():
@ -26,7 +27,10 @@ def main():
print("# Define colors for different classes (modify as needed)")
print("class_colors = {")
for class_name, (color, comment) in class_colors.items():
print(f" \"{class_name}\": \"{color}\", # {comment}")
if comment:
print(f' "{class_name}": "{color}", # {comment}')
else:
print(f' "{class_name}": "{color}",')
print("}")
else:
print("No class definitions found.")