mirror of
https://github.com/getpelican/pelican.git
synced 2026-05-31 17:46:56 +02:00
added support for multiple folder themes
This commit is contained in:
parent
3c69dc68d2
commit
6f7fca524c
2 changed files with 12 additions and 1 deletions
|
|
@ -66,11 +66,17 @@ class Generator:
|
|||
# templates cache
|
||||
self._templates = {}
|
||||
self._templates_path = list(self.settings["THEME_TEMPLATES_OVERRIDES"])
|
||||
self._theme_extra_dirs = list(self.settings["THEME_EXTRA_DIRS"])
|
||||
|
||||
theme_templates_path = os.path.expanduser(os.path.join(self.theme, "templates"))
|
||||
self._templates_path.append(theme_templates_path)
|
||||
theme_loader = FileSystemLoader(theme_templates_path)
|
||||
|
||||
for extra_dir in self._theme_extra_dirs:
|
||||
self._templates_path.append(
|
||||
os.path.expanduser(os.path.join(extra_dir, "templates"))
|
||||
)
|
||||
|
||||
theme_loader = FileSystemLoader(theme_templates_path)
|
||||
simple_theme_path = os.path.dirname(os.path.abspath(__file__))
|
||||
simple_loader = FileSystemLoader(
|
||||
os.path.join(simple_theme_path, "themes", "simple", "templates")
|
||||
|
|
|
|||
|
|
@ -213,6 +213,11 @@ def read_settings(
|
|||
if p != "THEME" or os.path.exists(absp):
|
||||
settings[p] = absp
|
||||
|
||||
if settings.get("THEME_EXTRA_DIRS") is not None:
|
||||
settings["THEME_EXTRA_DIRS"] = [
|
||||
getabs(theme_extra_dir) for theme_extra_dir in settings["THEME_EXTRA_DIRS"]
|
||||
]
|
||||
|
||||
if settings.get("PLUGIN_PATHS") is not None:
|
||||
settings["PLUGIN_PATHS"] = [
|
||||
getabs(pluginpath) for pluginpath in settings["PLUGIN_PATHS"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue