Skip to content

Conversation

@kathy239
Copy link
Contributor

I sorted STYLE_MAP in Alphabet order by using the following line of code.
sorted_style_map = dict(sorted(STYLE_MAP.items())).

By the way, may I know that is there any particular reason to make the project team has to keep STYLE_MAP as a constant? I think it's a good idea to handle STYLE_MAP in the following flow.

  1. Read it and sort it in alphabet order upon init.py is run.
  2. Save STYLE_MAP dictionary as a JSON file when the task is done.

Then when people add a new style, they can just write in whatever order they want. The script will sort it in alphabet order automatically.

Thanks xD

Sort STYLE_MAP in Alphabet order.
@jeanas
Copy link
Contributor

jeanas commented May 25, 2023

Then when people add a new style, they can just write in whatever order they want. The script will sort it in alphabet order automatically.

People don't add styles often enough for this to be worth it.

@kathy239
Copy link
Contributor Author

Then when people add a new style, they can just write in whatever order they want. The script will sort it in alphabet order automatically.

People don't add styles often enough for this to be worth it.

Yes I agree. It is not worth. Add more codes = add more chances to make bugs.

@jeanas jeanas merged commit dba4cae into pygments:master May 25, 2023
@Anteru Anteru added this to the 2.16.0 milestone Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants