Skip to content

Commit 9d0d95a

Browse files
committed
add fixture for custom doc dir
1 parent 18a124c commit 9d0d95a

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

mkdocs_git_authors_plugin/plugin.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,16 @@ def on_files(
118118
if exclude(file.src_path, excluded_pages):
119119
continue
120120

121-
if not hasattr(file, 'src_dir') or file.src_dir is None:
122-
logger.debug(
123-
f"[git-authors-plugin] Unable to find path for file {file.src_path}. "
124-
"Generated, in-memory files won't have a git history."
125-
)
126-
elif hasattr(file, "generated_by") and file.generated_by:
121+
if hasattr(file, "generated_by") and file.generated_by:
127122
logger.debug(
128123
f"[git-authors-plugin] The file {file.src_path} was generated by {file.generated_by}. "
129124
"Generated, dynamic files won't have a git history."
130125
)
126+
elif not hasattr(file, 'src_dir') or file.src_dir is None:
127+
logger.debug(
128+
f"[git-authors-plugin] Unable to find path for file {file.src_path}. "
129+
"Generated, in-memory files won't have a git history."
130+
)
131131
elif path := file.abs_src_path:
132132
if path.endswith(".md"):
133133
_ = self.repo().page(path)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# homepage
2+
3+
this is the homepage
4+
5+
Page authors: {{ git_page_authors }}
6+
7+
Site authors: {{ git_site_authors }}

tests/custom_docs_dir/mkdocs.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
site_name: test gitauthors_plugin
2+
use_directory_urls: true
3+
4+
docs_dir: documentation
5+
6+
plugins:
7+
- search
8+
- git-authors

0 commit comments

Comments
 (0)