parameters: (self, json_builder)
return_statement: return root_str
docstring: Generate HTML output based on the contents of |json_builder|.
docstring_summary: Generate HTML output based on the contents of |json_builder|.
docstring_tokens: Generate HTML output based on the contents of |json_builder| .
function: def generate(self, json_builder):
      """ Generate HTML output based on the contents of |json_builder|. """
      if not isinstance(json_builder, cef_json_builder):
        raise Exception('Invalid argument')
  
      # Substitution values are augmented at each nesting level.
      subs = {
        'year': '2016',
        'branding': self._branding,
      }
  
      # Substitute variables.
      root_str = self._replace_all(self._parts['root'], subs)
  
      platform_link_strs = []
      platform_strs = []
      for platform in json_builder.get_platforms():
        subs['platform'] = platform
        subs['platform_name'] = self._get_platform_name(platform)
  
        # Substitute variables.
        platform_link_str = self._replace_all(self._parts['platform_link'], subs)
        platform_str = self._replace_all(self._parts['platform'], subs)
  
        version_strs = []
        for version in json_builder.get_versions(platform):
          subs['cef_version'] = version['cef_version']
          subs['chromium_version'] = version['chromium_version']
          subs['last_modified'] = self._get_date(version['files'][0]['last_modified'])
          subs['cef_source_url'] = self._get_cef_source_url(version['cef_version'])
          subs['chromium_source_url'] = self._get_chromium_source_url(version['chromium_version'])
  
          # Substitute variables.
          version_str = self._replace_all(self._parts['version'], subs)
  
          file_strs = {}
          for file in version['files']:
            subs['last_modified'] = self._get_date(file['last_modified'])
            subs['name'] = file['name']
            subs['sha1'] = file['sha1']
            subs['size'] = self._get_file_size(file['size'])
            subs['type'] = file['type']
            subs['type_name'] = self._get_type_name(file['type'])
            subs['file_url'] = self._get_file_url(platform, version['cef_version'], file)
            subs['sha1_url'] = self._get_sha1_url(platform, version['cef_version'], file)
            subs['tooltip_text'] = self._get_tooltip_text(platform, version['cef_version'], file)
  
            # Substitute variables.
            file_str = self._replace_all(self._parts['file'], subs)
            file_strs[file['type']] = file_str
  
          if len(file_strs) > 0:
            # Always output file types in the same order.
            file_out = ''
            type_order = ['standard', 'minimal', 'client', 'debug_symbols', 'release_symbols']
            for type in type_order:
              if type in file_strs:
                file_out = file_out + file_strs[type]
  
            # Insert files.
            version_str = self._replace(version_str, self._section_key('file'), file_out)
            version_strs.append(version_str)
  
        if len(version_strs) > 0:
          # Insert versions.
          platform_str = self._replace(platform_str, self._section_key('version'), "".join(version_strs))
          platform_strs.append(platform_str)
          platform_link_strs.append(platform_link_str)
  
      if len(platform_strs) > 0:
        # Insert platforms.
        root_str = self._replace(root_str, self._section_key('platform_link'), "".join(platform_link_strs))
        root_str = self._replace(root_str, self._section_key('platform'), "".join(platform_strs))
  
      return root_str
function_tokens: def generate ( self , json_builder ) : if not isinstance ( json_builder , cef_json_builder ) : raise Exception ( 'Invalid argument' ) # Substitution values are augmented at each nesting level. subs = { 'year' : '2016' , 'branding' : self . _branding , } # Substitute variables. root_str = self . _replace_all ( self . _parts [ 'root' ] , subs ) platform_link_strs = [ ] platform_strs = [ ] for platform in json_builder . get_platforms ( ) : subs [ 'platform' ] = platform subs [ 'platform_name' ] = self . _get_platform_name ( platform ) # Substitute variables. platform_link_str = self . _replace_all ( self . _parts [ 'platform_link' ] , subs ) platform_str = self . _replace_all ( self . _parts [ 'platform' ] , subs ) version_strs = [ ] for version in json_builder . get_versions ( platform ) : subs [ 'cef_version' ] = version [ 'cef_version' ] subs [ 'chromium_version' ] = version [ 'chromium_version' ] subs [ 'last_modified' ] = self . _get_date ( version [ 'files' ] [ 0 ] [ 'last_modified' ] ) subs [ 'cef_source_url' ] = self . _get_cef_source_url ( version [ 'cef_version' ] ) subs [ 'chromium_source_url' ] = self . _get_chromium_source_url ( version [ 'chromium_version' ] ) # Substitute variables. version_str = self . _replace_all ( self . _parts [ 'version' ] , subs ) file_strs = { } for file in version [ 'files' ] : subs [ 'last_modified' ] = self . _get_date ( file [ 'last_modified' ] ) subs [ 'name' ] = file [ 'name' ] subs [ 'sha1' ] = file [ 'sha1' ] subs [ 'size' ] = self . _get_file_size ( file [ 'size' ] ) subs [ 'type' ] = file [ 'type' ] subs [ 'type_name' ] = self . _get_type_name ( file [ 'type' ] ) subs [ 'file_url' ] = self . _get_file_url ( platform , version [ 'cef_version' ] , file ) subs [ 'sha1_url' ] = self . _get_sha1_url ( platform , version [ 'cef_version' ] , file ) subs [ 'tooltip_text' ] = self . _get_tooltip_text ( platform , version [ 'cef_version' ] , file ) # Substitute variables. file_str = self . _replace_all ( self . _parts [ 'file' ] , subs ) file_strs [ file [ 'type' ] ] = file_str if len ( file_strs ) > 0 : # Always output file types in the same order. file_out = '' type_order = [ 'standard' , 'minimal' , 'client' , 'debug_symbols' , 'release_symbols' ] for type in type_order : if type in file_strs : file_out = file_out + file_strs [ type ] # Insert files. version_str = self . _replace ( version_str , self . _section_key ( 'file' ) , file_out ) version_strs . append ( version_str ) if len ( version_strs ) > 0 : # Insert versions. platform_str = self . _replace ( platform_str , self . _section_key ( 'version' ) , "" . join ( version_strs ) ) platform_strs . append ( platform_str ) platform_link_strs . append ( platform_link_str ) if len ( platform_strs ) > 0 : # Insert platforms. root_str = self . _replace ( root_str , self . _section_key ( 'platform_link' ) , "" . join ( platform_link_strs ) ) root_str = self . _replace ( root_str , self . _section_key ( 'platform' ) , "" . join ( platform_strs ) ) return root_str