Skip to content

Commit 88a9df3

Browse files
committed
fix: template rendered name for directory discovery
1 parent 10fc5a2 commit 88a9df3

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

jinja_autodoc/autotemplate.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def parse_template_paths(
3535
filepath_collections = [
3636
os.path.join(dirpath, filename)
3737
for dirpath, _, filenames in os.walk(path)
38-
for filename in filenames
38+
for filename in sorted(filenames)
3939
if (not filename_filter or re.match(filename_filter, filename))
4040
]
4141
return list(itertools.chain(filepath_collections))
@@ -66,16 +66,17 @@ def make_rst(self):
6666
template_paths = parse_template_paths(
6767
root_path, env.config["jinja_template_pattern"]
6868
)
69-
raw_docstrings = [parse_jinja_comment(path) for path in template_paths]
70-
docstrings = [
71-
prepare_docstring(raw_docstring)
72-
for raw_docstring in raw_docstrings
73-
if raw_docstring is not None
74-
]
7569
if env.config["jinja_template_path"]:
76-
for docstring in docstrings:
77-
if docstring is not None:
78-
yield from autotemplate_directive(path, docstring)
70+
for template_path in template_paths:
71+
raw_docstring = parse_jinja_comment(template_path)
72+
if raw_docstring is None:
73+
continue
74+
75+
docstring = prepare_docstring(raw_docstring)
76+
if docstring is None:
77+
continue
78+
79+
yield from autotemplate_directive(template_path, docstring)
7980
yield ""
8081

8182
def run(self) -> list[nodes.Node]:

0 commit comments

Comments
 (0)