shithub: freetype+ttf2subf

Download patch

ref: 32ee45e09fd37e00b82e0fbaa228f6b0dc73848e
parent: 6096b5a11c1c1118b0f99b0929f69b4e5b489034
author: David Turner <[email protected]>
date: Mon Jan 7 07:09:51 EST 2002

fixed html quoting in DocMaker

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
-2002-01-06  David Turner  <[email protected]>
+2002-01-07  David Turner  <[email protected]>
 
         * docs/BUGS, docs/CHANGES: updating documentation for 2.0.6 release
+
+        * src/tools/docmaker.py: fixed HTML quoting in sources
 
         * include/freetype/config/ftoption.h: setting default options for
         a release build (debugging off, bytecode interpreter off)
--- a/src/tools/docmaker.py
+++ b/src/tools/docmaker.py
@@ -171,13 +171,18 @@
 # Translate a single line of source to HTML.  This will convert
 # a "<" into "&lt.", ">" into "&gt.", etc.
 #
-def html_format( line ):
-    result = string.replace( line, "<", "&lt." )
-    result = string.replace( line, ">", "&gt." )
-    result = string.replace( line, "&", "&amp." )
+def html_quote( line ):
+    result = string.replace( line,   "&", "&amp;" )
+    result = string.replace( result, "<", "&lt;" )
+    result = string.replace( result, ">", "&gt;" )
     return result
 
+# same as 'html_quote', but ignores left and right brackets
+#
+def html_quote0( line ):
+    return string.replace( line, "&", "&amp;" )
 
+
 # Open the standard output to a given project documentation file.  Use
 # "output_dir" to determine the filename location if necessary and save the
 # old stdout in a tuple that is returned by this function.
@@ -355,10 +360,10 @@
         # The code footer should be directly appended to the last code
         # line to avoid an additional blank line.
         #
-        sys.stdout.write( code_header )
+        print code_header,
         for line in self.lines[0 : l+1]:
-            sys.stdout.write( '\n' + html_format(line) )
-        sys.stdout.write( code_footer )
+            print '\n' + html_quote(line),
+        print code_footer,
 
 
 
@@ -435,7 +440,7 @@
                     word = '?' + word
 
             if cursor + len( word ) + 1 > max_width:
-                print html_format( line )
+                print html_quote0(line)
                 cursor = 0
                 line   = ""
 
@@ -451,7 +456,7 @@
             #
             if extra:
                 if cursor + len( extra ) + 1 > max_width:
-                    print html_format( line )
+                    print html_quote0(line)
                     cursor = 0
                     line   = ""
 
@@ -460,7 +465,7 @@
                 extra  = None
 
         if cursor > 0:
-            print html_format(line)
+            print html_quote0(line)
 
         # print "�" # for debugging only
 
@@ -877,7 +882,7 @@
         print source_header
         print ""
         for line in lines[0 : l+1]:
-            print line
+            print html_quote(line)
         print source_footer
 
         in_table = 0