diff options
Diffstat (limited to 'Build/source/libs/freetype2/src/tools/docmaker/formatter.py')
-rw-r--r-- | Build/source/libs/freetype2/src/tools/docmaker/formatter.py | 46 |
1 files changed, 15 insertions, 31 deletions
diff --git a/Build/source/libs/freetype2/src/tools/docmaker/formatter.py b/Build/source/libs/freetype2/src/tools/docmaker/formatter.py index 363410efc76..f62ce676c15 100644 --- a/Build/source/libs/freetype2/src/tools/docmaker/formatter.py +++ b/Build/source/libs/freetype2/src/tools/docmaker/formatter.py @@ -1,4 +1,4 @@ -# Formatter (c) 2002, 2004, 2007 David Turner <david@freetype.org> +# Formatter (c) 2002, 2004, 2007, 2008 David Turner <david@freetype.org> # from sources import * @@ -14,10 +14,9 @@ from utils import * # used to output -- you guessed it -- HTML. # -class Formatter: - - def __init__( self, processor ): +class Formatter: + def __init__( self, processor ): self.processor = processor self.identifiers = {} self.chapters = processor.chapters @@ -25,7 +24,7 @@ class Formatter: self.block_index = [] # store all blocks in a dictionary - self.blocks = [] + self.blocks = [] for section in self.sections: for block in section.blocks.values(): self.add_identifier( block.name, block ) @@ -36,26 +35,22 @@ class Formatter: for field in markup.fields: self.add_identifier( field.name, block ) - self.block_index = self.identifiers.keys() self.block_index.sort( index_sort ) - - def add_identifier( self, name, block ): + def add_identifier( self, name, block ): if self.identifiers.has_key( name ): - # duplicate name !! - sys.stderr.write( \ + # duplicate name! + sys.stderr.write( \ "WARNING: duplicate definition for '" + name + "' in " + \ block.location() + ", previous definition in " + \ - self.identifiers[ name ].location() + "\n" ) + self.identifiers[name].location() + "\n" ) else: self.identifiers[name] = block - # # Formatting the table of contents # - def toc_enter( self ): pass @@ -78,7 +73,6 @@ class Formatter: pass def toc_dump( self, toc_filename = None, index_filename = None ): - output = None if toc_filename: output = open_output( toc_filename ) @@ -93,7 +87,7 @@ class Formatter: self.toc_section_enter( section ) self.toc_section_exit( section ) - self.toc_chapter_exit ( chap ) + self.toc_chapter_exit( chap ) self.toc_index( index_filename ) @@ -105,7 +99,6 @@ class Formatter: # # Formatting the index # - def index_enter( self ): pass @@ -119,7 +112,6 @@ class Formatter: pass def index_dump( self, index_filename = None ): - output = None if index_filename: output = open_output( index_filename ) @@ -128,7 +120,7 @@ class Formatter: for name in self.block_index: self.index_name_enter( name ) - self.index_name_exit ( name ) + self.index_name_exit( name ) self.index_exit() @@ -162,9 +154,7 @@ class Formatter: def section_exit( self, section ): pass - def section_dump( self, section, section_filename = None ): - output = None if section_filename: output = open_output( section_filename ) @@ -172,33 +162,27 @@ class Formatter: self.section_enter( section ) for name in section.block_names: - block = self.identifiers[ name ] + block = self.identifiers[name] self.block_enter( block ) - for markup in block.markups[1:]: # always ignore first markup !! + for markup in block.markups[1:]: # always ignore first markup! self.markup_enter( markup, block ) for field in markup.fields: self.field_enter( field, markup, block ) - - self.field_exit ( field, markup, block ) + self.field_exit( field, markup, block ) self.markup_exit( markup, block ) self.block_exit( block ) - self.section_exit ( section ) + self.section_exit( section ) if output: close_output( output ) - - def section_dump_all( self ): + def section_dump_all( self ): for section in self.sections: self.section_dump( section ) - # - # Formatting a block - # - # eof |