aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-07-01 18:31:34 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-07-01 18:31:34 +0200
commit24e5ad00cc887058e9a92c118b7849aab41043c6 (patch)
tree910d3f1f4c2efdad3a6cb4aebe4ae8b2f6f4ed16
parentwork (diff)
downloadmuppet-strings-24e5ad00cc887058e9a92c118b7849aab41043c6.tar.gz
muppet-strings-24e5ad00cc887058e9a92c118b7849aab41043c6.tar.xz
Don't render non-markdown files.
-rw-r--r--muppet/output.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/muppet/output.py b/muppet/output.py
index 727fe37..9f7f54f 100644
--- a/muppet/output.py
+++ b/muppet/output.py
@@ -8,6 +8,7 @@ import os
import os.path
import pathlib
import json
+import html
from .gather import ModuleEntry
from jinja2 import (
Environment,
@@ -378,7 +379,11 @@ def setup_module(base: str, module: ModuleEntry, *, path_base: str) -> None:
pathlib.Path(os.path.join(path, name)).mkdir(exist_ok=True)
out_path = os.path.join(path, name, 'index.html')
- content = markdown(raw_content)
+ if filename.endswith('.md'):
+ content = markdown(raw_content)
+ else:
+ content = '<pre>' + html.escape(raw_content) + '</pre>'
+
template = jinja.get_template('content.html')
crumbs = breadcrumbs(('Environment', ''),
module.name,