diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2019-11-11 06:15:16 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2019-11-11 07:14:56 -0500 |
commit | 2cabc80a24e5f1b24e1eea1c39407c3aa60eee9e (patch) | |
tree | d3f0d5c5eb4900637ed80fe021edb1d19daf6c4b /doc/conf.py | |
parent | 12ebfecd95995300caf7cd268bfd96e826552c05 (diff) | |
download | python-coveragepy-git-2cabc80a24e5f1b24e1eea1c39407c3aa60eee9e.tar.gz |
Better auto-spelling of contributors' names
Diffstat (limited to 'doc/conf.py')
-rw-r--r-- | doc/conf.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/doc/conf.py b/doc/conf.py index ea00b6ce..379e15cc 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -17,6 +17,8 @@ import atexit import os +import re +import sys import tempfile # If extensions (or modules to document with autodoc) are in another directory, @@ -189,14 +191,18 @@ htmlhelp_basename = 'coveragepydoc' # -- Spelling --- -names_file = tempfile.NamedTemporaryFile(mode='w', prefix="coverage_names_", suffix=".txt") -with open("../CONTRIBUTORS.txt") as contributors: - names_file.write("\n".join(contributors.read().split())) - names_file.flush() -atexit.register(os.remove, names_file.name) +if any("spell" in arg for arg in sys.argv): + names_file = tempfile.NamedTemporaryFile(mode='w', prefix="coverage_names_", suffix=".txt") + with open("../CONTRIBUTORS.txt") as contributors: + names = set(re.split(r"[^\w']", contributors.read())) + names = [n for n in names if len(n) >= 2 and n[0].isupper()] + names_file.write("\n".join(names)) + names_file.flush() + atexit.register(os.remove, names_file.name) + + spelling_word_list_filename = ['dict.txt', names_file.name] + spelling_show_suggestions = False -spelling_word_list_filename = ['dict.txt', names_file.name] -spelling_show_suggestions = False extlinks = { # :github:`123` becomes a link to the GitHub issue, with text "issue 123". |