(self)
| 338 | |
| 339 | # External entry point |
| 340 | def run(self): |
| 341 | env = self.state.document.settings.env |
| 342 | txb_name = self.arguments[0] |
| 343 | txb_id = nodes.make_id(txb_name) |
| 344 | |
| 345 | # First, make a generic desc() node to be the parent. |
| 346 | node = sphinx.addnodes.desc() |
| 347 | node.document = self.state.document |
| 348 | node['objtype'] = self.obj_type |
| 349 | |
| 350 | # Next, make a signature node. This creates a permalink and a highlighted background when the link is selected. |
| 351 | title = sphinx.addnodes.desc_signature(txb_name, '') |
| 352 | title['ids'].append(txb_name) |
| 353 | title['ids'].append(txb_id) |
| 354 | title['names'].append(txb_name) |
| 355 | title['first'] = False |
| 356 | title['objtype'] = self.obj_type |
| 357 | self.add_name(title) |
| 358 | title['classes'].append('modifier-title') |
| 359 | |
| 360 | # Finally, add a desc_name() node to display the name of the |
| 361 | # configuration variable. |
| 362 | title += sphinx.addnodes.desc_name(txb_name, txb_name) |
| 363 | |
| 364 | node.append(title) |
| 365 | if ('class' in self.options): |
| 366 | title['classes'].append(self.options.get('class')) |
| 367 | |
| 368 | # This has to be a distinct node before the title. if nested then the browser will scroll forward to just past the title. |
| 369 | anchor = nodes.target('', '', names=[txb_name]) |
| 370 | # Second (optional) arg is 'msgNode' - no idea what I should pass for that |
| 371 | # or if it even matters, although I now think it should not be used. |
| 372 | self.state.document.note_explicit_target(title) |
| 373 | env.domaindata['txb'][self.obj_type][txb_name] = env.docname |
| 374 | |
| 375 | fl = nodes.field_list() |
| 376 | if ('keys' in self.options): |
| 377 | fl.append(self.make_field('Secondary Keys', self.options['keys'])) |
| 378 | if ('arg' in self.options): |
| 379 | fl.append(self.make_field('Argument', self.options['arg'])) |
| 380 | if ('value' in self.options): |
| 381 | fl.append(self.make_field('Value', self.options['value'])) |
| 382 | |
| 383 | # Get any contained content |
| 384 | nn = nodes.compound() |
| 385 | self.state.nested_parse(self.content, self.content_offset, nn) |
| 386 | |
| 387 | # Create an index node so that Sphinx adds this directive to the index. |
| 388 | indexnode = sphinx.addnodes.index(entries=[]) |
| 389 | indexnode['entries'].append(('single', _('%s') % txb_name, txb_id, '', '')) |
| 390 | |
| 391 | return [indexnode, node, fl, nn] |
| 392 | |
| 393 | |
| 394 | class TxnBoxDomain(Domain): |
nothing calls this directly
no test coverage detected