Commits

Georg Brandl committed 7c2c4b8

Add line numbers to newly generated nodes.

Comments (0)

Files changed (3)

sphinx/directives/code.py

         literal = nodes.literal_block(code, code)
         literal['language'] = self.arguments[0]
         literal['linenos'] = 'linenos' in self.options
+        literal.line = self.lineno
         return [literal]
 
 
             text = text.expandtabs(self.options['tab-width'])
         retnode = nodes.literal_block(text, text, source=fn)
         retnode.line = 1
+        retnode.attributes['line_number'] = self.lineno
         if self.options.get('language', ''):
             retnode['language'] = self.options['language']
         if 'linenos' in self.options:

sphinx/directives/other.py

     def run(self):
         node = addnodes.tabular_col_spec()
         node['spec'] = self.arguments[0]
+        node.line = self.lineno
         return [node]
 
 

sphinx/ext/mathbase.py

         node['nowrap'] = 'nowrap' in self.options
         node['docname'] = self.state.document.settings.env.docname
         ret = [node]
+        node.line = self.lineno
+        node.source = self.src
         if node['label']:
             tnode = nodes.target('', '', ids=['equation-' + node['label']])
             self.state.document.note_explicit_target(tnode)