> Ankit, please prepare diffs rather than sending complete files in the
> future! This both saves bandwidth and immediately shows your
> modifications.
>
> I will keep that in mind ;)
Ankit
diff --git a/builds/freetype.mk b/builds/freetype.mk
index 6f68a0f..02a5224 100644
--- a/builds/freetype.mk
+++ b/builds/freetype.mk
@@ -293,7 +293,7 @@ library: $(PROJECT_LIBRARY)
# Option `-B' disables generation of .pyc files (available since python 2.6)
#
refdoc:
- python -B $(SRC_DIR)/tools/docmaker/docmaker.py \
+ python3 -B $(SRC_DIR)/tools/docmaker/docmaker.py \
--prefix=ft2 \
--title=FreeType-$(version) \
--output=$(DOC_DIR) \
diff --git a/docs/reference/README b/docs/reference/README
deleted file mode 100644
index 51b04d6..0000000
--- a/docs/reference/README
+++ /dev/null
@@ -1,5 +0,0 @@
-After saying `make refdoc' this directory contains the FreeType API
-reference. You need python to make this target.
-
-This also works with Jam: Just type `jam refdoc' in the main directory.
-
diff --git a/src/tools/docmaker/content.py b/src/tools/docmaker/content.py
index 198780a..8557934 100644
--- a/src/tools/docmaker/content.py
+++ b/src/tools/docmaker/content.py
@@ -102,7 +102,7 @@ class DocCode:
# remove margin spaces
for l in lines:
- if string.strip( l[:margin] ) == "":
+ if l[:margin].strip() == "":
l = l[margin:]
self.lines.append( l )
@@ -133,8 +133,8 @@ class DocPara:
self.lines = None
self.words = []
for l in lines:
- l = string.strip( l )
- self.words.extend( string.split( l ) )
+ l = l.strip()
+ self.words.extend( l.split( ) )
def dump( self, prefix = "", width = 60 ):
lines = self.dump_lines( 0, width )
@@ -222,7 +222,7 @@ class DocField:
margin = len( m.group( 1 ) )
mode = mode_code
else:
- if not string.split( l ) and cur_lines:
+ if not l.split() and cur_lines:
# if the line is empty, we end the current paragraph,
# if any
para = DocPara( cur_lines )
@@ -293,7 +293,7 @@ re_field = re.compile( r"""
class DocMarkup:
def __init__( self, tag, lines ):
- self.tag = string.lower( tag )
+ self.tag = tag.lower()
self.fields = []
cur_lines = []
@@ -351,7 +351,7 @@ class DocChapter:
self.order = block.get_markup_words( "sections" )
else:
self.name = "Other"
- self.title = string.split( "Miscellaneous" )
+ self.title = "Miscellaneous".split()
self.order = []
@@ -436,7 +436,7 @@ class ContentProcessor:
# get rid of last line of markup if it's empty
marks = self.markup_lines
- if len( marks ) > 0 and not string.strip( marks[-1] ):
+ if len( marks ) > 0 and not marks[-1].strip():
self.markup_lines = marks[:-1]
m = DocMarkup( self.markup, self.markup_lines )
@@ -474,7 +474,7 @@ class ContentProcessor:
for t in re_markup_tags:
m = t.match( line )
if m:
- found = string.lower( m.group( 1 ) )
+ found = m.group( 1 ).lower()
prefix = len( m.group( 0 ) )
# remove markup from line
line = " " * prefix + line[prefix:]
@@ -485,7 +485,7 @@ class ContentProcessor:
first = 0
self.add_markup() # add current markup content
self.markup = found
- if len( string.strip( line ) ) > 0:
+ if len( line.strip() ) > 0:
self.markup_lines.append( line )
elif first == 0:
self.markup_lines.append( line )
@@ -615,13 +615,13 @@ class DocBlock:
start = 0
end = len( source ) - 1
- while start < end and not string.strip( source[start] ):
+ while start < end and not source[start].strip():
start = start + 1
- while start < end and not string.strip( source[end] ):
+ while start < end and not source[end].strip():
end = end - 1
- if start == end and not string.strip( source[start] ):
+ if start == end and not source[start].strip():
self.code = []
else:
self.code = source[start:end + 1]
@@ -660,7 +660,7 @@ class DocBlock:
def get_markup_text( self, tag_name ):
result = self.get_markup_words( tag_name )
- return string.join( result )
+ return " ".join( result )
def get_markup_items( self, tag_name ):
try:
diff --git a/src/tools/docmaker/formatter.py b/src/tools/docmaker/formatter.py
index 2708fd4..e0ba2ec 100644
--- a/src/tools/docmaker/formatter.py
+++ b/src/tools/docmaker/formatter.py
@@ -53,7 +53,7 @@ class Formatter:
for field in markup.fields:
self.add_identifier( field.name, block )
- self.block_index = self.identifiers.keys()
+ self.block_index = list(self.identifiers.keys())
self.block_index.sort( key = index_key )
# also add section names to dictionary (without making them appear
diff --git a/src/tools/docmaker/sources.py b/src/tools/docmaker/sources.py
index e3b95e0..bf64e4e 100644
--- a/src/tools/docmaker/sources.py
+++ b/src/tools/docmaker/sources.py
@@ -283,7 +283,7 @@ class SourceBlock:
# now, look for a markup tag
for l in lines:
- l = string.strip( l )
+ l = l.strip()
if len( l ) > 0:
for tag in re_markup_tags:
if tag.match( l ):
diff --git a/src/tools/docmaker/tohtml.py b/src/tools/docmaker/tohtml.py
index 9f318a2..5a75b57 100644
--- a/src/tools/docmaker/tohtml.py
+++ b/src/tools/docmaker/tohtml.py
@@ -247,9 +247,9 @@ section_synopsis_footer = ''
# `&' into `<',`>', and `&'.
#
def html_quote( line ):
- result = string.replace( line, "&", "&" )
- result = string.replace( result, "<", "<" )
- result = string.replace( result, ">", ">" )
+ result = line.replace( "&", "&" )
+ result = result.replace( "<", "<" )
+ result = result.replace( ">", ">" )
return result
@@ -382,7 +382,7 @@ class HtmlFormatter( Formatter ):
r'\1‘\2’\3',
line )
# convert tilde into non-breakable space
- line = string.replace( line, "~", " " )
+ line = line.replace( "~", " " )
return para_header + line + para_footer
@@ -403,7 +403,7 @@ class HtmlFormatter( Formatter ):
else:
lines.append( self.make_html_para( item.words ) )
- return string.join( lines, '\n' )
+ return '\n'.join( lines )
def print_html_items( self, items ):
print( self.make_html_items( items ) )
@@ -521,11 +521,11 @@ class HtmlFormatter( Formatter ):
bname = self.block_index[r + c * rows]
url = self.index_items[bname]
# display `foo[bar]' as `foo (bar)'
- bname = string.replace( bname, "[", " (" )
- bname = string.replace( bname, "]", ")" )
+ bname = bname.replace( "[", " (" )
+ bname = bname.replace( "]", ")" )
# normalize url, following RFC 3986
- url = string.replace( url, "[", "(" )
- url = string.replace( url, "]", ")" )
+ url = url.replace( "[", "(" )
+ url = url.replace( "]", ")" )
line = ( line + '<td><a href="' + url + '">'
+ bname + '</a></td>' )
else:
@@ -557,7 +557,7 @@ class HtmlFormatter( Formatter ):
print( "<h1>Table of Contents</h1>" )
def toc_chapter_enter( self, chapter ):
- print( chapter_header + string.join( chapter.title ) + chapter_inter )
+ print( chapter_header + " ".join( chapter.title ) + chapter_inter )
print( '<table class="toc">' )
def toc_section_enter( self, section ):
@@ -643,8 +643,8 @@ class HtmlFormatter( Formatter ):
# display `foo[bar]' as `foo'
name = re.sub( r'\[.*\]', '', name )
# normalize url, following RFC 3986
- url = string.replace( url, "[", "(" )
- url = string.replace( url, "]", ")" )
+ url = url.replace( "[", "(" )
+ url = url.replace( "]", ")" )
line = ( line + '<a href="#' + url + '">'
+ name + '</a>' )
@@ -668,8 +668,8 @@ class HtmlFormatter( Formatter ):
# display `foo[bar]' as `foo'
name = re.sub( r'\[.*\]', '', block.name )
# normalize url, following RFC 3986
- url = string.replace( url, "[", "(" )
- url = string.replace( url, "]", ")" )
+ url = url.replace( "[", "(" )
+ url = url.replace( "]", ")" )
print( '<h3 id="' + url + '">' + name + '</h3>' )
# dump the block C source lines now
diff --git a/src/tools/docmaker/utils.py b/src/tools/docmaker/utils.py
index f40f167..fc34af8 100644
--- a/src/tools/docmaker/utils.py
+++ b/src/tools/docmaker/utils.py
@@ -33,7 +33,7 @@ output_dir = None
# sorted before `fftt__xX'.
#
def index_key( s ):
- return string.join( itertools.chain( *zip( s.lower(), s ) ) )
+ return " ".join( itertools.chain( *zip( s.lower(), s ) ) )
# Sort `input_list', placing the elements of `order_list' in front.
@@ -107,7 +107,7 @@ def make_file_list( args = None ):
args = sys.argv[1:]
for pathname in args:
- if string.find( pathname, '*' ) >= 0:
+ if pathname.find('*') >= 0:
newpath = glob.glob( pathname )
newpath.sort() # sort files -- this is important because
# of the order of files
_______________________________________________
Freetype-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/freetype-devel