#NEWLINE# def Generate( self , projects , output_writer ) : #NEWLINE# #INDENT# 'Generates a wiki page.\n\n    Args:\n      projects: a list of project objects (instances of Project).\n      output_writer: an output writer object (instance of OutputWriter).\n    ' #NEWLINE# self . _GenerateSection ( 'introduction.txt' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , output_writer ) #NEWLINE# versions_per_configuration = self . _GetVersionsPerConfigurationFile ( projects ) #NEWLINE# versions_per_m4_script = self . _GetVersionsPerM4Scripts ( projects ) #NEWLINE# versions_per_script = self . _GetVersionsPerScripts ( projects ) #NEWLINE# projects_per_category = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for project in projects : #NEWLINE# #INDENT# if ( project . category not in projects_per_category ) : #NEWLINE# #INDENT# projects_per_category [ project . category ] = [ ] #NEWLINE# #UNINDENT# projects_per_category [ project . category ] . append ( project ) #NEWLINE# #UNINDENT# table_of_contents = [ ] #NEWLINE# table_of_contents . append ( '* [Configurations](Status#configurations)' ) #NEWLINE# for configuration in sorted ( versions_per_configuration . keys ( ) ) : #NEWLINE# #INDENT# configuration_reference = configuration . lower ( ) . replace ( '.' , '' ) #NEWLINE# table_of_contents . append ( '  * [{0:s}](Status#{1:s})' . format ( configuration , configuration_reference ) ) #NEWLINE# #UNINDENT# table_of_contents . append ( '* [Scripts](Status#scripts)' ) #NEWLINE# for script in sorted ( versions_per_script . keys ( ) ) : #NEWLINE# #INDENT# script_reference = script . lower ( ) . replace ( '.' , '' ) #NEWLINE# table_of_contents . append ( '  * [{0:s}](Status#{1:s})' . format ( script , script_reference ) ) #NEWLINE# #UNINDENT# table_of_contents . append ( '* [M4 scripts](Status#m4-scripts)' ) #NEWLINE# for m4_script in sorted ( versions_per_m4_script . keys ( ) ) : #NEWLINE# #INDENT# m4_script_reference = m4_script . lower ( ) . replace ( '.' , '' ) #NEWLINE# table_of_contents . append ( '  * [{0:s}](Status#{1:s})' . format ( m4_script , m4_script_reference ) ) #NEWLINE# #UNINDENT# for category in self . _ORDER_OF_LIBRARY_CATEGORIES : #NEWLINE# #INDENT# category_title = self . _CATEGORIES [ category ] [ 0 ] #NEWLINE# catergory_reference = category_title . lower ( ) . replace ( ' ' , '-' ) #NEWLINE# table_of_contents . append ( '* [{0:s}](Status#{1:s})' . format ( category_title , catergory_reference ) ) #NEWLINE# for project in projects_per_category [ category ] : #NEWLINE# #INDENT# table_of_contents . append ( '  * [{0:s}](Status#{0:s})' . format ( project . name ) ) #NEWLINE# #UNINDENT# #UNINDENT# table_of_contents . append ( '' ) #NEWLINE# output_data = '\n' . join ( table_of_contents ) . encode ( 'utf-8' ) #NEWLINE# output_writer . Write ( output_data ) #NEWLINE# template_mappings = { #NEWLINE# #INDENT# 'category_title' : 'Configurations' , #NEWLINE# #UNINDENT# } #NEWLINE# self . _GenerateSection ( 'category.txt' , template_mappings , output_writer ) #NEWLINE# for ( configuration , projects_per_version ) in sorted ( versions_per_configuration . items ( ) ) : #NEWLINE# #INDENT# template_mappings = { #NEWLINE# #INDENT# 'title' : configuration , #NEWLINE# #UNINDENT# } #NEWLINE# self . _GenerateSection ( 'table_header.txt' , template_mappings , output_writer ) #NEWLINE# for ( version , project_names ) in sorted ( projects_per_version . items ( ) , reverse = True ) : #NEWLINE# #INDENT# project_names = self . _FormatProjectNames ( project_names ) #NEWLINE# template_mappings = { #NEWLINE# #INDENT# 'project_names' : project_names , #NEWLINE# 'version' : version , #NEWLINE# #UNINDENT# } #NEWLINE# self . _GenerateSection ( 'table_entry.txt' , template_mappings , output_writer ) #NEWLINE# #UNINDENT# #UNINDENT# template_mappings = { #NEWLINE# #INDENT# 'category_title' : 'Scripts' , #NEWLINE# #UNINDENT# } #NEWLINE# self . _GenerateSection ( 'category.txt' , template_mappings , output_writer ) #NEWLINE# for ( script , projects_per_version ) in sorted ( versions_per_script . items ( ) ) : #NEWLINE# #INDENT# template_mappings = { #NEWLINE# #INDENT# 'title' : script , #NEWLINE# #UNINDENT# } #NEWLINE# self . _GenerateSection ( 'table_header.txt' , template_mappings , output_writer ) #NEWLINE# for ( version , project_names ) in sorted ( projects_per_version . items ( ) , reverse = True ) : #NEWLINE# #INDENT# project_names = self . _FormatProjectNames ( project_names ) #NEWLINE# template_mappings = { #NEWLINE# #INDENT# 'project_names' : project_names , #NEWLINE# 'version' : version , #NEWLINE# #UNINDENT# } #NEWLINE# self . _GenerateSection ( 'table_entry.txt' , template_mappings , output_writer ) #NEWLINE# #UNINDENT# #UNINDENT# template_mappings = { #NEWLINE# #INDENT# 'category_title' : 'M4 scripts' , #NEWLINE# #UNINDENT# } #NEWLINE# self . _GenerateSection ( 'category.txt' , template_mappings , output_writer ) #NEWLINE# for ( m4_script , projects_per_version ) in sorted ( versions_per_m4_script . items ( ) ) : #NEWLINE# #INDENT# template_mappings = { #NEWLINE# #INDENT# 'title' : m4_script , #NEWLINE# #UNINDENT# } #NEWLINE# self . _GenerateSection ( 'table_header.txt' , template_mappings , output_writer ) #NEWLINE# for ( version , project_names ) in sorted ( projects_per_version . items ( ) , reverse = True ) : #NEWLINE# #INDENT# project_names = self . _FormatProjectNames ( project_names ) #NEWLINE# template_mappings = { #NEWLINE# #INDENT# 'project_names' : project_names , #NEWLINE# 'version' : version , #NEWLINE# #UNINDENT# } #NEWLINE# self . _GenerateSection ( 'table_entry.txt' , template_mappings , output_writer ) #NEWLINE# #UNINDENT# #UNINDENT# for category in self . _ORDER_OF_LIBRARY_CATEGORIES : #NEWLINE# #INDENT# template_mappings = { #NEWLINE# #INDENT# 'category_title' : self . _CATEGORIES [ version ] [ 0 ] , #NEWLINE# #UNINDENT# } #NEWLINE# self . _GenerateSection ( 'category.txt' , template_mappings , output_writer ) #NEWLINE# versions_per_library = self . _GetVersionsPerLibrary ( projects , category ) #NEWLINE# for ( library , projects_per_version ) in sorted ( versions_per_library . items ( ) ) : #NEWLINE# #INDENT# template_mappings = { #NEWLINE# #INDENT# 'title' : library , #NEWLINE# #UNINDENT# } #NEWLINE# self . _GenerateSection ( 'table_header.txt' , template_mappings , output_writer ) #NEWLINE# for ( version , project_names ) in sorted ( projects_per_version . items ( ) , reverse = True ) : #NEWLINE# #INDENT# project_names = self . _FormatProjectNames ( project_names ) #NEWLINE# template_mappings = { #NEWLINE# #INDENT# 'project_names' : project_names , #NEWLINE# 'version' : version , #NEWLINE# #UNINDENT# } #NEWLINE# self . _GenerateSection ( 'table_entry.txt' , template_mappings , output_writer )