Skip to content

Commit

Permalink
Merge pull request #178 from dhellmann/pr-170-rebase
Browse files Browse the repository at this point in the history
Rebase #170
  • Loading branch information
mergify[bot] authored May 30, 2022
2 parents 0413a27 + 62a3247 commit 3ab4a13
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
11 changes: 9 additions & 2 deletions docs/source/customize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,20 @@ Input Options
String specifying a file containing a list of words known to be
spelled correctly but that do not appear in the language dictionary
selected by ``spelling_lang``. The file should contain one word per
line. Refer to the `PyEnchant tutorial`_ for details. Use a list to add
multiple files.
line. Refer to the `PyEnchant tutorial`_ for details. To add multiple
files use a list, or a comma separated string. This is useful when
calling sphinx with ``-D spelling_word_list_filename=...`` which will
not accept a list and will only accept a string parameter.

``spelling_word_list_filename=['spelling_wordlist.txt','another_list.txt']``

Same as above, but with several files of correctly spelled words.

``spelling_word_list_filename='spelling_wordlist.txt,another_list.txt'``

Same as above, but with several files of correctly spelled words, and
passing the setting as a single string.

``spelling_exclude_patterns=['ignored_*']``

A list of glob-style patterns that should be ignored when checking spelling.
Expand Down
5 changes: 5 additions & 0 deletions docs/source/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
macOS
unmaintained


Next
====

Expand All @@ -20,6 +21,10 @@ Features
output. See :doc:`/customize` for more details. Idea contributed by
Trevor Gross.

- `#169 <https://github.com/sphinx-contrib/spelling/issues/169>`__
Adds the ability to pass in multiple wordlists via the sphinx
command line as ``-D spelling_word_list_filename=file1,file2``.

Bug Fixes
---------

Expand Down
5 changes: 5 additions & 0 deletions sphinxcontrib/spelling/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ def get_wordlist_filename(self):
if word_list is None:
word_list = 'spelling_wordlist.txt'

if isinstance(word_list, str) and word_list.find(',') > 0:
# Wordlist is a list, formatted as a str.
# Split it back into a list
word_list = word_list.split(',')

if not isinstance(word_list, list):
return os.path.join(self.srcdir, word_list)

Expand Down

0 comments on commit 3ab4a13

Please sign in to comment.