build_pygments_data: Include zulip specific data in langs.

This fixes a bug where the typeahead did not include the
zulip specific langs (such a `quote`, `spoiler` and `math`)
as these weren't passed to the typeahead's source.

Introduced in af64c52166.

Fixes #16862.
This commit is contained in:
ryanreh99 2020-12-12 07:21:10 +05:30 committed by Tim Abbott
parent 2ab0b3d4fc
commit 10559c05ee
2 changed files with 10 additions and 3 deletions

View File

@ -5,10 +5,10 @@ import os
from pygments.lexers import get_all_lexers
ZULIP_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../')
PRIORITIES_PATH = os.path.join(ZULIP_PATH, 'tools', 'setup', 'lang.json')
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(PRIORITIES_PATH) as f:
with open(DATA_PATH) as f:
priorities = json.load(f)
lexers = get_all_lexers()
@ -21,5 +21,12 @@ langs = {
for alias in aliases
}
for name in priorities:
if langs.get(name) is None:
langs[name] = {
'priority': priorities[name],
'pretty_name': name,
}
with open(OUT_PATH, 'w') as f:
json.dump({"langs": langs}, f)

View File

@ -43,4 +43,4 @@ API_FEATURE_LEVEL = 35
# historical commits sharing the same major version, in which case a
# minor version bump suffices.
PROVISION_VERSION = '117.3'
PROVISION_VERSION = '118.0'