Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OO refactoring and git-blame preloading #12

Merged
merged 28 commits into from
Mar 4, 2020
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b41e299
Remove GitPython dependency
uliska Mar 1, 2020
f90ef72
Object oriented refactoring
uliska Mar 2, 2020
558dfc3
Preload git blame data
uliska Mar 2, 2020
7dbec73
Merge remote-tracking branch 'origin/master' into preload-blame
uliska Mar 2, 2020
f37c9f8
Handle uncommitted changes
uliska Mar 2, 2020
98bffc3
Document uncommitted_changes
uliska Mar 2, 2020
2739240
Add {{ git_authors_list }} (book-level summary)
uliska Mar 3, 2020
0869525
Make sort order configurable
uliska Mar 3, 2020
bc2fa53
Fix tracebacks with uncommitted files
uliska Mar 3, 2020
ca06d20
Add option count_empty_lines
uliska Mar 3, 2020
bac88c0
Remove obsolete counter variable
uliska Mar 3, 2020
251adc3
Rename show_lines to show_line_count
uliska Mar 3, 2020
0da9409
Rename sort_by to sort_authors_by
uliska Mar 3, 2020
e5c54ed
Clean up plugin events signature and docstrings
uliska Mar 3, 2020
bbba457
Add lines_all_pages and contribution_all_pages to page context
uliska Mar 3, 2020
7b178dc
Rename authors() to get_authors()
uliska Mar 3, 2020
270cc1f
Remove (unused) function Repo.root()
uliska Mar 3, 2020
7f1726c
Use repo argument directly in Commit.__init__
uliska Mar 3, 2020
422653b
Proper comment for populating uncommitted lines
uliska Mar 3, 2020
acd4506
Remove Commit.sha()
uliska Mar 3, 2020
71eeae2
Factor out commit_datetime function
uliska Mar 3, 2020
d5f6159
Rename Page._execute to _process_git_blame
uliska Mar 3, 2020
709b0e0
Rename Repo.commit() to Repo.get_commit()
uliska Mar 3, 2020
e6c6a8b
Remove localization config variables
uliska Mar 3, 2020
65d1779
Wrap authors list in a <span>
uliska Mar 4, 2020
4a208dc
Clarify event order in on_files
uliska Mar 4, 2020
ba91edd
Format repo_authors list in util
uliska Mar 4, 2020
6f5822c
Use --porcelain version of git blame
uliska Mar 4, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions mkdocs_git_authors_plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ class GitAuthorsPlugin(BasePlugin):
def __init__(self):
self._repo = Repo()

def on_files(self, files, **kwargs):
uliska marked this conversation as resolved.
Show resolved Hide resolved
"""
Preprocess all markdown pages in the project

This populates all the lines and total_lines properties
of the pages and the repository, so the total
contribution of an author to the repository can be
retrieved on *any* Markdown page.
timvink marked this conversation as resolved.
Show resolved Hide resolved
"""
cnt = 0
timvink marked this conversation as resolved.
Show resolved Hide resolved
for file in files:
path = file.abs_src_path
if path.endswith('.md'):
cnt += 1
_ = self.repo().page(path)

def on_page_markdown(self, markdown, page, config, files):
"""
Replace jinja tag {{ git_authors_summary }} in markdown.
Expand Down