(self)
| 306 | |
| 307 | # External entry point |
| 308 | def run(self): |
| 309 | env = self.state.document.settings.env |
| 310 | stat_example = None |
| 311 | stat_group, stat_name, stat_type = self.arguments[0:3] |
| 312 | if (len(self.arguments) > 3): |
| 313 | stat_example = self.arguments[3] |
| 314 | |
| 315 | # First, make a generic desc() node to be the parent. |
| 316 | node = sphinx.addnodes.desc() |
| 317 | node.document = self.state.document |
| 318 | node['objtype'] = 'stat' |
| 319 | |
| 320 | # Next, make a signature node. This creates a permalink and a |
| 321 | # highlighted background when the link is selected. |
| 322 | title = sphinx.addnodes.desc_signature(stat_name, '') |
| 323 | title['ids'].append(nodes.make_id('stat-' + stat_name)) |
| 324 | title['names'].append(stat_name) |
| 325 | title['first'] = False |
| 326 | title['objtype'] = 'stat' |
| 327 | self.add_name(title) |
| 328 | title['classes'].append('ts-stat-title') |
| 329 | |
| 330 | # Finally, add a desc_name() node to display the name of the |
| 331 | # configuration variable. |
| 332 | title += sphinx.addnodes.desc_name(stat_name, stat_name) |
| 333 | |
| 334 | node.append(title) |
| 335 | |
| 336 | # This has to be a distinct node before the title. if nested then |
| 337 | # the browser will scroll forward to just past the title. |
| 338 | nodes.target('', '', names=[stat_name]) |
| 339 | # Second (optional) arg is 'msgNode' - no idea what I should pass for that |
| 340 | # or if it even matters, although I now think it should not be used. |
| 341 | self.state.document.note_explicit_target(title) |
| 342 | env.domaindata['ts']['stat'][stat_name] = env.docname |
| 343 | |
| 344 | fl = nodes.field_list() |
| 345 | fl.append(self.make_field('Collection', stat_group)) |
| 346 | if ('type' in self.options): |
| 347 | fl.append(self.make_field('Type', self.options['type'])) |
| 348 | if ('units' in self.options): |
| 349 | fl.append(self.make_field('Units', self.options['units'])) |
| 350 | fl.append(self.make_field('Datatype', stat_type)) |
| 351 | if ('introduced' in self.options and len(self.options['introduced']) > 0): |
| 352 | fl.append(self.make_field('Introduced', self.options['introduced'])) |
| 353 | if ('deprecated' in self.options): |
| 354 | if (len(self.options['deprecated']) > 0): |
| 355 | fl.append(self.make_field('Deprecated', self.options['deprecated'])) |
| 356 | else: |
| 357 | fl.append(self.make_field('Deprecated', 'Yes')) |
| 358 | if ('ungathered' in self.options): |
| 359 | fl.append(self.make_field('Gathered', 'No')) |
| 360 | if (stat_example): |
| 361 | fl.append(self.make_field('Example', stat_example)) |
| 362 | |
| 363 | # Get any contained content |
| 364 | nn = nodes.compound() |
| 365 | self.state.nested_parse(self.content, self.content_offset, nn) |
nothing calls this directly
no test coverage detected