Skip to content

common/highlightjs: Turn some global variables into functions

The _hljs_languages* global variables content rely on reading a JSON file located through Django static finders.

As a side effect, when the module is imported, the JSON file is located then read.

When the DJANGO_SETTINGS_MODULE environment variable is not set, the module import will fail as the JSON file could not be located.

So avoid to execute that JSON loading code when importing the module by turning the global variables into functions.

The purpose is to avoid import errors when running sphinx autodoc.


Migrated from D5563 (view on Phabricator)

Merge request reports