diff --git a/ChangeLog b/ChangeLog index 5976c8134..8a9dbb4e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-01-31 Werner Lemberg + + Minor docmaker improvements. + + * src/tools/docmaker/content.py (DocBlock::__init__): Ignore empty + code blocks. + 2009-01-25 Werner Lemberg Fix SCANCTRL handling in TTFs. diff --git a/src/tools/docmaker/content.py b/src/tools/docmaker/content.py index c10a4edb8..0d76d19de 100644 --- a/src/tools/docmaker/content.py +++ b/src/tools/docmaker/content.py @@ -1,4 +1,5 @@ -# Content (c) 2002, 2004, 2006, 2007, 2008 David Turner +# Content (c) 2002, 2004, 2006, 2007, 2008, 2009 +# David Turner # # This file contains routines used to parse the content of documentation # comment blocks and build more structured objects out of them. @@ -153,7 +154,7 @@ class DocField: if mode == mode_code: m = re_code_end.match( l ) if m and len( m.group( 1 ) ) <= margin: - # that's it, we finised the code sequence + # that's it, we finished the code sequence code = DocCode( 0, cur_lines ) self.items.append( code ) margin = -1 @@ -321,7 +322,7 @@ class DocSection: self.blocks[block.name] = block def process( self ): - # lookup one block that contains a valid section description + # look up one block that contains a valid section description for block in self.defs: title = block.get_markup_text( "title" ) if title: @@ -539,9 +540,10 @@ class DocBlock: while start < end and not string.strip( source[end] ): end = end - 1 - source = source[start:end + 1] - - self.code = source + if start == end: + self.code = [] + else: + self.code = source[start:end + 1] def location( self ): return self.source.location() diff --git a/src/tools/docmaker/sources.py b/src/tools/docmaker/sources.py index dcfbf7dae..7b68c0701 100644 --- a/src/tools/docmaker/sources.py +++ b/src/tools/docmaker/sources.py @@ -1,4 +1,4 @@ -# Sources (c) 2002, 2003, 2004, 2006, 2007, 2008 +# Sources (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009 # David Turner # # @@ -179,14 +179,14 @@ re_source_keywords = re.compile( '''\\b ( typedef | ## ## SOURCE BLOCK CLASS ## -## A SourceProcessor is in charge or reading a C source file +## A SourceProcessor is in charge of reading a C source file ## and decomposing it into a series of different "SourceBlocks". ## each one of these blocks can be made of the following data: ## ## - A documentation comment block that starts with "/**" and ## whose exact format will be discussed later ## -## - normal sources lines, include comments +## - normal sources lines, including comments ## ## the important fields in a text block are the following ones: ## @@ -255,7 +255,7 @@ class SourceBlock: ## ## SOURCE PROCESSOR CLASS ## -## The SourceProcessor is in charge or reading a C source file +## The SourceProcessor is in charge of reading a C source file ## and decomposing it into a series of different "SourceBlock" ## objects. ## @@ -301,7 +301,7 @@ class SourceProcessor: self.process_normal_line( line ) else: if self.format.end.match( line ): - # that's a normal block end, add it to lines and + # that's a normal block end, add it to 'lines' and # create a new block self.lines.append( line ) self.add_block_lines()