summaryrefslogtreecommitdiff
path: root/extras/freetype2/src/tools/docmaker/content.py
diff options
context:
space:
mode:
Diffstat (limited to 'extras/freetype2/src/tools/docmaker/content.py')
-rwxr-xr-xextras/freetype2/src/tools/docmaker/content.py50
1 files changed, 44 insertions, 6 deletions
diff --git a/extras/freetype2/src/tools/docmaker/content.py b/extras/freetype2/src/tools/docmaker/content.py
index 6d33b5db2..ebfeb8bf4 100755
--- a/extras/freetype2/src/tools/docmaker/content.py
+++ b/extras/freetype2/src/tools/docmaker/content.py
@@ -56,8 +56,16 @@ class DocCode:
self.lines.append( l )
def dump( self, prefix = "", width=60 ):
- for l in self.lines:
+ lines = self.dump_lines( 0, width )
+ for l in lines:
print prefix + l
+
+ def dump_lines( self, margin=0, width=60 ):
+ result = []
+ for l in self.lines:
+ result.append( " "*margin + l )
+ return result
+
#############################################################################
@@ -76,8 +84,14 @@ class DocPara:
self.words.extend( string.split( l ) )
def dump( self, prefix = "", width = 60 ):
- cur = "" # current line
- col = 0 # current width
+ lines = self.dump_lines( 0, width )
+ for l in lines:
+ print prefix + l
+
+ def dump_lines( self, margin=0, width = 60 ):
+ cur = "" # current line
+ col = 0 # current width
+ result = []
for word in self.words:
ln = len(word)
@@ -85,7 +99,7 @@ class DocPara:
ln = ln+1
if col + ln > width:
- print prefix + cur
+ result.append( " "*margin + cur )
cur = word
col = len(word)
else:
@@ -95,8 +109,11 @@ class DocPara:
col = col + ln
if col > 0:
- print prefix + cur
+ result.append( " "*margin + cur )
+
+ return result
+
#############################################################################
@@ -187,6 +204,17 @@ class DocField:
p.dump( prefix )
first = 0
+ def dump_lines( self, margin=0, width=60 ):
+ result = []
+ nl = None
+ for p in self.items:
+ if nl:
+ result.append( "" )
+
+ result.extend( p.dump_lines( margin, width ) )
+ nl = 1
+
+ return result
# this regular expression is used to detect field definitions
#
@@ -233,6 +261,16 @@ class DocMarkup:
except:
return None
+
+ def get_start( self ):
+ try:
+ result = ""
+ for word in self.fields[0].items[0].words:
+ result = result + " " + word
+ return result[1:]
+
+ except:
+ return "ERROR"
def dump( self, margin ):
print " "*margin + "<" + self.tag + ">"
@@ -544,4 +582,4 @@ class DocBlock:
m = self.get_markup( tag_name )
return m.fields[0].items
except:
- return None \ No newline at end of file
+ return None