parameters: (
        self,
        output_path,
        template_path=None)
docstring: Materialize the template to generate the output file.
docstring_summary: Materialize the template to generate the output file.
docstring_tokens: Materialize the template to generate the output file .
function: def Generate(
        self,
        output_path,
        template_path=None):
      """Materialize the template to generate the output file."""
  
      jinja_env = jinja2.Environment(
          undefined=jinja2.StrictUndefined,
          autoescape=False,
          trim_blocks=True,
          lstrip_blocks=True,
          line_statement_prefix='# ',
          loader=jinja2.FileSystemLoader('', followlinks=True))
  
      # {{items|sort_by_tag_id}} can be used to sort a list of objects by tag.
      def SortByTagId(items):
        return sorted(items, key=operator.itemgetter('tag_id'))
  
      jinja_env.filters['sort_by_tag_id'] = SortByTagId
      jinja_env.filters['lower_camel_case'] = LowerCamelCase
      jinja_env.filters['upper_camel_case'] = UpperCamelCase
      self._ComputeHierarchy()
  
      context = {
          'nodes': self.nodes,
          'root_child_nodes': self.root_child_nodes,
          # For when we need to force a blank line and jinja wants to
          # eat blank lines from the template.
          'blank_line': '\n'
      }
  
      template = jinja_env.get_template(template_path)
      out = open(output_path, 'wt')
      out.write(Trim(template.render(context)))
      out.close()
function_tokens: def Generate ( self , output_path , template_path = None ) : jinja_env = jinja2 . Environment ( undefined = jinja2 . StrictUndefined , autoescape = False , trim_blocks = True , lstrip_blocks = True , line_statement_prefix = '# ' , loader = jinja2 . FileSystemLoader ( '' , followlinks = True ) ) # {{items|sort_by_tag_id}} can be used to sort a list of objects by tag. def SortByTagId ( items ) : return sorted ( items , key = operator . itemgetter ( 'tag_id' ) ) jinja_env . filters [ 'sort_by_tag_id' ] = SortByTagId jinja_env . filters [ 'lower_camel_case' ] = LowerCamelCase jinja_env . filters [ 'upper_camel_case' ] = UpperCamelCase self . _ComputeHierarchy ( ) context = { 'nodes' : self . nodes , 'root_child_nodes' : self . root_child_nodes , # For when we need to force a blank line and jinja wants to # eat blank lines from the template. 'blank_line' : '\n' } template = jinja_env . get_template ( template_path ) out = open ( output_path , 'wt' ) out . write ( Trim ( template . render ( context ) ) ) out . close ( )