def run(self):
...
targetid = "tbd-%d" % env.new_serialno('tbd')
targetnode = nodes.target('', '', ids=[targetid])
....
return [targetnode]
def tbd_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
env = inliner.document.settings.env
app = env.app
...
# Add this to our TBD list
targetid = "tbd-%d" % env.new_serialno('tbd')
targetnode = nodes.target('', '', ids=[targetid]])
inliner.document.note_explicit_target(targetnode)
...
node = nodes.Text('TBD')
return [targetnode, node], []
# Find the file that we are in
docname = ''
parent = inliner.parent
while parent:
if hasattr(parent, 'attributes'):
if parent.attributes.get('source', ''):
docname = parent.attributes['source'].replace(''.join([app.confdir, '/']), '', 1)
docname = docname.replace('.rst', '')
break
parent = parent.parent
# Add this to our TBD list
targetid = "tbd-%d" % env.new_serialno('tbd')
targetnode = nodes.target(ids=[targetid],
names=[docname],
refuri="/" + docname,
refid=targetid,)
\phantomsection\label{index:tbd-0}TBD
.. raw:: latex
\hyperref[index:tbd-0]{reference}
=====
Scope
=====
This is a role :tbd:`link here`.
\chapter{Scope}
\label{scope:project}\label{scope:scope}\label{scope::doc}
This is a role TBD.
newnode['refuri'] += '#' + tbd_info['target']['refid']
{
'docname': env.docname,
'lineno': self.lineno,
'target': targetnode,
'content': self.content,
'node': self.state_machine.node,
'sectionname': self.state_machine.node.attributes['names'],
'sectionid': self.state_machine.node.attributes['ids'],
'sectiontitle': get_section_title(self.state_machine.node),
}
targetid = "tbd-%d" % env.new_serialno('tbd')
targetnode = nodes.target('', '', ids=[targetid])
inliner.document.note_explicit_target(targetnode)
tbd_info = {
'docname': env.docname,
'target': targetnode,
'content': text,
'sectionid': sectionid,
'sectiontitle': get_section_title(inliner.parent),
'parent': inliner.parent,
}
node = nodes.Text('TBD')
return [targetnode, node], []
newnode = nodes.reference('', '')
newnode['refuri'] += '#' + tbd_info['target']['refid']
docname = ''
parent = inliner.parent
while parent:
if hasattr(parent, 'attributes'):
if parent.attributes.get('source', ''):
docname = parent.attributes['source'].replace(''.join([app.confdir, '/']), '', 1)
docname = docname.replace('.rst', '')
break
parent = parent.
parent
targetid = "tbd%d" % env.new_serialno('tbd')
targetnode = nodes.target(ids=[targetid],
names=[docname],
refuri="/" + docname,
refid=targetid,)
newnode = nodes.reference('', '')
newnode['refdocname'] = tbd_info['docname']
newnode['refuri'] = app.builder.get_relative_uri(
fromdocname, tbd_info['docname'])