diff -ru sphinxcontrib.orig/spelling/builder.py sphinxcontrib/spelling/builder.py
--- sphinxcontrib.orig/spelling/builder.py 2018-06-20 08:01:51.000000000 -0400
+++ sphinxcontrib/spelling/builder.py 2018-09-25 23:12:15.879647562 -0400
@@ -33,6 +33,8 @@
self.document_data = []
self.misspelling_count = 0
+ if getattr(self, 'env', None) is None:
+ self.load_env()
self.env.settings["smart_quotes"] = False
# Initialize the per-document filters
if not hasattr(self.env, 'spelling_document_filters'):
@@ -64,7 +66,7 @@
os.mkdir(self.outdir)
word_list = self.get_wordlist_filename()
- self.info('Looking for custom word list in {}'.format(word_list))
+ self.info('Looking for custom word list in {0}'.format(word_list))
self.checker = checker.SpellingChecker(
lang=self.config.spelling_lang,
@@ -106,7 +108,7 @@
for word_file in word_list:
# Paths are relative
long_word_file = os.path.join(self.srcdir, word_file)
- self.info('Adding contents of {} to custom word list'.format(
+ self.info('Adding contents of {0} to custom word list'.format(
long_word_file))
with io.open(long_word_file, 'r', encoding='UTF-8') as infile:
infile_contents = infile.readlines()
diff -ru sphinxcontrib.orig/spelling/checker.py sphinxcontrib/spelling/checker.py
--- sphinxcontrib.orig/spelling/checker.py 2018-06-02 12:14:12.000000000 -0400
+++ sphinxcontrib/spelling/checker.py 2018-09-25 22:51:17.383295361 -0400
@@ -20,7 +20,10 @@
tokenizer_lang='en_US', filters=None):
if filters is None:
filters = []
- self.dictionary = enchant.DictWithPWL(lang, word_list_filename)
+ if word_list_filename is None:
+ self.dictionary = enchant.Dict(lang)
+ else:
+ self.dictionary = enchant.DictWithPWL(lang, word_list_filename)
self.tokenizer = get_tokenizer(tokenizer_lang, filters)
self.original_tokenizer = self.tokenizer
self.suggest = suggest
diff -ru sphinxcontrib.orig/spelling/tests/test_builder.py sphinxcontrib/spelling/tests/test_builder.py
--- sphinxcontrib.orig/spelling/tests/test_builder.py 2018-02-20 09:15:16.000000000 -0500
+++ sphinxcontrib/spelling/tests/test_builder.py 2018-09-25 23:14:08.953129845 -0400
@@ -40,7 +40,7 @@
# generate an exception.
Sphinx(
self.srcdir, self.srcdir, self.outdir, self.outdir, 'spelling',
- status=stdout, warning=stderr,
+ {}, stdout, warning=stderr,
freshenv=True,
)
@@ -58,10 +58,10 @@
stderr = StringIO()
app = Sphinx(
self.srcdir, self.srcdir, self.outdir, self.outdir, 'spelling',
- status=stdout, warning=stderr,
+ {}, stdout, warning=stderr,
freshenv=True,
)
- app.build()
+ app.build(False, None)
with codecs.open(app.builder.output_filename, 'r') as f:
output_text = f.read()
@@ -83,10 +83,10 @@
stderr = StringIO()
app = Sphinx(
self.srcdir, self.srcdir, self.outdir, self.outdir, 'spelling',
- status=stdout, warning=stderr,
+ {}, stdout, warning=stderr,
freshenv=True,
)
- app.build()
+ app.build(False, None)
print('reading from %s' % app.builder.output_filename)
with codecs.open(app.builder.output_filename, 'r') as f:
output_text = f.read()
@@ -117,10 +117,10 @@
stderr = StringIO()
app = Sphinx(
self.srcdir, self.srcdir, self.outdir, self.outdir, 'spelling',
- status=stdout, warning=stderr,
+ {}, stdout, warning=stderr,
freshenv=True,
)
- app.build()
+ app.build(False, None)
print('reading from %s' % app.builder.output_filename)
with codecs.open(app.builder.output_filename, 'r') as f:
output_text = f.read()
@@ -158,10 +158,10 @@
stderr = StringIO()
app = Sphinx(
self.srcdir, self.srcdir, self.outdir, self.outdir, 'spelling',
- status=stdout, warning=stderr,
+ {}, stdout, warning=stderr,
freshenv=True,
)
- app.build()
+ app.build(False, None)
print('reading from %s' % app.builder.output_filename)
with codecs.open(app.builder.output_filename, 'r') as f:
output_text = f.read()