1111
1212logger = logging .getLogger ("mkdocs.plugins" )
1313
14+
1415class GitAuthorsPlugin (BasePlugin ):
1516 config_scheme = (
1617 ("show_contribution" , config_options .Type (bool , default = False )),
@@ -49,17 +50,17 @@ def on_config(self, config, **kwargs):
4950 Returns:
5051 (updated) configuration object
5152 """
52- if not self .config .get (' enabled' ):
53+ if not self .config .get (" enabled" ):
5354 return config
54-
55- assert self .config [' authorship_threshold_percent' ] >= 0
56- assert self .config [' authorship_threshold_percent' ] <= 100
55+
56+ assert self .config [" authorship_threshold_percent" ] >= 0
57+ assert self .config [" authorship_threshold_percent" ] <= 100
5758
5859 try :
5960 self ._repo = Repo ()
6061 self ._fallback = False
6162 self .repo ().set_config (self .config )
62- raise_ci_warnings (path = self .repo ()._root )
63+ raise_ci_warnings (path = self .repo ()._root )
6364 except GitCommandError :
6465 if self .config ["fallback_to_empty" ]:
6566 self ._fallback = True
@@ -97,18 +98,18 @@ def on_files(self, files, config, **kwargs):
9798 Returns:
9899 global files collection
99100 """
100- if not self .config .get (' enabled' ):
101+ if not self .config .get (" enabled" ):
101102 return
102103 if self ._fallback :
103104 return
104-
105+
105106 for file in files :
106107
107108 # Exclude pages specified in config
108109 excluded_pages = self .config .get ("exclude" , [])
109110 if exclude (file .src_path , excluded_pages ):
110111 continue
111-
112+
112113 path = file .abs_src_path
113114 if path .endswith (".md" ):
114115 _ = self .repo ().page (path )
@@ -136,9 +137,9 @@ def on_page_content(self, html, page, config, files, **kwargs):
136137 Returns:
137138 str: HTML text of page as string
138139 """
139- if not self .config .get (' enabled' ):
140+ if not self .config .get (" enabled" ):
140141 return html
141-
142+
142143 # Exclude pages specified in config
143144 excluded_pages = self .config .get ("exclude" , [])
144145 if exclude (page .file .src_path , excluded_pages ):
@@ -150,8 +151,10 @@ def on_page_content(self, html, page, config, files, **kwargs):
150151 )
151152 if list_pattern .search (html ):
152153 html = list_pattern .sub (
153- "" if self ._fallback else
154- util .site_authors_summary (self .repo ().get_authors (), self .config ), html
154+ ""
155+ if self ._fallback
156+ else util .site_authors_summary (self .repo ().get_authors (), self .config ),
157+ html ,
155158 )
156159
157160 # Replace {{ git_page_authors }}
@@ -191,7 +194,7 @@ def on_page_context(self, context, page, config, nav, **kwargs):
191194 Returns:
192195 dict: template context variables
193196 """
194- if not self .config .get (' enabled' ):
197+ if not self .config .get (" enabled" ):
195198 return context
196199 if self ._fallback :
197200 return context
0 commit comments