Skip to content

Commit e3d5474

Browse files
committed
Add committers-source github/gitlab in page context, remove it from author
1 parent 1c1ff87 commit e3d5474

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

mkdocs_git_committers_plugin_2/plugin.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ def get_contributors_to_file(self, path):
106106
authors.append({'login': commit['author']['login'],
107107
'name': commit['author']['login'],
108108
'url': commit['author']['html_url'],
109-
'avatar': commit['author']['avatar_url'],
110-
'source': 'github'})
109+
'avatar': commit['author']['avatar_url']
110+
})
111111
else:
112112
# GitLab
113113
if commit['author_name']:
@@ -118,8 +118,8 @@ def get_contributors_to_file(self, path):
118118
authors.append({'login': self.gitlabauthors_cache[commit['author_name']]['username'],
119119
'name': commit['author_name'],
120120
'url': self.gitlabauthors_cache[commit['author_name']]['web_url'],
121-
'avatar': self.gitlabauthors_cache[commit['author_name']]['avatar_url'],
122-
'source': 'gitlab'})
121+
'avatar': self.gitlabauthors_cache[commit['author_name']]['avatar_url']
122+
})
123123
else:
124124
# Fetch author from GitLab API
125125
url = self.gitlaburl + "/users?search=" + requests.utils.quote(commit['author_name'])
@@ -135,8 +135,8 @@ def get_contributors_to_file(self, path):
135135
authors.append({'login': user['username'],
136136
'name': user['name'],
137137
'url': user['web_url'],
138-
'avatar': user['avatar_url'],
139-
'source': 'gitlab'})
138+
'avatar': user['avatar_url']
139+
})
140140
break
141141
else:
142142
LOG.error("git-committers: " + str(r.status_code) + " " + r.reason)
@@ -192,6 +192,10 @@ def on_page_context(self, context, page, config, nav):
192192
context['committers'] = authors
193193
if last_commit_date:
194194
context['last_commit_date'] = last_commit_date
195+
if not self.config['gitlab_repository']:
196+
context['committers-source'] = 'github'
197+
else:
198+
context['committers-source'] = 'gitlab'
195199
end = timer()
196200
self.total_time += (end - start)
197201

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
setup(
1111
name="mkdocs-git-committers-plugin-2",
12-
version="2.2.0",
12+
version="2.2.1",
1313
description="An MkDocs plugin to create a list of contributors on the page. The git-committers plugin will seed the template context with a list of GitHub or GitLab committers and other useful GIT info such as last modified date",
1414
long_description=long_description,
1515
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)