Minor docmaker improvements. * src/tools/docmaker/content.py (DocBlock::__init__): Ignore empty code blocks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
diff --git a/ChangeLog b/ChangeLog
index 5976c81..8a9dbb4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/src/tools/docmaker/content.py b/src/tools/docmaker/content.py
index c10a4ed..0d76d19 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 <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()
diff --git a/src/tools/docmaker/sources.py b/src/tools/docmaker/sources.py
index dcfbf7d..7b68c07 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 <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()