Skip to content

Commit 59f8e17

Browse files
authored
Merge pull request #31 from timvink/replace_config_choice
replace config_options.Choice
2 parents f639bf2 + fdd2e1e commit 59f8e17

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

mkdocs_git_authors_plugin/git/repo.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,14 @@ def set_config(self, plugin_config):
136136
Args:
137137
- plugin_config: dictionary
138138
"""
139-
self._config = plugin_config
139+
config = plugin_config.copy()
140+
if config['sort_authors_by_name'] is True:
141+
config['sort_authors_by'] = 'name'
142+
else:
143+
config['sort_authors_by'] = 'contribution'
144+
145+
del config['sort_authors_by_name']
146+
self._config = config
140147

141148
def _sort_key(self, author):
142149
"""

mkdocs_git_authors_plugin/plugin.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ class GitAuthorsPlugin(BasePlugin):
1010
('show_contribution', config_options.Type(bool, default=False)),
1111
('show_line_count', config_options.Type(bool, default=False)),
1212
('count_empty_lines', config_options.Type(bool, default=True)),
13-
('sort_authors_by', config_options.Choice(
14-
['name', 'contribution'], default='name')
15-
),
13+
('sort_authors_by_name', config_options.Type(bool, default=True)),
1614
('sort_reverse', config_options.Type(bool, default=False))
1715
)
1816

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"Operating System :: OS Independent",
2222
],
2323
install_requires=[
24-
'mkdocs>=1.1'
24+
'mkdocs>=1.0'
2525
],
2626
packages=find_packages(),
2727
entry_points={

tests/test_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
'show_contribution': False,
3131
'show_line_count': False,
3232
'count_empty_lines': True,
33-
'sort_authors_by': 'name',
33+
'sort_authors_by_name': True,
3434
'sort_reverse': False
3535
}
3636

0 commit comments

Comments
 (0)