1717import re
1818from bs4 import BeautifulSoup as bs
1919
20+ from mkdocs_git_committers_plugin_2 .exclude import exclude
21+
2022LOG = logging .getLogger ("mkdocs.plugins." + __name__ )
2123
2224class GitCommittersPlugin (BasePlugin ):
@@ -28,6 +30,7 @@ class GitCommittersPlugin(BasePlugin):
2830 ('docs_path' , config_options .Type (str , default = 'docs/' )),
2931 ('enabled' , config_options .Type (bool , default = True )),
3032 ('cache_dir' , config_options .Type (str , default = '.cache/plugin/git-committers' )),
33+ ("exclude" , config_options .Type (list , default = [])),
3134 )
3235
3336 def __init__ (self ):
@@ -36,6 +39,7 @@ def __init__(self):
3639 self .enabled = True
3740 self .authors = dict ()
3841 self .cache_page_authors = dict ()
42+ self .exclude = list ()
3943 self .cache_date = ''
4044
4145 def on_config (self , config ):
@@ -55,9 +59,13 @@ def on_config(self, config):
5559 self .githuburl = "https://github.com/"
5660 self .localrepo = Repo ("." )
5761 self .branch = self .config ['branch' ]
62+ self .excluded_pages = self .config ['exclude' ]
5863 return config
5964
6065 def list_contributors (self , path ):
66+ if exclude (path .lstrip (self .config ['docs_path' ]), self .excluded_pages ):
67+ return None , None
68+
6169 last_commit_date = ""
6270 path = path .replace ("\\ " , "/" )
6371 for c in Commit .iter_items (self .localrepo , self .localrepo .head , path ):
0 commit comments