Commit a30b55e0 authored by Joseph Walton-Rivers's avatar Joseph Walton-Rivers 🍪

fix handling of subdirectories fixes #7

parent 0ddadcc5
Pipeline #2143 failed with stages
in 1 minute and 3 seconds
...@@ -4,6 +4,8 @@ import pathlib ...@@ -4,6 +4,8 @@ import pathlib
import shutil import shutil
import jinja2 import jinja2
import logging
from j2static import build from j2static import build
from j2static.tools.merge import load_data from j2static.tools.merge import load_data
...@@ -34,9 +36,12 @@ def generate(args): ...@@ -34,9 +36,12 @@ def generate(args):
if generator.filter(path): if generator.filter(path):
context = [] context = []
data_file = data_path / (relative_path.stem + ".json") data_file = data_path / relative_path.parent / (relative_path.stem + ".json")
if data_file.exists(): if data_file.exists():
context = load_data(data_file) context = load_data(data_file)
else:
logging.info("data file not found %s", data_file)
try: try:
generator.generate(str(relative_path), out_file, context=context) generator.generate(str(relative_path), out_file, context=context)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment