Update python manual scripts to py3 compatibility (#2204)

This commit is contained in:
Seth R. Johnson 2022-03-17 20:29:22 -04:00 committed by GitHub
commit 8f9a432040
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 12 deletions

View file

@ -11,10 +11,8 @@
# then change the heading link name to something that does not look like an
# autogenerated link name.
###############################################################################
import sys
import re
import string
###############################################################################
# Functions
@ -58,11 +56,11 @@ def getheadingtext(m, s):
###############################################################################
if len(sys.argv) != 3:
print "usage: makechap.py filename num"
print("usage: makechap.py filename num")
sys.exit(1)
filename = sys.argv[1]
filenamebase = string.split(filename,".")[0]
filenamebase = filename.split(".")[0]
num = int(sys.argv[2])
section = 0
@ -223,6 +221,6 @@ open(filename,"w").write(data)
# Print the TOC data to stdout correcting the anchor links for external referencing
index = index.replace("<li><a href=\"#","<li><a href=\"%s#" % filename)
print """<h3><a href="%s#%s">%d %s</a></h3>\n""" % (filename,filenamebase,num,name)
print index
print("""<h3><a href="%s#%s">%d %s</a></h3>\n""" % (filename,filenamebase,num,name))
print(index)

View file

@ -5,7 +5,7 @@ import os
chs = open("chapters").readlines()
f = open("Contents.html","w")
print >>f, """
f.write("""
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
@ -17,7 +17,8 @@ print >>f, """
<H1><a name="Contents"></a>SWIG Users Manual</H1>
<p>
"""
""")
f.close()
@ -25,15 +26,16 @@ num = 1
for c in chs:
c = c.strip()
print "Processing %s" % c
print("Processing " + c)
if c:
os.system("python makechap.py %s %d >> Contents.html" % (c,num))
num += 1
f = open("Contents.html","a")
print >>f, """
f.write("""
</BODY>
</HTML>
"""
""")