(self)
| 164 | |
| 165 | # External entry point |
| 166 | def run(self): |
| 167 | env = self.state.document.settings.env |
| 168 | cv_default = None |
| 169 | cv_scope, cv_name, cv_type = self.arguments[0:3] |
| 170 | if (len(self.arguments) > 3): |
| 171 | cv_default = self.arguments[3] |
| 172 | |
| 173 | # First, make a generic desc() node to be the parent. |
| 174 | node = sphinx.addnodes.desc() |
| 175 | node.document = self.state.document |
| 176 | node['objtype'] = 'cv' |
| 177 | |
| 178 | # Next, make a signature node. This creates a permalink and a |
| 179 | # highlighted background when the link is selected. |
| 180 | title = sphinx.addnodes.desc_signature(cv_name, '') |
| 181 | title['ids'].append(nodes.make_id(cv_name)) |
| 182 | title['ids'].append(cv_name) |
| 183 | title['names'].append(cv_name) |
| 184 | title['first'] = False |
| 185 | title['objtype'] = 'cv' |
| 186 | self.add_name(title) |
| 187 | title['classes'].append('ts-cv-title') |
| 188 | |
| 189 | # Finally, add a desc_name() node to display the name of the |
| 190 | # configuration variable. |
| 191 | title += sphinx.addnodes.desc_name(cv_name, cv_name) |
| 192 | |
| 193 | node.append(title) |
| 194 | |
| 195 | if ('class' in self.options): |
| 196 | title['classes'].append(self.options.get('class')) |
| 197 | # This has to be a distinct node before the title. if nested then |
| 198 | # the browser will scroll forward to just past the title. |
| 199 | nodes.target('', '', names=[cv_name]) |
| 200 | # Second (optional) arg is 'msgNode' - no idea what I should pass for that |
| 201 | # or if it even matters, although I now think it should not be used. |
| 202 | self.state.document.note_explicit_target(title) |
| 203 | env.domaindata['ts']['cv'][cv_name] = env.docname |
| 204 | |
| 205 | fl = nodes.field_list() |
| 206 | fl.append(self.make_field('Scope', cv_scope)) |
| 207 | fl.append(self.make_field('Type', cv_type)) |
| 208 | if (cv_default): |
| 209 | fl.append(self.make_field('Default', cv_default)) |
| 210 | else: |
| 211 | fl.append(self.make_field('Default', sphinx.addnodes.literal_emphasis(text='*NONE*'))) |
| 212 | if ('units' in self.options): |
| 213 | fl.append(self.make_field('Units', self.options['units'])) |
| 214 | if ('reloadable' in self.options): |
| 215 | fl.append(self.make_field('Reloadable', 'Yes')) |
| 216 | if ('overridable' in self.options): |
| 217 | fl.append(self.make_field('Overridable', 'Yes')) |
| 218 | if ('deprecated' in self.options): |
| 219 | fl.append(self.make_field('Deprecated', 'Yes')) |
| 220 | |
| 221 | # add yaml rep if record is not legacy. |
| 222 | code_block = None |
| 223 | code_block_title = None |
nothing calls this directly
no test coverage detected