in rst/options_node.py [0:0]
def indigo_option_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
"""Link to an Indigo option
Returns 2 part tuple containing list of nodes to insert into the
document and a list of system messages. Both are allowed to be
empty.
:param name: The role name used in the document.
:param rawtext: The entire markup snippet, with role.
:param text: The text marked with the role.
:param lineno: The line number where rawtext appears in the input.
:param inliner: The inliner instance that called us.
:param options: Directive options for customization.
:param content: The directive content for customization.
"""
env = inliner.document.settings.env
app = env.app
opts = [opt for opt in env.indigo_options if opt['name'] == text]
if len(opts) == 0:
raise ValueError("Cannot find option " + slug)
opt_info = opts[0]
newnode = nodes.reference('', '')
innernode = nodes.Text(opt_info['name'], opt_info['name'])
newnode['refdocname'] = opt_info['docname']
newnode['refuri'] = app.builder.get_relative_uri(
env.docname, opt_info['docname'])
newnode['refuri'] += '#' + normalize_name(opt_info['name'])
newnode['classes'].append('option')
newnode.append(innernode)
return [newnode], []