mgeier / sphinx-last-updated-by-git

:watch: Get the "last updated" time for each Sphinx page from Git
BSD 2-Clause "Simplified" License
44 stars 9 forks source link

Add exclude_patterns feature based on sphinx Matcher #43

Closed n-peugnet closed 2 years ago

n-peugnet commented 2 years ago

Another option similar to #41 to ignore some changes in dates. This is especially useful for ignoring files in dependencies. This way the date does not change if an ignored dependent file is updated.

My current use case would be to ignore the docutils.conf file, as I it is added as a dependency by Sphinx to all documents, but I only want to reflect content changes in the "last updated date". The current implementation uses fnmatch so some kinds of wildcard patterns are accepted. In my case I would use the following in conf.py:

git_ignored_files = [
    '*/docutils.conf',
]

As for #41, the name of the config key can be changed, and docs will follow after a first review of the patch, just to see if you are willing to accept these changes.

mgeier commented 2 years ago

the name of the config key can be changed

Are you aware of https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-exclude_patterns?

Maybe a similar name could be chosen? Maybe git_exclude_patterns?

n-peugnet commented 2 years ago

@mgeier I updated this PR based on your comments (thank you for your great reviews by the way) and added tests and docs. I can squash the commits and fix the anticipated conflicts if needed.

mgeier commented 2 years ago

I can squash the commits

No need, Github did that for me.

Thanks again for your contribution!