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

@ -20,6 +20,7 @@ from jinja2 import (
from pelican.cache import FileStampDataCacher
from pelican.contents import Article, Page, Static
from pelican.plugins import signals
from pelican.plugins._utils import plugin_enabled
from pelican.readers import Readers
from pelican.utils import (
DateFormatter,
@ -102,6 +103,9 @@ class Generator:
# get custom Jinja tests from user settings
custom_tests = self.settings["JINJA_TESTS"]
self.env.tests["plugin_enabled"] = partial(
plugin_enabled, plugin_list=self.settings["PLUGINS"]
)
self.env.tests.update(custom_tests)
signals.generator_init.send(self)