Skip to content

Commit

Permalink
Add valid word characters as a configuration option
Browse files Browse the repository at this point in the history
  • Loading branch information
stevepiercy committed Mar 13, 2022
1 parent 8b00ab3 commit 4609309
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions sphinxcontrib/spelling/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def setup(app):
app.add_config_value('spelling_filters', [], 'env')
# Set a user-provided list of files to ignore
app.add_config_value('spelling_exclude_patterns', [], 'env')
# Set valid word characters
app.add_config_value('spelling_valid_word_characters', 'en_US', 'env')
# Choose whether or not the misspelled output should be displayed
# in the terminal
app.add_config_value('spelling_verbose', True, 'env')
Expand Down
1 change: 1 addition & 0 deletions sphinxcontrib/spelling/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def init(self):
word_list_filename=word_list,
filters=f,
context_line=self.config.spelling_show_whole_line,
valid_word_chars=self.config.spelling_valid_word_characters,
)

def _load_filter_classes(self, filters):
Expand Down
3 changes: 2 additions & 1 deletion sphinxcontrib/spelling/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class SpellingChecker:
"""

def __init__(self, lang, suggest, word_list_filename,
tokenizer_lang='en_US', filters=None, context_line=False):
tokenizer_lang='en_US', filters=None, context_line=False,
valid_word_chars=None):
if enchant_import_error is not None:
raise RuntimeError(
'Cannot instantiate SpellingChecker '
Expand Down

0 comments on commit 4609309

Please sign in to comment.