Debian Codegraph @

sphinxcontrib/spelling/role.py

raw
1 from docutils import nodes
2
3 from . import directive
4
5
6 def spelling_word(role, rawtext, text, lineno, inliner,
7 options={}, content=[]):
8 """Let the user indicate that inline text is spelled correctly."""
9 env = inliner.document.settings.env
10 docname = env.docname
11 good_words = text.split()
12 directive.add_good_words_to_document(env, docname, good_words)
13 node = nodes.Text(text)
14 return [node], []
15
16
17 def spelling_ignore(role, rawtext, text, lineno, inliner,
18 options={}, content=[]):
19 """Let the user indicate that inline text is to not be spellchecked."""
20 node = nodes.Text(text)
21 setattr(node, "spellingIgnore", True)
22 return [node], []