parameters: (tree)
docstring: Interpret the globals.relations entries.
docstring_summary: Interpret the globals.relations entries.
docstring_tokens: Interpret the globals . relations entries .
function: def generateAutomaticReferences(tree):
      """Interpret the globals.relations entries."""
      print >>sys.stderr, 'Generating Automatic References'
      relations_node = tree.find('globals.relations')
      if not relations_node:
          return  # Empty, do nothing.
  
      # We first collect all automatic links, scheduled to be added later.
      additions = []
      def appendToAdditions(node):
          for node_path in node.texts:
              node_path = splitKeys(node_path, '.')
              ## print '  ' * level, ' ', node_path
              res = tree.find(node_path)
              ## print '  ' * level, ' ', res is not None
              if not res:
                  continue  # Not found, Skip  # TODO(holtgrew): Warning?
              additions.append((res.path + [key], '.'.join(node.path[:2])))
      for key, node in relations_node.children.iteritems():
          ## print 'GENERATE', key, node
          for txt in node.texts:
              path = splitKeys(txt, '.')
              _matchTreesInNode(tree, tree.root, splitKeys(txt, '.'), appendToAdditions)
  
      # Now, add these additions.  This circumvents problems leading to infinite
      # recursions.
      for path, text in additions:
          res = tree.find(path)
          if not res:
              parent = tree.find(path[:-1])
              assert parent
              res = DddocTreeNode(tree, path[-1], path, None)
              parent.children[path[-1]] = res
          if not text in res.texts:
              res.texts.append(text)
function_tokens: def generateAutomaticReferences ( tree ) : print >> sys . stderr , 'Generating Automatic References' relations_node = tree . find ( 'globals.relations' ) if not relations_node : return # Empty, do nothing. # We first collect all automatic links, scheduled to be added later. additions = [ ] def appendToAdditions ( node ) : for node_path in node . texts : node_path = splitKeys ( node_path , '.' ) ## print '  ' * level, ' ', node_path res = tree . find ( node_path ) ## print '  ' * level, ' ', res is not None if not res : continue # Not found, Skip  # TODO(holtgrew): Warning? additions . append ( ( res . path + [ key ] , '.' . join ( node . path [ : 2 ] ) ) ) for key , node in relations_node . children . iteritems ( ) : ## print 'GENERATE', key, node for txt in node . texts : path = splitKeys ( txt , '.' ) _matchTreesInNode ( tree , tree . root , splitKeys ( txt , '.' ) , appendToAdditions ) # Now, add these additions.  This circumvents problems leading to infinite # recursions. for path , text in additions : res = tree . find ( path ) if not res : parent = tree . find ( path [ : - 1 ] ) assert parent res = DddocTreeNode ( tree , path [ - 1 ] , path , None ) parent . children [ path [ - 1 ] ] = res if not text in res . texts : res . texts . append ( text )