Make Print\ Classes.py print all lines
This commit is contained in:
parent
f095f230e3
commit
e0d17d68c8
1 changed files with 7 additions and 3 deletions
|
@ -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.")
|
||||
|
|
Reference in a new issue