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

Add valid word characters as a configuration option #147

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
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')
stevepiercy marked this conversation as resolved.
Show resolved Hide resolved
# 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