build_pygments_data: Reprioritize and categorize pygment language codes.

We now organize the pygment language codes into meaningful categories
- default, custom and aliases.

Further the `lang.json` list now contains a dataset extracted from the
"language" section of https://insights.stackoverflow.com/survey/2020
and is prioritized based on current language trends.
This commit is contained in:
Sumanth V Rao
2021-05-14 17:08:14 +05:30
committed by Tim Abbott
parent 98253f261e
commit 83a2479a5a
4 changed files with 56 additions and 67 deletions

View File

@@ -5,11 +5,15 @@ import os
from pygments.lexers import get_all_lexers
ZULIP_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../")
# The current priorities data set is based on StackOverflow's 2020 survey.
DATA_PATH = os.path.join(ZULIP_PATH, "tools", "setup", "lang.json")
OUT_PATH = os.path.join(ZULIP_PATH, "static", "generated", "pygments_data.json")
with open(DATA_PATH) as f:
priorities = json.load(f)
pygments_data = json.load(f)
priorities = dict(
**pygments_data["default"], **pygments_data["custom"], **pygments_data["aliases"]
)
lexers = get_all_lexers()
langs = {