Minor docmaker improvements.

* src/tools/docmaker/content.py (DocBlock::__init__): Ignore empty
code blocks.
This commit is contained in:
Werner Lemberg 2009-01-30 23:45:53 +00:00
parent 1e5e7aa073
commit 763ae208e5
3 changed files with 20 additions and 11 deletions

View File

@ -1,3 +1,10 @@
2009-01-31 Werner Lemberg <wl@gnu.org>
Minor docmaker improvements.
* src/tools/docmaker/content.py (DocBlock::__init__): Ignore empty
code blocks.
2009-01-25 Werner Lemberg <wl@gnu.org>
Fix SCANCTRL handling in TTFs.

View File

@ -1,4 +1,5 @@
# Content (c) 2002, 2004, 2006, 2007, 2008 David Turner <david@freetype.org>
# Content (c) 2002, 2004, 2006, 2007, 2008, 2009
# David Turner <david@freetype.org>
#
# 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()

View File

@ -1,4 +1,4 @@
# Sources (c) 2002, 2003, 2004, 2006, 2007, 2008
# Sources (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009
# David Turner <david@freetype.org>
#
#
@ -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()