mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	Jon Nelson <jnelson@users.sourceforge.net>:
Make the documentation tools work with Python 1.5.2. [Slightly modified from submitted patch. --FLD] This closes SF bug #132005.
This commit is contained in:
		
							parent
							
								
									a05460c148
								
							
						
					
					
						commit
						498cb15306
					
				
					 2 changed files with 17 additions and 14 deletions
				
			
		| 
						 | 
					@ -1,6 +1,7 @@
 | 
				
			||||||
#! /usr/bin/env python
 | 
					#! /usr/bin/env python
 | 
				
			||||||
#  -*- Python -*-
 | 
					#  -*- Python -*-
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import string
 | 
				
			||||||
import support
 | 
					import support
 | 
				
			||||||
import sys
 | 
					import sys
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,7 +12,7 @@ def collect(fp):
 | 
				
			||||||
        line = fp.readline()
 | 
					        line = fp.readline()
 | 
				
			||||||
        if not line:
 | 
					        if not line:
 | 
				
			||||||
            break
 | 
					            break
 | 
				
			||||||
        line = line.strip()
 | 
					        line = string.strip(line)
 | 
				
			||||||
        if line:
 | 
					        if line:
 | 
				
			||||||
            names.append(line)
 | 
					            names.append(line)
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
| 
						 | 
					@ -26,22 +27,24 @@ def main():
 | 
				
			||||||
    options.parse(sys.argv[1:])
 | 
					    options.parse(sys.argv[1:])
 | 
				
			||||||
    names = collect(sys.stdin)
 | 
					    names = collect(sys.stdin)
 | 
				
			||||||
    percol = (len(names) + options.columns - 1) / options.columns
 | 
					    percol = (len(names) + options.columns - 1) / options.columns
 | 
				
			||||||
    colnums = [percol*i for i in range(options.columns)]
 | 
					    colnums = []
 | 
				
			||||||
 | 
					    for i in range(options.columns):
 | 
				
			||||||
 | 
					        colnums.append(percol*i)
 | 
				
			||||||
    fp = options.get_output_file()
 | 
					    fp = options.get_output_file()
 | 
				
			||||||
    print >>fp, options.get_header().rstrip()
 | 
					    fp.write(string.rstrip(options.get_header()) + "\n")
 | 
				
			||||||
    print >>fp, THANKS
 | 
					    fp.write(THANKS + "\n")
 | 
				
			||||||
    print >>fp, '<table width="100%" align="center">'
 | 
					    fp.write('<table width="100%" align="center">\n')
 | 
				
			||||||
    for i in range(percol):
 | 
					    for i in range(percol):
 | 
				
			||||||
        print >>fp, "  <tr>"
 | 
					        fp.write("  <tr>\n")
 | 
				
			||||||
        for j in colnums:
 | 
					        for j in colnums:
 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
                print >>fp, "    <td>%s</td>" % names[i + j]
 | 
					                fp.write("    <td>%s</td>\n" % names[i + j])
 | 
				
			||||||
            except IndexError:
 | 
					            except IndexError:
 | 
				
			||||||
                print >>fp, "    <td> </td>"
 | 
					                pass
 | 
				
			||||||
        print >>fp, "  </tr>"
 | 
					        fp.write("  </tr>\n")
 | 
				
			||||||
    print >>fp, "</table>"
 | 
					    fp.write("</table>\n")
 | 
				
			||||||
    print >>fp, options.get_footer().rstrip()
 | 
					    fp.write(string.rstrip(options.get_footer()) + "\n")
 | 
				
			||||||
 | 
					    fp.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
THANKS = '''\
 | 
					THANKS = '''\
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -52,8 +52,8 @@ class Node(buildindex.Node):
 | 
				
			||||||
    annotation = ""
 | 
					    annotation = ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __init__(self, link, str, seqno):
 | 
					    def __init__(self, link, str, seqno):
 | 
				
			||||||
        parts = str.split(None, 1)
 | 
					        parts = string.split(str, None, 1)
 | 
				
			||||||
        if parts[0].endswith("</tt>"):
 | 
					        if parts[0][-5:] == "</tt>":
 | 
				
			||||||
            self.modname = parts[0][:-5]
 | 
					            self.modname = parts[0][:-5]
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            self.modname = parts[0]
 | 
					            self.modname = parts[0]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue