shithub: freetype+ttf2subf

Download patch

ref: 763ae208e526c0abd2fb7ab8eea76cc6c04175cf
parent: 1e5e7aa0732d17609bb5cfa02258820a59511c54
author: Werner Lemberg <[email protected]>
date: Fri Jan 30 18:45:53 EST 2009

Minor docmaker improvements.

* src/tools/docmaker/content.py (DocBlock::__init__): Ignore empty
code blocks.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-01-31  Werner Lemberg  <[email protected]>
+
+	Minor docmaker improvements.
+
+	* src/tools/docmaker/content.py (DocBlock::__init__): Ignore empty
+	code blocks.
+
 2009-01-25  Werner Lemberg  <[email protected]>
 
 	Fix SCANCTRL handling in TTFs.
--- 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 <[email protected]>
+#  Content (c) 2002, 2004, 2006, 2007, 2008, 2009
+#    David Turner <[email protected]>
 #
 #  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 @@
             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 @@
         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 @@
         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()
--- 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 <[email protected]>
 #
 #
@@ -179,7 +179,7 @@
 ##
 ##  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:
 ##
@@ -186,7 +186,7 @@
 ##   - 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 @@
 ##
 ##  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 @@
                 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()