1
0
Fork 0
forked from github/pelican

Provide a plugin_enabled Jinja test for themes

This commit is contained in:
Deniz Turgut 2023-11-01 22:49:15 +03:00
commit feae8ef41c
No known key found for this signature in database
GPG key ID: 87B7168D7AB3ED2F
5 changed files with 143 additions and 1 deletions

View file

@ -40,6 +40,22 @@ def list_plugins(ns_pkg=None):
logger.info("No plugins are installed")
def plugin_enabled(name, plugin_list=None):
if plugin_list is None or not plugin_list:
# no plugins are loaded
return False
if name in plugin_list:
# search name as is
return True
if "pelican.plugins.{}".format(name) in plugin_list:
# check if short name is a namespace plugin
return True
return False
def load_legacy_plugin(plugin, plugin_paths):
if "." in plugin:
# it is in a package, try to resolve package first