Update of /cvsroot/wpdev/xmlscripts/documentation
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv934
Modified Files:
generate.py generate_html.py
Log Message:
Made it where ./ can be used to execute the generate scripts in *nix systems.
Index: generate_html.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/documentation/generate_html.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** generate_html.py 2 Jul 2004 18:30:47 -0000 1.9
--- generate_html.py 21 Aug 2004 19:04:05 -0000 1.10
***************
*** 1,2 ****
--- 1,3 ----
+ #!/usr/bin/env python
import re
***************
*** 31,38 ****
global functions
global constants
!
#print "Examining %s..." % path
files = glob(path + '/*.py')
!
for file in files:
if os.path.isfile(file):
--- 32,39 ----
global functions
global constants
!
#print "Examining %s..." % path
files = glob(path + '/*.py')
!
for file in files:
if os.path.isfile(file):
***************
*** 42,48 ****
functions += newfunctions
constants += newconstants
!
files = glob(path + '/*.cpp')
!
for file in files:
if os.path.isfile(file):
--- 43,49 ----
functions += newfunctions
constants += newconstants
!
files = glob(path + '/*.cpp')
!
for file in files:
if os.path.isfile(file):
***************
*** 54,60 ****
objectsproperties += newobjectsproperties
functions += newfunctions
!
files = glob(path + '/*.h')
!
for file in files:
if os.path.isfile(file):
--- 55,61 ----
objectsproperties += newobjectsproperties
functions += newfunctions
!
files = glob(path + '/*.h')
!
for file in files:
if os.path.isfile(file):
***************
*** 64,70 ****
objects += newobjects
objectsmethods += newobjectsmethods
! objectsproperties += newobjectsproperties
functions += newfunctions
!
# Get subdirectories and process them
entries = glob(path + '/*')
--- 65,71 ----
objects += newobjects
objectsmethods += newobjectsmethods
! objectsproperties += newobjectsproperties
functions += newfunctions
!
# Get subdirectories and process them
entries = glob(path + '/*')
***************
*** 72,79 ****
if os.path.isdir(entry):
examine(entry)
!
for path in paths:
examine(path)
!
def quote(text):
return text.replace("'", "\\'")
--- 73,80 ----
if os.path.isdir(entry):
examine(entry)
!
for path in paths:
examine(path)
!
def quote(text):
return text.replace("'", "\\'")
***************
*** 103,107 ****
overview += "<td> </td>\n";
! overview += "</tr>\n"
# Write an index file for the events.
--- 104,108 ----
overview += "<td> </td>\n";
! overview += "</tr>\n"
# Write an index file for the events.
***************
*** 117,121 ****
output.write(text)
output.close()
!
for command in commands:
template = open('templates/command.html')
--- 118,122 ----
output.write(text)
output.close()
!
for command in commands:
template = open('templates/command.html')
***************
*** 165,169 ****
overview += "<td> </td>\n";
! overview += "</tr>\n"
# Write an index file for the events.
--- 166,170 ----
overview += "<td> </td>\n";
! overview += "</tr>\n"
# Write an index file for the events.
***************
*** 179,183 ****
output.write(text)
output.close()
!
for event in events:
template = open('templates/event.html')
--- 180,184 ----
output.write(text)
output.close()
!
for event in events:
template = open('templates/event.html')
***************
*** 195,199 ****
text = text.replace('{GENERATED}', generated)
text = text.replace('{VERSION}', version)
!
output = open('webroot/event_%s.html' % event['name'].lower(), "wt")
output.write(text)
--- 196,200 ----
text = text.replace('{GENERATED}', generated)
text = text.replace('{VERSION}', version)
!
output = open('webroot/event_%s.html' % event['name'].lower(), "wt")
output.write(text)
***************
*** 202,212 ****
def objectcmp(a, b):
return cmp(a['object'], b['object'])
!
def methodcmp(a, b):
! return cmp(a['method'], b['method'])
!
def propertycmp(a, b):
! return cmp(a['property'], b['property'])
!
objects.sort(objectcmp)
--- 203,213 ----
def objectcmp(a, b):
return cmp(a['object'], b['object'])
!
def methodcmp(a, b):
! return cmp(a['method'], b['method'])
!
def propertycmp(a, b):
! return cmp(a['property'], b['property'])
!
objects.sort(objectcmp)
***************
*** 227,231 ****
overview += "<td> </td>\n";
! overview += "</tr>\n"
# Write an index file for the objects.
--- 228,232 ----
overview += "<td> </td>\n";
! overview += "</tr>\n"
# Write an index file for the objects.
***************
*** 241,249 ****
output.write(text)
output.close()
!
for object in objects:
# Compile a list of objects we inherit from (complete, recursive)
inherited = object['inherit'][:] # Create a copy
!
for i in range(0, len(objects)):
o = objects[i]
--- 242,250 ----
output.write(text)
output.close()
!
for object in objects:
# Compile a list of objects we inherit from (complete, recursive)
inherited = object['inherit'][:] # Create a copy
!
for i in range(0, len(objects)):
o = objects[i]
***************
*** 263,267 ****
if property['object'] in inherited or property['object'] == object['object']:
properties.append(property)
!
properties.sort(propertycmp)
methods.sort(methodcmp)
--- 264,268 ----
if property['object'] in inherited or property['object'] == object['object']:
properties.append(property)
!
properties.sort(propertycmp)
methods.sort(methodcmp)
***************
*** 271,286 ****
text = template.read()
template.close()
!
text = text.replace('{GENERATED}', generated)
! text = text.replace('{VERSION}', version)
!
! # Compile an overview
overview = ''
cols = 7
rows = int(math.ceil(len(methods) / 7.0))
!
for row in range(0, rows):
overview += "<tr>\n"
!
for col in range(0, cols):
id = col * rows + row
--- 272,287 ----
text = template.read()
template.close()
!
text = text.replace('{GENERATED}', generated)
! text = text.replace('{VERSION}', version)
!
! # Compile an overview
overview = ''
cols = 7
rows = int(math.ceil(len(methods) / 7.0))
!
for row in range(0, rows):
overview += "<tr>\n"
!
for col in range(0, cols):
id = col * rows + row
***************
*** 290,306 ****
else:
overview += "<td width=\"15%\"> </td>\n";
!
overview += "</tr>\n"
!
text = text.replace('{METHODOVERVIEW}', overview)
!
! # Compile an overview
overview = ''
cols = 7
rows = int(math.ceil(len(properties) / 7.0))
!
for row in range(0, rows):
overview += "<tr>\n"
!
for col in range(0, cols):
id = col * rows + row
--- 291,307 ----
else:
overview += "<td width=\"15%\"> </td>\n";
!
overview += "</tr>\n"
!
text = text.replace('{METHODOVERVIEW}', overview)
!
! # Compile an overview
overview = ''
cols = 7
rows = int(math.ceil(len(properties) / 7.0))
!
for row in range(0, rows):
overview += "<tr>\n"
!
for col in range(0, cols):
id = col * rows + row
***************
*** 310,335 ****
else:
overview += "<td width=\"15%\"> </td>\n";
!
overview += "</tr>\n"
!
text = text.replace('{PROPERTYOVERVIEW}', overview)
!
# Generate a list of methods
overview = ''
for i in range(0, len(methods)):
method = methods[i]
!
parameters = ''
if len(method['parameters']) > 0:
parameters = "%s<br/><br/>\n" % method['parameters']
!
returnvalue = ''
if len(method['returnvalue']) > 0:
returnvalue = "<span class=\"style2\">Return Value:</span><br/>%s<br/><br/>\n" % method['returnvalue']
!
description = ''
if len(method['description']) > 0:
description = "<span class=\"style2\">Description:</span><br />%s<br />\n" % method['description']
!
overview += "<a name=\"meth_%(lowername)s\"></a> \
<b><code style=\"font-size: 12px\">%(prototype)s</code></b><br />\
--- 311,336 ----
else:
overview += "<td width=\"15%\"> </td>\n";
!
overview += "</tr>\n"
!
text = text.replace('{PROPERTYOVERVIEW}', overview)
!
# Generate a list of methods
overview = ''
for i in range(0, len(methods)):
method = methods[i]
!
parameters = ''
if len(method['parameters']) > 0:
parameters = "%s<br/><br/>\n" % method['parameters']
!
returnvalue = ''
if len(method['returnvalue']) > 0:
returnvalue = "<span class=\"style2\">Return Value:</span><br/>%s<br/><br/>\n" % method['returnvalue']
!
description = ''
if len(method['description']) > 0:
description = "<span class=\"style2\">Description:</span><br />%s<br />\n" % method['description']
!
overview += "<a name=\"meth_%(lowername)s\"></a> \
<b><code style=\"font-size: 12px\">%(prototype)s</code></b><br />\
***************
*** 345,352 ****
'description': description
}
!
if i != len(methods) - 1:
overview += '<hr size="1">'
!
text = text.replace('{OBJECTMETHODS}', overview)
--- 346,353 ----
'description': description
}
!
if i != len(methods) - 1:
overview += '<hr size="1">'
!
text = text.replace('{OBJECTMETHODS}', overview)
***************
*** 363,367 ****
if property['readonly'] == '1':
readonly = ' (read only)'
!
overview += """<a name="prop_%(lowername)s"></a>\
<b><code style="font-size: 12px">%(name)s</code></b>%(readonly)s<br /><br />\
--- 364,368 ----
if property['readonly'] == '1':
readonly = ' (read only)'
!
overview += """<a name="prop_%(lowername)s"></a>\
<b><code style="font-size: 12px">%(name)s</code></b>%(readonly)s<br /><br />\
***************
*** 376,380 ****
if i != len(properties) - 1:
overview += '<hr size="1">'
!
text = text.replace('{OBJECTPROPERTIES}', overview)
--- 377,381 ----
if i != len(properties) - 1:
overview += '<hr size="1">'
!
text = text.replace('{OBJECTPROPERTIES}', overview)
***************
*** 385,389 ****
else:
text = text.replace('{DESCRIPTION}', '')
!
output = open('webroot/object_%s.html' % object['object'].lower(), "wt")
output.write(text)
--- 386,390 ----
else:
text = text.replace('{DESCRIPTION}', '')
!
output = open('webroot/object_%s.html' % object['object'].lower(), "wt")
output.write(text)
***************
*** 401,409 ****
current += '.' + module
else:
! current = module
!
if current not in modules:
modules.append(current)
!
for constant in constants:
module = constant['module']
--- 402,410 ----
current += '.' + module
else:
! current = module
!
if current not in modules:
modules.append(current)
!
for constant in constants:
module = constant['module']
***************
*** 414,421 ****
current += '.' + module
else:
! current = module
!
if current not in modules:
! modules.append(current)
# Create an overview
--- 415,422 ----
current += '.' + module
else:
! current = module
!
if current not in modules:
! modules.append(current)
# Create an overview
***************
*** 437,441 ****
overview += "<td> </td>\n";
! overview += "</tr>\n"
# Write an index file for the objects.
--- 438,442 ----
overview += "<td> </td>\n";
! overview += "</tr>\n"
# Write an index file for the objects.
***************
*** 460,473 ****
if function['module'] == module:
localfunctions.append(function)
!
localconstants = []
for constant in constants:
if constant['module'] == module:
localconstants.append(constant)
!
template = open('templates/module.html')
text = template.read()
template.close()
!
text = text.replace('{GENERATED}', generated)
text = text.replace('{VERSION}', version)
--- 461,474 ----
if function['module'] == module:
localfunctions.append(function)
!
localconstants = []
for constant in constants:
if constant['module'] == module:
localconstants.append(constant)
!
template = open('templates/module.html')
text = template.read()
template.close()
!
text = text.replace('{GENERATED}', generated)
text = text.replace('{VERSION}', version)
***************
*** 477,486 ****
cols = 7
rows = int(math.ceil(len(localfunctions) / 7.0))
!
localfunctions.sort(namesort)
!
for row in range(0, rows):
overview += "<tr>\n"
!
for col in range(0, cols):
id = col * rows + row
--- 478,487 ----
cols = 7
rows = int(math.ceil(len(localfunctions) / 7.0))
!
localfunctions.sort(namesort)
!
for row in range(0, rows):
overview += "<tr>\n"
!
for col in range(0, cols):
id = col * rows + row
***************
*** 490,498 ****
else:
overview += "<td width=\"15%\"> </td>\n";
!
overview += "</tr>\n"
!
text = text.replace('{FUNCTIONOVERVIEW}', overview)
!
# Generate a list of methods
overview = ''
--- 491,499 ----
else:
overview += "<td width=\"15%\"> </td>\n";
!
overview += "</tr>\n"
!
text = text.replace('{FUNCTIONOVERVIEW}', overview)
!
# Generate a list of methods
overview = ''
***************
*** 500,519 ****
overview += """<p><span class="sectiontitle">MODULE FUNCTIONS</span><br>
<br>"""
!
for i in range(0, len(localfunctions)):
function = localfunctions[i]
!
parameters = ''
if len(function['parameters']) > 0:
parameters = "%s<br/><br/>\n" % function['parameters']
!
returnvalue = ''
if len(function['returnvalue']) > 0:
returnvalue = "<span class=\"style2\">Return Value:</span><br/>%s<br/><br/>\n" % function['returnvalue']
!
description = ''
if len(function['description']) > 0:
description = "<span class=\"style2\">Description:</span><br />%s<br />\n" % function['description']
!
overview += "<a name=\"func_%(lowername)s\"></a> \
<b><code style=\"font-size: 12px\">%(prototype)s</code></b><br />\
--- 501,520 ----
overview += """<p><span class="sectiontitle">MODULE FUNCTIONS</span><br>
<br>"""
!
for i in range(0, len(localfunctions)):
function = localfunctions[i]
!
parameters = ''
if len(function['parameters']) > 0:
parameters = "%s<br/><br/>\n" % function['parameters']
!
returnvalue = ''
if len(function['returnvalue']) > 0:
returnvalue = "<span class=\"style2\">Return Value:</span><br/>%s<br/><br/>\n" % function['returnvalue']
!
description = ''
if len(function['description']) > 0:
description = "<span class=\"style2\">Description:</span><br />%s<br />\n" % function['description']
!
overview += "<a name=\"func_%(lowername)s\"></a> \
<b><code style=\"font-size: 12px\">%(prototype)s</code></b><br />\
***************
*** 529,545 ****
'description': description
}
!
if i != len(localfunctions) - 1:
overview += '<hr size="1">'
!
text = text.replace('{MODULEFUNCTIONS}', overview)
!
# Create a function overview first
overview = ''
cols = 4
rows = int(math.ceil(len(localconstants) / 4.0))
!
localconstants.sort(namesort)
!
for row in range(0, rows):
if row == 0:
--- 530,546 ----
'description': description
}
!
if i != len(localfunctions) - 1:
overview += '<hr size="1">'
!
text = text.replace('{MODULEFUNCTIONS}', overview)
!
# Create a function overview first
overview = ''
cols = 4
rows = int(math.ceil(len(localconstants) / 4.0))
!
localconstants.sort(namesort)
!
for row in range(0, rows):
if row == 0:
***************
*** 547,553 ****
<br><strong>Constants:</strong>
<table width="100%" border="0" cellspacing="0" cellpadding="2">"""
!
overview += "<tr>\n"
!
for col in range(0, cols):
id = col * rows + row
--- 548,554 ----
<br><strong>Constants:</strong>
<table width="100%" border="0" cellspacing="0" cellpadding="2">"""
!
overview += "<tr>\n"
!
for col in range(0, cols):
id = col * rows + row
***************
*** 557,581 ****
else:
overview += "<td width=\"25%\"> </td>\n";
!
overview += "</tr>\n"
!
if row == rows - 1:
overview += "</table>"
!
! text = text.replace('{CONSTANTSOVERVIEW}', overview)
!
# Generate a list of constants
overview = ''
!
if len(localconstants) > 0:
overview += """<p><span class="sectiontitle">MODULE CONSTANTS</span><br>
<br>"""
!
for i in range(0, len(localconstants)):
constant = localconstants[i]
consttext = ''
!
for const in constant['constants']:
! # If this constant is for a number,
# color it red, otherwise color it grey
quotecolor = re.compile('((?<!\\\\)".*?(?<!\\\\)")')
--- 558,582 ----
else:
overview += "<td width=\"25%\"> </td>\n";
!
overview += "</tr>\n"
!
if row == rows - 1:
overview += "</table>"
!
! text = text.replace('{CONSTANTSOVERVIEW}', overview)
!
# Generate a list of constants
overview = ''
!
if len(localconstants) > 0:
overview += """<p><span class="sectiontitle">MODULE CONSTANTS</span><br>
<br>"""
!
for i in range(0, len(localconstants)):
constant = localconstants[i]
consttext = ''
!
for const in constant['constants']:
! # If this constant is for a number,
# color it red, otherwise color it grey
quotecolor = re.compile('((?<!\\\\)".*?(?<!\\\\)")')
***************
*** 589,593 ****
newconst += const[result.end():]
const = newconst
!
quotecolor = re.compile('\\#.*')
curpos = 0
--- 590,594 ----
newconst += const[result.end():]
const = newconst
!
quotecolor = re.compile('\\#.*')
curpos = 0
***************
*** 599,609 ****
curpos = len(newconst)
newconst += const[result.end():]
! const = newconst
!
consttext += const
consttext += "<br>\n"
if len(constant['description']) > 0:
! constant['description'] += '<br>'
overview += "<a name=\"const_%(anchor)s\"></a><b><code style=\"font-size: 12px\">%(name)s</code></b><br />\
--- 600,610 ----
curpos = len(newconst)
newconst += const[result.end():]
! const = newconst
!
consttext += const
consttext += "<br>\n"
if len(constant['description']) > 0:
! constant['description'] += '<br>'
overview += "<a name=\"const_%(anchor)s\"></a><b><code style=\"font-size: 12px\">%(name)s</code></b><br />\
***************
*** 615,624 ****
'constants': consttext
}
!
if i != len(localconstants) - 1:
! overview += '<hr size="1">'
!
text = text.replace('{MODULECONSTANTS}', overview)
!
output = open('webroot/module_%s.html' % module.replace('.', '_').lower(), "wt")
output.write(text)
--- 616,625 ----
'constants': consttext
}
!
if i != len(localconstants) - 1:
! overview += '<hr size="1">'
!
text = text.replace('{MODULECONSTANTS}', overview)
!
output = open('webroot/module_%s.html' % module.replace('.', '_').lower(), "wt")
output.write(text)
Index: generate.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/documentation/generate.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** generate.py 26 Jun 2004 21:51:28 -0000 1.8
--- generate.py 21 Aug 2004 19:04:05 -0000 1.9
***************
*** 1,2 ****
--- 1,3 ----
+ #!/usr/bin/env python
import time
***************
*** 26,33 ****
global objectsproperties
global functions
!
#print "Examining %s..." % path
files = glob(path + '/*.py')
!
for file in files:
if os.path.isfile(file):
--- 27,34 ----
global objectsproperties
global functions
!
#print "Examining %s..." % path
files = glob(path + '/*.py')
!
for file in files:
if os.path.isfile(file):
***************
*** 36,42 ****
events += newevents
functions += newfunctions
!
files = glob(path + '/*.cpp')
!
for file in files:
if os.path.isfile(file):
--- 37,43 ----
events += newevents
functions += newfunctions
!
files = glob(path + '/*.cpp')
!
for file in files:
if os.path.isfile(file):
***************
*** 48,54 ****
objectsproperties += newobjectsproperties
functions += newfunctions
!
files = glob(path + '/*.h')
!
for file in files:
if os.path.isfile(file):
--- 49,55 ----
objectsproperties += newobjectsproperties
functions += newfunctions
!
files = glob(path + '/*.h')
!
for file in files:
if os.path.isfile(file):
***************
*** 58,64 ****
objects += newobjects
objectsmethods += newobjectsmethods
! objectsproperties += newobjectsproperties
functions += newfunctions
!
# Get subdirectories and process them
entries = glob(path + '/*')
--- 59,65 ----
objects += newobjects
objectsmethods += newobjectsmethods
! objectsproperties += newobjectsproperties
functions += newfunctions
!
# Get subdirectories and process them
entries = glob(path + '/*')
***************
*** 66,70 ****
if os.path.isdir(entry):
examine(entry)
!
for path in paths:
examine(path)
--- 67,71 ----
if os.path.isdir(entry):
examine(entry)
!
for path in paths:
examine(path)
***************
*** 93,102 ****
# Copy methods and properties from inherited object types
for method in objectsmethods:
!
if method['object'] in object['inherit']:
method = dict(method)
method['object'] = object['object']
objectsmethods.append(method)
!
for property in objectsproperties:
if property['object'] in object['inherit']:
--- 94,103 ----
# Copy methods and properties from inherited object types
for method in objectsmethods:
!
if method['object'] in object['inherit']:
method = dict(method)
method['object'] = object['object']
objectsmethods.append(method)
!
for property in objectsproperties:
if property['object'] in object['inherit']:
***************
*** 106,110 ****
print "REPLACE INTO documentation_objects VALUES('%s', '%s');" % (quote(object['object']), quote(object['description']))
!
for method in objectsmethods:
print "REPLACE INTO documentation_objects_methods VALUES('%s', '%s', '%s', '%s', '%s', '%s');" % (quote(method['object']), quote(method['method']), quote(method['prototype']), quote(method['parameters']), quote(method['returnvalue']), quote(method['description']))
--- 107,111 ----
print "REPLACE INTO documentation_objects VALUES('%s', '%s');" % (quote(object['object']), quote(object['description']))
!
for method in objectsmethods:
print "REPLACE INTO documentation_objects_methods VALUES('%s', '%s', '%s', '%s', '%s', '%s');" % (quote(method['object']), quote(method['method']), quote(method['prototype']), quote(method['parameters']), quote(method['returnvalue']), quote(method['description']))
|