aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-06-26 19:33:57 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-06-26 19:33:57 +0200
commit9ab7da31f5506250ab51254877c01489df576e8c (patch)
tree6499fbf1c1014b391f26a8b443963e253687e3c3
parentAdd breadcrumbs. (diff)
downloadmuppet-strings-9ab7da31f5506250ab51254877c01489df576e8c.tar.gz
muppet-strings-9ab7da31f5506250ab51254877c01489df576e8c.tar.xz
Upstream markdown files now rendered within template.
-rw-r--r--muppet/output.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/muppet/output.py b/muppet/output.py
index 676bbb4..242b3b5 100644
--- a/muppet/output.py
+++ b/muppet/output.py
@@ -352,14 +352,22 @@ def setup_module(base: str, module: ModuleEntry, *, path_base: str) -> None:
name, _ = os.path.splitext(filename)
with open(filepath) as f:
raw_content = f.read()
- content = commonmark(raw_content)
- out_path = os.path.join(path, f'{name}.html')
+ pathlib.Path(os.path.join(path, name)).mkdir(exist_ok=True)
+ out_path = os.path.join(path, name, 'index.html')
+
+ content = commonmark(raw_content)
+ template = jinja.get_template('content.html')
+ crumbs = breadcrumbs(('Environment', ''),
+ module.name,
+ name)
with open(out_path, 'w') as f:
- f.write(content)
+ f.write(template.render(content=content,
+ path_base=path_base,
+ breadcrumbs=crumbs))
- doc_files[name] = os.path.join(module.name, f'{name}.html')
+ doc_files[name] = os.path.join(module.name, name, 'index.html')
setup_module_index(base=path,
module=module,