Code¶
spelling.builder¶
Spelling checker extension for Sphinx.
- class sphinxcontrib.spelling.builder.SpellingBuilder(app: Sphinx, env: BuildEnvironment)¶
Spell checks a document
- finish()¶
Finish the building process.
The default implementation does nothing.
- get_configured_wordlist_filenames()¶
Returns the configured wordlist filenames.
- get_outdated_docs()¶
Return an iterable of output files that are outdated, or a string describing what an update build will build.
If the builder does not output individual files corresponding to source files, return a string here. If it does, return an iterable of those files that need to be written.
- get_target_uri(docname, typ=None)¶
Return the target URI for a document name.
typ can be used to qualify the link characteristic for individual builders.
- get_wordlist_filename()¶
Returns the filename of the wordlist to use when checking content.
- init()¶
Load necessary templates and perform initialization. The default implementation does nothing.
- name = 'spelling'¶
The builder’s name. This is the value used to select builders on the command line.
- prepare_writing(docnames)¶
A place where you can add logic before
write_doc()is run
- write_doc(docname, doctree)¶
write the document
spelling.checker¶
Spelling checker extension for Sphinx.
- class sphinxcontrib.spelling.checker.SpellingChecker(lang, suggest, word_list_filename, tokenizer_lang='en_US', filters=None, context_line=False)¶
Checks the spelling of blocks of text.
Uses options defined in the sphinx configuration file to control the checking and filtering behavior.
- check(text)¶
Yields bad words and suggested alternate spellings.
- pop_filters()¶
Remove the filters pushed during the last call to push_filters().
- push_filters(new_filters)¶
Add a filter to the tokenizer chain.
spelling.directive¶
Spelling checker extension for Sphinx.
- class sphinxcontrib.spelling.directive.LegacySpellingDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)¶
spelling.domain¶
- class sphinxcontrib.spelling.domain.SpellingDomain(env: BuildEnvironment)¶
- directives = {'word-list': <class 'sphinxcontrib.spelling.directive.SpellingDirective'>}¶
directive name -> directive class
- get_objects()¶
Return an iterable of “object descriptions”.
Object descriptions are tuples with six items:
nameFully qualified name.
dispnameName to display when searching/linking.
typeObject type, a key in
self.object_types.docnameThe document where it is to be found.
anchorThe anchor name for the object.
priorityHow “important” the object is (determines placement in search results). One of:
1Default priority (placed before full-text matches).
0Object is important (placed before default-priority objects).
2Object is unimportant (placed after full-text matches).
-1Object should not show up in search at all.
- label = 'Spelling Checker'¶
domain label: longer, more descriptive (used in messages)
- merge_domaindata(docnames, otherdata)¶
Merge in data regarding docnames from a different domaindata inventory (coming from a subprocess in parallel builds).
- name = 'spelling'¶
domain name: should be short, but unique
- resolve_any_xref(env, fromdocname, builder, target, node, contnode)¶
Resolve the pending_xref node with the given target.
The reference comes from an “any” or similar role, which means that we don’t know the type. Otherwise, the arguments are the same as for
resolve_xref().The method must return a list (potentially empty) of tuples
('domain:role', newnode), where'domain:role'is the name of a role that could have created the same reference, e.g.'py:func'.newnodeis whatresolve_xref()would return.Added in version 1.3.
- resolve_xref(env, fromdocname, builder, typ, target, node, contnode)¶
resolve cross reference
- roles = {'ignore': <function spelling_ignore>, 'word': <function spelling_word>}¶
role name -> role callable
spelling.filters¶
Spelling checker extension for Sphinx.
- class sphinxcontrib.spelling.filters.AcronymFilter(tokenizer: Type[tokenize] | Filter)¶
If a word looks like an acronym (all upper case letters), ignore it.
- class sphinxcontrib.spelling.filters.ContractionFilter(tokenizer: Type[tokenize] | Filter)¶
Strip common contractions from words.
- class sphinxcontrib.spelling.filters.ContributorFilter(tokenizer)¶
Accept information about contributors as spelled correctly.
Look in the git history for authors and committers and accept tokens that are in the set.
- class sphinxcontrib.spelling.filters.IgnoreWordsFilter(tokenizer, word_set)¶
Given a set of words, ignore them all.
- class sphinxcontrib.spelling.filters.ImportableModuleFilter(tokenizer)¶
Ignore names of modules that we could import.
- class sphinxcontrib.spelling.filters.PyPIFilterFactory¶
Build an IgnoreWordsFilter for all of the names of packages on PyPI.
- class sphinxcontrib.spelling.filters.PythonBuiltinsFilter(tokenizer: Type[tokenize] | Filter)¶
Ignore names of built-in Python symbols.
- class sphinxcontrib.spelling.filters.list_tokenize(words)¶
spelling.role¶
- sphinxcontrib.spelling.role.spelling_ignore(role, rawtext, text, lineno, inliner, options={}, content=[])¶
Let the user indicate that inline text is to not be spellchecked.
- sphinxcontrib.spelling.role.spelling_word(role, rawtext, text, lineno, inliner, options={}, content=[])¶
Let the user indicate that inline text is spelled correctly.